From 6821b67124604da690c5e9276d5370d679c63ac8 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Wed, 25 Mar 2009 19:39:21 -0400 Subject: Imported Upstream version 5.3.0RC1 --- Zend/FlexLexer.h | 186 - Zend/Makefile.am | 6 +- Zend/Zend.dsp | 8 + Zend/Zend.m4 | 22 +- Zend/ZendTS.dsp | 4 + Zend/acconfig.h | 12 +- Zend/acinclude.m4 | 116 +- Zend/bench.php | 4 +- Zend/configure.in | 3 +- Zend/flex.skl | 1648 -- Zend/header | 4 +- Zend/tests/004.phpt | 2 +- Zend/tests/005.phpt | 2 +- Zend/tests/006.phpt | 2 +- Zend/tests/007.phpt | 2 +- Zend/tests/009.phpt | 2 + Zend/tests/011.phpt | 14 +- Zend/tests/014.phpt | 4 +- Zend/tests/015.phpt | 12 +- Zend/tests/017.phpt | 12 +- Zend/tests/018.phpt | 8 +- Zend/tests/020.phpt | 7 +- Zend/tests/021.phpt | 37 + Zend/tests/022.phpt | 24 + Zend/tests/023.phpt | 45 + Zend/tests/024.phpt | 51 + Zend/tests/025.phpt | 32 + Zend/tests/026.phpt | 25 + Zend/tests/027.phpt | 22 + Zend/tests/028.phpt | 23 + Zend/tests/029.phpt | 85 + Zend/tests/030.phpt | 70 + Zend/tests/031.phpt | 11 + Zend/tests/032.phpt | 13 + Zend/tests/033.phpt | 31 + Zend/tests/034.phpt | 26 + Zend/tests/035.phpt | 18 + Zend/tests/036.phpt | 13 + Zend/tests/037.phpt | 19 + Zend/tests/038.phpt | 12 + Zend/tests/access_modifiers_001.phpt | 14 + Zend/tests/access_modifiers_002.phpt | 13 + Zend/tests/access_modifiers_003.phpt | 13 + Zend/tests/access_modifiers_004.phpt | 14 + Zend/tests/access_modifiers_005.phpt | 14 + Zend/tests/access_modifiers_006.phpt | 14 + Zend/tests/access_modifiers_007.phpt | 13 + Zend/tests/access_modifiers_008.phpt | 21 + Zend/tests/access_modifiers_009.phpt | 26 + Zend/tests/access_modifiers_010.phpt | 31 + Zend/tests/anonymous_func_001.phpt | 35 + Zend/tests/anonymous_func_002.phpt | 16 + Zend/tests/anonymous_func_003.phpt | 15 + Zend/tests/assign_to_var_001.phpt | 18 + Zend/tests/assign_to_var_002.phpt | 18 + Zend/tests/assign_to_var_003.phpt | 18 + Zend/tests/assign_to_var_004.phpt | 22 + Zend/tests/bug20242.phpt | 5 - Zend/tests/bug26077.phpt | 18 +- Zend/tests/bug26229.phpt | 58 +- Zend/tests/bug26698.phpt | 146 +- Zend/tests/bug27268.phpt | 56 +- Zend/tests/bug27598.phpt | 24 +- Zend/tests/bug28072.phpt | 2 +- Zend/tests/bug28377.phpt | 46 +- Zend/tests/bug29104.phpt | 54 +- Zend/tests/bug29210.phpt | 208 +- Zend/tests/bug29505.phpt | 62 +- Zend/tests/bug29890.phpt | 46 +- Zend/tests/bug29896.phpt | 56 +- Zend/tests/bug29944.phpt | 32 +- Zend/tests/bug30080.phpt | 36 +- Zend/tests/bug30140.phpt | 60 +- Zend/tests/bug30161.phpt | 68 +- Zend/tests/bug30332.phpt | 40 - Zend/tests/bug30394.phpt | 60 +- Zend/tests/bug30451.phpt | 72 +- Zend/tests/bug30519.phpt | 20 +- Zend/tests/bug30702.phpt | 78 +- Zend/tests/bug30791.phpt | 70 +- Zend/tests/bug30820.phpt | 54 +- Zend/tests/bug30828.phpt | 122 +- Zend/tests/bug30889.phpt | 62 +- Zend/tests/bug30922.phpt | 26 +- Zend/tests/bug31177-2.phpt | 36 +- Zend/tests/bug31177.phpt | 88 +- Zend/tests/bug31525.phpt | 44 +- Zend/tests/bug31720.phpt | 4 +- Zend/tests/bug31828.phpt | 25 - Zend/tests/bug32080.phpt | 18 - Zend/tests/bug32290.phpt | 6 +- Zend/tests/bug32296.phpt | 120 +- Zend/tests/bug32322.phpt | 160 +- Zend/tests/bug32427.phpt | 38 +- Zend/tests/bug32428.phpt | 26 +- Zend/tests/bug32596.phpt | 54 +- Zend/tests/bug32660.phpt | 78 +- Zend/tests/bug32674.phpt | 124 +- Zend/tests/bug32799.phpt | 42 +- Zend/tests/bug32833.phpt | 20 +- Zend/tests/bug32852.phpt | 38 - Zend/tests/bug32993.phpt | 58 +- Zend/tests/bug33116.phpt | 44 +- Zend/tests/bug33171.phpt | 54 +- Zend/tests/bug33243.phpt | 25 - Zend/tests/bug33257.phpt | 50 +- Zend/tests/bug33277.phpt | 56 +- Zend/tests/bug33318.phpt | 14 +- Zend/tests/bug33558.phpt | 42 +- Zend/tests/bug33732.phpt | 90 +- Zend/tests/bug33771.phpt | 6 +- Zend/tests/bug33996.phpt | 58 +- Zend/tests/bug33999.phpt | 60 +- Zend/tests/bug34064.phpt | 70 +- Zend/tests/bug34065.phpt | 30 +- Zend/tests/bug34137.phpt | 20 +- Zend/tests/bug34260.phpt | 72 +- Zend/tests/bug34467.phpt | 54 +- Zend/tests/bug34518.phpt | 76 +- Zend/tests/bug34617.phpt | 36 +- Zend/tests/bug34712.phpt | 28 - Zend/tests/bug34767.phpt | 33 - Zend/tests/bug34786.phpt | 44 +- Zend/tests/bug34879.phpt | 20 +- Zend/tests/bug34893.phpt | 66 +- Zend/tests/bug35017.phpt | 42 +- Zend/tests/bug35106.phpt | 28 +- Zend/tests/bug35163.phpt | 38 + Zend/tests/bug35163_2.phpt | 65 + Zend/tests/bug35163_3.phpt | 39 + Zend/tests/bug35239.phpt | 82 +- Zend/tests/bug35393.phpt | 60 +- Zend/tests/bug35411.phpt | 38 +- Zend/tests/bug35437.phpt | 54 +- Zend/tests/bug35470.phpt | 22 +- Zend/tests/bug35655.phpt | 2 +- Zend/tests/bug36071.phpt | 20 +- Zend/tests/bug36214.phpt | 111 +- Zend/tests/bug36303.phpt | 26 +- Zend/tests/bug36513.phpt | 44 +- Zend/tests/bug36568.phpt | 30 +- Zend/tests/bug37046.phpt | 46 +- Zend/tests/bug37144.phpt | 32 +- Zend/tests/bug37212.phpt | 6 +- Zend/tests/bug37251.phpt | 19 + Zend/tests/bug37667.phpt | 6 +- Zend/tests/bug37715.phpt | 58 +- Zend/tests/bug38146.phpt | 38 +- Zend/tests/bug38211.phpt | 20 +- Zend/tests/bug38220.phpt | 184 +- Zend/tests/bug38234.phpt | 36 +- Zend/tests/bug38287.phpt | 90 +- Zend/tests/bug38469.phpt | 108 +- Zend/tests/bug38623.phpt | 32 +- Zend/tests/bug38779.phpt | 3 + Zend/tests/bug38942.phpt | 34 +- Zend/tests/bug39017.phpt | 22 +- Zend/tests/bug39018.phpt | 82 + Zend/tests/bug39018_2.phpt | 18 + Zend/tests/bug39127.phpt | 21 + Zend/tests/bug39297.phpt | 90 +- Zend/tests/bug39304.phpt | 20 +- Zend/tests/bug39346.phpt | 26 + Zend/tests/bug39438.phpt | 90 +- Zend/tests/bug39445.phpt | 32 +- Zend/tests/bug39449.phpt | 80 +- Zend/tests/bug39542.phpt | 48 +- Zend/tests/bug39775.phpt | 40 +- Zend/tests/bug39825.phpt | 26 +- Zend/tests/bug39990.phpt | 34 +- Zend/tests/bug40236.phpt | 34 +- Zend/tests/bug40261.phpt | 50 +- Zend/tests/bug40509.phpt | 52 +- Zend/tests/bug40705.phpt | 52 +- Zend/tests/bug40757.phpt | 56 +- Zend/tests/bug40770.phpt | 44 +- Zend/tests/bug40809.phpt | 66 +- Zend/tests/bug41209.phpt | 2 +- Zend/tests/bug41633_1.phpt | 24 +- Zend/tests/bug41633_2.phpt | 22 +- Zend/tests/bug41633_3.phpt | 24 +- Zend/tests/bug41633_4.phpt | 24 +- Zend/tests/bug41929.phpt | 48 +- Zend/tests/bug41961.phpt | 58 +- Zend/tests/bug42119.phpt | 19 - Zend/tests/bug42211.phpt | 7 +- Zend/tests/bug42767.phpt | 7 + Zend/tests/bug42798.phpt | 15 + Zend/tests/bug42802.phpt | 40 + Zend/tests/bug42819.phpt | 302 + Zend/tests/bug42820.phpt | 31 + Zend/tests/bug42859.phpt | 12 + Zend/tests/bug42937.phpt | 10 +- Zend/tests/bug43027.phpt | 11 + Zend/tests/bug43128.phpt | 2 + Zend/tests/bug43183.phpt | 12 + Zend/tests/bug43323.phpt | 12 + Zend/tests/bug43332_1.phpt | 15 + Zend/tests/bug43332_2.phpt | 15 + Zend/tests/bug43343.phpt | 11 + Zend/tests/bug43344_1.phpt | 32 + Zend/tests/bug43344_10.phpt | 8 + Zend/tests/bug43344_11.phpt | 11 + Zend/tests/bug43344_12.phpt | 11 + Zend/tests/bug43344_13.phpt | 12 + Zend/tests/bug43344_2.phpt | 9 + Zend/tests/bug43344_3.phpt | 12 + Zend/tests/bug43344_4.phpt | 12 + Zend/tests/bug43344_5.phpt | 13 + Zend/tests/bug43344_6.phpt | 9 + Zend/tests/bug43344_7.phpt | 12 + Zend/tests/bug43344_8.phpt | 12 + Zend/tests/bug43344_9.phpt | 13 + Zend/tests/bug43426.phpt | 39 + Zend/tests/bug43450.phpt | 70 +- Zend/tests/bug43651.phpt | 41 + Zend/tests/bug43851.phpt | 13 + Zend/tests/bug43918.phpt | 44 + Zend/tests/bug44414.phpt | 15 + Zend/tests/bug44653.phpt | 30 + Zend/tests/bug44660.phpt | 49 + Zend/tests/bug44899.phpt | 38 + Zend/tests/bug44899_2.phpt | 43 + Zend/tests/bug44913.phpt | 17 + Zend/tests/bug45147.phpt | 8 + Zend/tests/bug45178.phpt | 4 +- Zend/tests/bug45180.phpt | 61 + Zend/tests/bug45186.phpt | 54 + Zend/tests/bug45186_2.phpt | 50 + Zend/tests/bug45742.phpt | 24 + Zend/tests/bug45744.phpt | 40 + Zend/tests/bug45805.phpt | 2 +- Zend/tests/bug45877.phpt | 23 + Zend/tests/bug45910.phpt | 28 + Zend/tests/bug45910_2.phpt | 28 + Zend/tests/bug46106.phpt | 22 + Zend/tests/bug46196.phpt | 31 + Zend/tests/bug46238.phpt | 120 + Zend/tests/bug46241.phpt | 50 + Zend/tests/bug46304.phpt | 65 + Zend/tests/bug46409.phpt | 25 + Zend/tests/bug46665.phpt | 15 + Zend/tests/bug46665_autoload.inc | 5 + Zend/tests/bug46701.phpt | 12 +- Zend/tests/bug46811.phpt | 13 + Zend/tests/bug46813.phpt | 24 + Zend/tests/bug47054.phpt | 39 + Zend/tests/bug47320.phpt | 26 + Zend/tests/bug47343.phpt | 44 + Zend/tests/bug47572.phpt | 17 + Zend/tests/bug47593.phpt | 34 + Zend/tests/bug47704.phpt | 9 + Zend/tests/call_static.phpt | 20 + Zend/tests/call_static_002.phpt | 26 + Zend/tests/call_static_003.phpt | 38 + Zend/tests/call_static_004.phpt | 21 + Zend/tests/call_static_005.phpt | 17 + Zend/tests/call_static_006.phpt | 30 + Zend/tests/call_static_007.phpt | 34 + Zend/tests/catch.phpt | 46 +- Zend/tests/catch_002.phpt | 66 +- Zend/tests/catch_003.phpt | 76 +- Zend/tests/catch_004.phpt | 86 +- Zend/tests/class_alias_001.phpt | 30 + Zend/tests/class_alias_002.phpt | 12 + Zend/tests/class_alias_003.phpt | 22 + Zend/tests/class_alias_004.phpt | 15 + Zend/tests/class_alias_005.phpt | 27 + Zend/tests/class_alias_006.phpt | 10 + Zend/tests/class_alias_007.phpt | 19 + Zend/tests/class_alias_008.phpt | 16 + Zend/tests/class_alias_009.phpt | 14 + Zend/tests/class_alias_010.phpt | 14 + Zend/tests/class_alias_011.phpt | 26 + Zend/tests/class_alias_012.phpt | 33 + Zend/tests/class_alias_013.phpt | 26 + Zend/tests/class_alias_014.phpt | 15 + Zend/tests/class_alias_015.phpt | 18 + Zend/tests/class_alias_016.phpt | 21 + Zend/tests/class_alias_017.phpt | 33 + Zend/tests/class_alias_018.phpt | 37 + Zend/tests/class_alias_019.phpt | 17 + Zend/tests/class_alias_020.phpt | 33 + Zend/tests/class_alias_021.phpt | 25 + Zend/tests/class_constants_004.phpt | 44 + Zend/tests/class_exists_001.phpt | 27 + Zend/tests/class_exists_002.phpt | 26 + Zend/tests/class_exists_003.phpt | 20 + Zend/tests/clone_001.phpt | 10 + Zend/tests/clone_002.phpt | 25 + Zend/tests/clone_003.phpt | 12 + Zend/tests/clone_004.phpt | 20 + Zend/tests/clone_uncloneable.phpt | 20 - Zend/tests/closure_001.phpt | 30 + Zend/tests/closure_002.phpt | 29 + Zend/tests/closure_003.phpt | 33 + Zend/tests/closure_004.phpt | 35 + Zend/tests/closure_006.phpt | 19 + Zend/tests/closure_008.phpt | 22 + Zend/tests/closure_009.phpt | 31 + Zend/tests/closure_010.phpt | 18 + Zend/tests/closure_011.phpt | 14 + Zend/tests/closure_012.phpt | 24 + Zend/tests/closure_013.phpt | 25 + Zend/tests/closure_014.phpt | 79 + Zend/tests/closure_015.phpt | 19 + Zend/tests/closure_016.phpt | 51 + Zend/tests/closure_017.phpt | 12 + Zend/tests/closure_018.phpt | 28 + Zend/tests/closure_019.phpt | 26 + Zend/tests/closure_020.phpt | 52 + Zend/tests/closure_021.phpt | 22 + Zend/tests/closure_022.phpt | 12 + Zend/tests/closure_023.phpt | 14 + Zend/tests/closure_024.phpt | 16 + Zend/tests/closure_025.phpt | 12 + Zend/tests/closure_026.phpt | 47 + Zend/tests/closure_027.phpt | 31 + Zend/tests/closure_028.phpt | 14 + Zend/tests/closure_029.phpt | 14 + Zend/tests/closure_030.phpt | 20 + Zend/tests/closure_031.phpt | 16 + Zend/tests/closure_032.phpt | 70 + Zend/tests/closure_033.phpt | 28 + Zend/tests/constants/dir-constant-eval.phpt | 8 + Zend/tests/constants/dir-constant-includes.phpt | 22 + .../constants/dir-constant-nested_includes.phpt | 70 + Zend/tests/constants/dir-constant-normal.phpt | 10 + Zend/tests/constants/fixtures/folder1/fixture.php | 3 + .../fixtures/folder1/subfolder1/fixture.php | 3 + .../fixtures/folder1/subfolder2/fixture.php | 3 + .../fixtures/folder1/subfolder3/fixture.php | 3 + .../fixtures/folder1/subfolder4/fixture.php | 3 + Zend/tests/constants/fixtures/folder2/fixture.php | 3 + .../fixtures/folder2/subfolder1/fixture.php | 3 + .../fixtures/folder2/subfolder2/fixture.php | 3 + .../fixtures/folder2/subfolder3/fixture.php | 3 + .../fixtures/folder2/subfolder4/fixture.php | 3 + Zend/tests/constants/fixtures/folder3/fixture.php | 3 + .../fixtures/folder3/subfolder1/fixture.php | 3 + .../fixtures/folder3/subfolder2/fixture.php | 3 + .../fixtures/folder3/subfolder3/fixture.php | 3 + .../fixtures/folder3/subfolder4/fixture.php | 3 + Zend/tests/constants/fixtures/folder4/fixture.php | 3 + .../fixtures/folder4/subfolder1/fixture.php | 3 + .../fixtures/folder4/subfolder2/fixture.php | 3 + .../fixtures/folder4/subfolder3/fixture.php | 3 + .../fixtures/folder4/subfolder4/fixture.php | 3 + Zend/tests/constants_001.phpt | 25 + Zend/tests/constants_002.phpt | 24 + Zend/tests/constants_003.phpt | 21 + Zend/tests/constants_004.phpt | 13 + Zend/tests/constants_005.phpt | 11 + Zend/tests/constants_006.phpt | 32 + Zend/tests/constants_007.phpt | 22 + Zend/tests/constants_008.phpt | 17 + Zend/tests/constants_009.phpt | 25 + Zend/tests/constructor_args.phpt | 20 + Zend/tests/dynamic_call_001.phpt | 17 + Zend/tests/dynamic_call_002.phpt | 12 + Zend/tests/dynamic_call_003.phpt | 13 + Zend/tests/dynamic_call_004.phpt | 12 + Zend/tests/each_001.phpt | 10 + Zend/tests/each_002.phpt | 30 + Zend/tests/each_003.phpt | 37 + Zend/tests/errmsg_024.phpt | 4 +- Zend/tests/errmsg_044.phpt | 11 + Zend/tests/error_reporting01.phpt | 2 +- Zend/tests/error_reporting02.phpt | 2 +- Zend/tests/error_reporting03.phpt | 2 +- Zend/tests/error_reporting04.phpt | 2 +- Zend/tests/error_reporting05.phpt | 2 +- Zend/tests/error_reporting06.phpt | 2 +- Zend/tests/error_reporting07.phpt | 2 +- Zend/tests/error_reporting08.phpt | 2 +- Zend/tests/error_reporting09.phpt | 2 +- Zend/tests/error_reporting10.phpt | 4 +- Zend/tests/exception_001.phpt | 38 + Zend/tests/exception_002.phpt | 19 + Zend/tests/exception_003.phpt | 14 + Zend/tests/exception_004.phpt | 18 + Zend/tests/exception_005.phpt | 12 + Zend/tests/exception_006.phpt | 10 + Zend/tests/exception_007.phpt | 36 + Zend/tests/exception_008.phpt | 36 + Zend/tests/exception_handler_004.phpt | 4 +- Zend/tests/float_prec_001.phpt | 10 + Zend/tests/foreach_002.phpt | 23 + Zend/tests/foreach_unset_globals.phpt | 21 + Zend/tests/gc_001.phpt | 12 + Zend/tests/gc_002.phpt | 16 + Zend/tests/gc_003.phpt | 16 + Zend/tests/gc_004.phpt | 24 + Zend/tests/gc_005.phpt | 21 + Zend/tests/gc_006.phpt | 28 + Zend/tests/gc_007.phpt | 26 + Zend/tests/gc_008.phpt | 24 + Zend/tests/gc_009.phpt | 31 + Zend/tests/gc_010.phpt | 25 + Zend/tests/gc_011.phpt | 28 + Zend/tests/gc_012.phpt | 17 + Zend/tests/gc_013.phpt | 16 + Zend/tests/gc_014.phpt | 18 + Zend/tests/gc_015.phpt | 18 + Zend/tests/gc_016.phpt | 24 + Zend/tests/gc_017.phpt | 41 + Zend/tests/gc_018.phpt | 13 + Zend/tests/gc_019.phpt | 14 + Zend/tests/gc_020.phpt | 15 + Zend/tests/gc_021.phpt | 16 + Zend/tests/gc_022.phpt | 15 + Zend/tests/gc_023.phpt | 27 + Zend/tests/gc_024.phpt | 15 + Zend/tests/gc_025.phpt | 11 + Zend/tests/gc_026.phpt | 14 + Zend/tests/gc_027.phpt | 12 + Zend/tests/gc_028.phpt | 31 + Zend/tests/gc_029.phpt | 33 + Zend/tests/gc_030.phpt | 31 + Zend/tests/gc_031.phpt | 11 + Zend/tests/get_called_class_001.phpt | 11 + Zend/tests/get_parent_class_001.phpt | 31 + Zend/tests/globals_001.phpt | 2 +- Zend/tests/globals_002.phpt | 2 +- Zend/tests/globals_003.phpt | 2 +- Zend/tests/globals_004.phpt | 2 +- Zend/tests/halt01.phpt | 24 +- Zend/tests/halt02.phpt | 26 +- Zend/tests/halt03.phpt | 20 +- Zend/tests/heredoc_001.phpt | 23 + Zend/tests/heredoc_002.phpt | 23 + Zend/tests/heredoc_003.phpt | 23 + Zend/tests/heredoc_004.phpt | 23 + Zend/tests/heredoc_005.phpt | 22 + Zend/tests/heredoc_006.phpt | 23 + Zend/tests/heredoc_007.phpt | 23 + Zend/tests/heredoc_008.phpt | 17 + Zend/tests/heredoc_009.phpt | 42 + Zend/tests/heredoc_010.phpt | 32 + Zend/tests/heredoc_011.phpt | 20 + Zend/tests/heredoc_012.phpt | 12 + Zend/tests/heredoc_013.phpt | 12 + Zend/tests/heredoc_014.phpt | 12 + Zend/tests/heredoc_015.phpt | 41 + Zend/tests/heredoc_016.phpt | 42 + Zend/tests/heredoc_017.phpt | 17 + Zend/tests/heredoc_018.phpt | 17 + Zend/tests/instanceof.phpt | 36 +- Zend/tests/instanceof_001.phpt | 29 + Zend/tests/instanceof_002.phpt | 33 + Zend/tests/int_overflow_64bit.phpt | 18 +- Zend/tests/inter_007.phpt | 20 + Zend/tests/inter_01.phpt | 18 + Zend/tests/inter_02.phpt | 21 + Zend/tests/inter_03.phpt | 19 + Zend/tests/inter_04.phpt | 19 + Zend/tests/inter_05.phpt | 10 + Zend/tests/inter_06.phpt | 10 + Zend/tests/interface_exists_001.phpt | 21 + Zend/tests/interface_exists_002.phpt | 23 + Zend/tests/is_a.phpt | 93 +- Zend/tests/jump01.phpt | 14 + Zend/tests/jump02.phpt | 16 + Zend/tests/jump03.phpt | 18 + Zend/tests/jump04.phpt | 24 + Zend/tests/jump05.phpt | 26 + Zend/tests/jump06.phpt | 8 + Zend/tests/jump07.phpt | 11 + Zend/tests/jump08.phpt | 11 + Zend/tests/jump09.phpt | 13 + Zend/tests/jump10.phpt | 13 + Zend/tests/jump11.phpt | 26 + Zend/tests/jump12.phpt | 20 + Zend/tests/jump13.phpt | 25 + Zend/tests/jump14.phpt | 28 + Zend/tests/list_001.phpt | 14 + Zend/tests/list_002.phpt | 20 + Zend/tests/list_003.phpt | 24 + Zend/tests/list_004.phpt | 21 + Zend/tests/list_005.phpt | 47 + Zend/tests/list_006.phpt | 14 + Zend/tests/list_007.phpt | 13 + Zend/tests/lsb_001.phpt | 61 + Zend/tests/lsb_002.phpt | 66 + Zend/tests/lsb_003.phpt | 24 + Zend/tests/lsb_004.phpt | 21 + Zend/tests/lsb_005.phpt | 51 + Zend/tests/lsb_006.phpt | 13 + Zend/tests/lsb_007.phpt | 13 + Zend/tests/lsb_008.phpt | 9 + Zend/tests/lsb_009.phpt | 9 + Zend/tests/lsb_010.phpt | 38 + Zend/tests/lsb_011.phpt | 23 + Zend/tests/lsb_012.phpt | 23 + Zend/tests/lsb_013.phpt | 24 + Zend/tests/lsb_014.phpt | 24 + Zend/tests/lsb_015.phpt | 92 + Zend/tests/lsb_016.phpt | 41 + Zend/tests/lsb_017.phpt | 29 + Zend/tests/lsb_018.phpt | 95 + Zend/tests/lsb_019.phpt | 48 + Zend/tests/lsb_020.phpt | 48 + Zend/tests/lsb_021.phpt | 50 + Zend/tests/lsb_022.phpt | 31 + Zend/tests/magic_methods_001.phpt | 49 + Zend/tests/magic_methods_002.phpt | 14 + Zend/tests/magic_methods_003.phpt | 14 + Zend/tests/magic_methods_004.phpt | 14 + Zend/tests/magic_methods_005.phpt | 12 + Zend/tests/magic_methods_006.phpt | 12 + Zend/tests/magic_methods_007.phpt | 14 + Zend/tests/magic_methods_008.phpt | 19 + Zend/tests/magic_methods_009.phpt | 13 + Zend/tests/magic_methods_010.phpt | 15 + Zend/tests/multibyte/multibyte_encoding_004.phpt | 25 + Zend/tests/multibyte/multibyte_encoding_005.phpt | 26 + Zend/tests/nowdoc.inc | 11 + Zend/tests/nowdoc_001.phpt | 24 + Zend/tests/nowdoc_002.phpt | 23 + Zend/tests/nowdoc_003.phpt | 23 + Zend/tests/nowdoc_004.phpt | 23 + Zend/tests/nowdoc_005.phpt | 23 + Zend/tests/nowdoc_006.phpt | 23 + Zend/tests/nowdoc_007.phpt | 23 + Zend/tests/nowdoc_008.phpt | 17 + Zend/tests/nowdoc_009.phpt | 40 + Zend/tests/nowdoc_010.phpt | 33 + Zend/tests/nowdoc_011.phpt | 20 + Zend/tests/nowdoc_012.phpt | 25 + Zend/tests/nowdoc_013.phpt | 26 + Zend/tests/nowdoc_014.phpt | 25 + Zend/tests/nowdoc_015.phpt | 74 + Zend/tests/nowdoc_016.phpt | 41 + Zend/tests/nowdoc_017.phpt | 16 + Zend/tests/ns_001.phpt | 34 + Zend/tests/ns_002.phpt | 27 + Zend/tests/ns_003.phpt | 12 + Zend/tests/ns_004.phpt | 9 + Zend/tests/ns_005.phpt | 12 + Zend/tests/ns_006.phpt | 13 + Zend/tests/ns_007.phpt | 13 + Zend/tests/ns_008.phpt | 13 + Zend/tests/ns_009.phpt | 11 + Zend/tests/ns_010.phpt | 41 + Zend/tests/ns_011.phpt | 24 + Zend/tests/ns_012.phpt | 35 + Zend/tests/ns_013.phpt | 13 + Zend/tests/ns_014.phpt | 9 + Zend/tests/ns_015.phpt | 14 + Zend/tests/ns_016.phpt | 14 + Zend/tests/ns_017.phpt | 14 + Zend/tests/ns_018.phpt | 14 + Zend/tests/ns_019.phpt | 12 + Zend/tests/ns_020.phpt | 18 + Zend/tests/ns_021.phpt | 23 + Zend/tests/ns_022.inc | 6 + Zend/tests/ns_022.phpt | 19 + Zend/tests/ns_023.phpt | 11 + Zend/tests/ns_024.phpt | 9 + Zend/tests/ns_025.phpt | 24 + Zend/tests/ns_026.phpt | 33 + Zend/tests/ns_027.inc | 11 + Zend/tests/ns_027.phpt | 24 + Zend/tests/ns_028.inc | 15 + Zend/tests/ns_028.phpt | 26 + Zend/tests/ns_029.phpt | 12 + Zend/tests/ns_030.phpt | 12 + Zend/tests/ns_031.phpt | 21 + Zend/tests/ns_032.phpt | 19 + Zend/tests/ns_033.phpt | 8 + Zend/tests/ns_034.phpt | 31 + Zend/tests/ns_035.phpt | 26 + Zend/tests/ns_036.phpt | 41 + Zend/tests/ns_037.phpt | 41 + Zend/tests/ns_038.phpt | 15 + Zend/tests/ns_039.phpt | 25 + Zend/tests/ns_040.phpt | 59 + Zend/tests/ns_041.phpt | 22 + Zend/tests/ns_042.phpt | 22 + Zend/tests/ns_043.phpt | 11 + Zend/tests/ns_044.phpt | 9 + Zend/tests/ns_045.phpt | 11 + Zend/tests/ns_046.phpt | 11 + Zend/tests/ns_047.phpt | 11 + Zend/tests/ns_048.phpt | 11 + Zend/tests/ns_049.phpt | 9 + Zend/tests/ns_050.phpt | 14 + Zend/tests/ns_051.phpt | 12 + Zend/tests/ns_052.phpt | 14 + Zend/tests/ns_053.phpt | 13 + Zend/tests/ns_054.phpt | 31 + Zend/tests/ns_055.phpt | 28 + Zend/tests/ns_056.phpt | 32 + Zend/tests/ns_057.phpt | 59 + Zend/tests/ns_058.phpt | 57 + Zend/tests/ns_059.phpt | 8 + Zend/tests/ns_060.phpt | 23 + Zend/tests/ns_061.phpt | 9 + Zend/tests/ns_062.phpt | 12 + Zend/tests/ns_063.phpt | 13 + Zend/tests/ns_064.phpt | 40 + Zend/tests/ns_065.inc | 9 + Zend/tests/ns_065.phpt | 13 + Zend/tests/ns_066.phpt | 10 + Zend/tests/ns_067.inc | 3 + Zend/tests/ns_067.phpt | 9 + Zend/tests/ns_068.phpt | 14 + Zend/tests/ns_069.inc | 3 + Zend/tests/ns_069.phpt | 24 + Zend/tests/ns_070.phpt | 21 + Zend/tests/ns_071.phpt | 21 + Zend/tests/ns_072.phpt | 33 + Zend/tests/ns_073.phpt | 19 + Zend/tests/ns_074.phpt | 24 + Zend/tests/ns_075.phpt | 10 + Zend/tests/ns_076.phpt | 25 + Zend/tests/ns_077_1.phpt | 13 + Zend/tests/ns_077_2.phpt | 13 + Zend/tests/ns_077_3.phpt | 13 + Zend/tests/ns_077_4.phpt | 13 + Zend/tests/ns_077_5.phpt | 12 + Zend/tests/ns_077_6.phpt | 12 + Zend/tests/ns_077_7.phpt | 12 + Zend/tests/ns_077_8.phpt | 12 + Zend/tests/ns_078.phpt | 33 + Zend/tests/ns_079.phpt | 12 + Zend/tests/ns_080.phpt | 15 + Zend/tests/ns_081.phpt | 23 + Zend/tests/ns_082.phpt | 12 + Zend/tests/ns_083.phpt | 14 + Zend/tests/ns_084.phpt | 23 + Zend/tests/ns_085.phpt | 27 + Zend/tests/ns_086.phpt | 28 + Zend/tests/ns_087.phpt | 24 + Zend/tests/object_handlers.phpt | 348 +- Zend/tests/objects_017.phpt | 18 + Zend/tests/objects_018.phpt | 19 + Zend/tests/objects_019.phpt | 32 + Zend/tests/objects_020.phpt | 33 + Zend/tests/objects_021.phpt | 39 + Zend/tests/objects_022.phpt | 39 + Zend/tests/objects_023.phpt | 15 + Zend/tests/objects_024.phpt | 53 + Zend/tests/objects_025.phpt | 46 + Zend/tests/objects_026.phpt | 13 + Zend/tests/objects_027.phpt | 44 + Zend/tests/objects_028.phpt | 25 + Zend/tests/objects_029.phpt | 26 + Zend/tests/objects_030.phpt | 26 + Zend/tests/objects_031.phpt | 28 + Zend/tests/offset_array.phpt | 4 +- Zend/tests/property_exists.phpt | 57 + Zend/tests/selfParent_001.phpt | 54 +- Zend/tests/selfParent_002.phpt | 52 +- Zend/tests/unset_cv01.phpt | 26 +- Zend/tests/unset_cv02.phpt | 26 +- Zend/tests/unset_cv03.phpt | 26 +- Zend/tests/unset_cv04.phpt | 32 +- Zend/tests/unset_cv05.phpt | 56 +- Zend/tests/unset_cv06.phpt | 54 +- Zend/tests/unset_cv08.phpt | 30 +- Zend/tests/unset_cv09.phpt | 28 +- Zend/tests/unset_cv10.phpt | 36 +- Zend/tests/unset_cv11.phpt | 42 +- Zend/tests/unset_cv12.phpt | 22 +- Zend/zend.c | 635 +- Zend/zend.h | 262 +- Zend/zend_API.c | 1622 +- Zend/zend_API.h | 324 +- Zend/zend_alloc.c | 101 +- Zend/zend_alloc.h | 10 +- Zend/zend_arg_defs.c | 52 - Zend/zend_build.h | 46 + Zend/zend_builtin_functions.c | 1066 +- Zend/zend_builtin_functions.h | 2 +- Zend/zend_closures.c | 377 + Zend/zend_closures.h | 47 + Zend/zend_compile.c | 1914 +- Zend/zend_compile.h | 297 +- Zend/zend_config.nw.h | 2 +- Zend/zend_config.w32.h | 4 +- Zend/zend_constants.c | 247 +- Zend/zend_constants.h | 19 +- Zend/zend_default_classes.c | 4 +- Zend/zend_dynamic_array.c | 2 +- Zend/zend_dynamic_array.h | 2 +- Zend/zend_errors.h | 6 +- Zend/zend_exceptions.c | 219 +- Zend/zend_exceptions.h | 10 +- Zend/zend_execute.c | 1193 +- Zend/zend_execute.h | 177 +- Zend/zend_execute_API.c | 1084 +- Zend/zend_extensions.c | 23 +- Zend/zend_extensions.h | 18 +- Zend/zend_fast_cache.h | 2 +- Zend/zend_float.c | 64 + Zend/zend_float.h | 422 + Zend/zend_gc.c | 612 + Zend/zend_gc.h | 245 + Zend/zend_globals.h | 99 +- Zend/zend_globals_macros.h | 13 +- Zend/zend_hash.c | 124 +- Zend/zend_hash.h | 174 +- Zend/zend_highlight.c | 27 +- Zend/zend_highlight.h | 2 +- Zend/zend_indent.c | 2 +- Zend/zend_indent.h | 2 +- Zend/zend_ini.c | 69 +- Zend/zend_ini.h | 30 +- Zend/zend_ini_parser.c | 404 +- Zend/zend_ini_parser.h | 42 +- Zend/zend_ini_parser.output | 750 +- Zend/zend_ini_parser.y | 205 +- Zend/zend_ini_scanner.c | 6150 ++-- Zend/zend_ini_scanner.h | 12 +- Zend/zend_ini_scanner.l | 534 +- Zend/zend_ini_scanner_defs.h | 13 + Zend/zend_interfaces.c | 58 +- Zend/zend_interfaces.h | 8 +- Zend/zend_istdiostream.h | 2 +- Zend/zend_iterators.c | 2 +- Zend/zend_iterators.h | 2 +- Zend/zend_language_parser.c | 4242 +-- Zend/zend_language_parser.h | 182 +- Zend/zend_language_parser.output | 27943 ++++++++++--------- Zend/zend_language_parser.y | 222 +- Zend/zend_language_scanner.c | 13292 +++++---- Zend/zend_language_scanner.h | 22 +- Zend/zend_language_scanner.l | 837 +- Zend/zend_language_scanner_defs.h | 17 + Zend/zend_list.c | 2 +- Zend/zend_list.h | 2 +- Zend/zend_llist.c | 2 +- Zend/zend_llist.h | 2 +- Zend/zend_modules.h | 37 +- Zend/zend_multibyte.c | 299 +- Zend/zend_multibyte.h | 26 +- Zend/zend_multiply.h | 15 +- Zend/zend_object_handlers.c | 364 +- Zend/zend_object_handlers.h | 15 +- Zend/zend_objects.c | 61 +- Zend/zend_objects.h | 4 +- Zend/zend_objects_API.c | 33 +- Zend/zend_objects_API.h | 11 +- Zend/zend_opcode.c | 69 +- Zend/zend_operators.c | 1386 +- Zend/zend_operators.h | 75 +- Zend/zend_ptr_stack.c | 16 +- Zend/zend_ptr_stack.h | 6 +- Zend/zend_qsort.c | 2 +- Zend/zend_qsort.h | 2 +- Zend/zend_sprintf.c | 2 +- Zend/zend_stack.c | 25 +- Zend/zend_stack.h | 14 +- Zend/zend_static_allocator.c | 2 +- Zend/zend_static_allocator.h | 2 +- Zend/zend_stream.c | 333 +- Zend/zend_stream.h | 65 +- Zend/zend_strtod.c | 4 +- Zend/zend_strtod.h | 2 +- Zend/zend_ts_hash.c | 13 +- Zend/zend_ts_hash.h | 5 +- Zend/zend_types.h | 16 +- Zend/zend_variables.c | 10 +- Zend/zend_variables.h | 14 +- Zend/zend_vm.h | 2 +- Zend/zend_vm_def.h | 1736 +- Zend/zend_vm_execute.h | 12492 +++++---- Zend/zend_vm_execute.skl | 52 +- Zend/zend_vm_gen.php | 92 +- Zend/zend_vm_opcodes.h | 264 +- 771 files changed, 65734 insertions(+), 39083 deletions(-) delete mode 100644 Zend/FlexLexer.h delete mode 100644 Zend/flex.skl create mode 100644 Zend/tests/021.phpt create mode 100644 Zend/tests/022.phpt create mode 100644 Zend/tests/023.phpt create mode 100644 Zend/tests/024.phpt create mode 100644 Zend/tests/025.phpt create mode 100644 Zend/tests/026.phpt create mode 100644 Zend/tests/027.phpt create mode 100644 Zend/tests/028.phpt create mode 100644 Zend/tests/029.phpt create mode 100644 Zend/tests/030.phpt create mode 100644 Zend/tests/031.phpt create mode 100644 Zend/tests/032.phpt create mode 100644 Zend/tests/033.phpt create mode 100644 Zend/tests/034.phpt create mode 100644 Zend/tests/035.phpt create mode 100644 Zend/tests/036.phpt create mode 100644 Zend/tests/037.phpt create mode 100644 Zend/tests/038.phpt create mode 100644 Zend/tests/access_modifiers_001.phpt create mode 100644 Zend/tests/access_modifiers_002.phpt create mode 100644 Zend/tests/access_modifiers_003.phpt create mode 100644 Zend/tests/access_modifiers_004.phpt create mode 100644 Zend/tests/access_modifiers_005.phpt create mode 100644 Zend/tests/access_modifiers_006.phpt create mode 100644 Zend/tests/access_modifiers_007.phpt create mode 100644 Zend/tests/access_modifiers_008.phpt create mode 100644 Zend/tests/access_modifiers_009.phpt create mode 100644 Zend/tests/access_modifiers_010.phpt create mode 100644 Zend/tests/anonymous_func_001.phpt create mode 100644 Zend/tests/anonymous_func_002.phpt create mode 100644 Zend/tests/anonymous_func_003.phpt create mode 100644 Zend/tests/assign_to_var_001.phpt create mode 100644 Zend/tests/assign_to_var_002.phpt create mode 100644 Zend/tests/assign_to_var_003.phpt create mode 100644 Zend/tests/assign_to_var_004.phpt delete mode 100644 Zend/tests/bug30332.phpt delete mode 100644 Zend/tests/bug31828.phpt delete mode 100644 Zend/tests/bug32080.phpt delete mode 100644 Zend/tests/bug32852.phpt delete mode 100755 Zend/tests/bug33243.phpt delete mode 100755 Zend/tests/bug34712.phpt delete mode 100755 Zend/tests/bug34767.phpt create mode 100755 Zend/tests/bug35163.phpt create mode 100755 Zend/tests/bug35163_2.phpt create mode 100755 Zend/tests/bug35163_3.phpt create mode 100644 Zend/tests/bug37251.phpt create mode 100644 Zend/tests/bug39018.phpt create mode 100644 Zend/tests/bug39018_2.phpt create mode 100644 Zend/tests/bug39127.phpt create mode 100644 Zend/tests/bug39346.phpt delete mode 100755 Zend/tests/bug42119.phpt create mode 100644 Zend/tests/bug42798.phpt create mode 100755 Zend/tests/bug42802.phpt create mode 100755 Zend/tests/bug42819.phpt create mode 100755 Zend/tests/bug42820.phpt create mode 100755 Zend/tests/bug42859.phpt create mode 100755 Zend/tests/bug43027.phpt create mode 100755 Zend/tests/bug43183.phpt create mode 100644 Zend/tests/bug43323.phpt create mode 100644 Zend/tests/bug43332_1.phpt create mode 100644 Zend/tests/bug43332_2.phpt create mode 100644 Zend/tests/bug43343.phpt create mode 100644 Zend/tests/bug43344_1.phpt create mode 100644 Zend/tests/bug43344_10.phpt create mode 100644 Zend/tests/bug43344_11.phpt create mode 100644 Zend/tests/bug43344_12.phpt create mode 100644 Zend/tests/bug43344_13.phpt create mode 100644 Zend/tests/bug43344_2.phpt create mode 100644 Zend/tests/bug43344_3.phpt create mode 100644 Zend/tests/bug43344_4.phpt create mode 100644 Zend/tests/bug43344_5.phpt create mode 100644 Zend/tests/bug43344_6.phpt create mode 100644 Zend/tests/bug43344_7.phpt create mode 100644 Zend/tests/bug43344_8.phpt create mode 100644 Zend/tests/bug43344_9.phpt create mode 100644 Zend/tests/bug43426.phpt create mode 100644 Zend/tests/bug43651.phpt create mode 100644 Zend/tests/bug43851.phpt create mode 100644 Zend/tests/bug43918.phpt create mode 100644 Zend/tests/bug44414.phpt create mode 100644 Zend/tests/bug44653.phpt create mode 100755 Zend/tests/bug44660.phpt create mode 100644 Zend/tests/bug44899.phpt create mode 100644 Zend/tests/bug44899_2.phpt create mode 100644 Zend/tests/bug44913.phpt create mode 100644 Zend/tests/bug45147.phpt create mode 100644 Zend/tests/bug45180.phpt create mode 100644 Zend/tests/bug45186.phpt create mode 100644 Zend/tests/bug45186_2.phpt create mode 100644 Zend/tests/bug45742.phpt create mode 100644 Zend/tests/bug45744.phpt create mode 100644 Zend/tests/bug45877.phpt create mode 100644 Zend/tests/bug45910.phpt create mode 100644 Zend/tests/bug45910_2.phpt create mode 100644 Zend/tests/bug46106.phpt create mode 100644 Zend/tests/bug46196.phpt create mode 100644 Zend/tests/bug46238.phpt create mode 100644 Zend/tests/bug46241.phpt create mode 100755 Zend/tests/bug46304.phpt create mode 100644 Zend/tests/bug46409.phpt create mode 100644 Zend/tests/bug46665.phpt create mode 100644 Zend/tests/bug46665_autoload.inc create mode 100644 Zend/tests/bug46811.phpt create mode 100644 Zend/tests/bug46813.phpt create mode 100644 Zend/tests/bug47054.phpt create mode 100644 Zend/tests/bug47320.phpt create mode 100644 Zend/tests/bug47343.phpt create mode 100644 Zend/tests/bug47572.phpt create mode 100644 Zend/tests/bug47593.phpt create mode 100644 Zend/tests/bug47704.phpt create mode 100755 Zend/tests/call_static.phpt create mode 100644 Zend/tests/call_static_002.phpt create mode 100644 Zend/tests/call_static_003.phpt create mode 100644 Zend/tests/call_static_004.phpt create mode 100644 Zend/tests/call_static_005.phpt create mode 100644 Zend/tests/call_static_006.phpt create mode 100644 Zend/tests/call_static_007.phpt create mode 100644 Zend/tests/class_alias_001.phpt create mode 100644 Zend/tests/class_alias_002.phpt create mode 100644 Zend/tests/class_alias_003.phpt create mode 100644 Zend/tests/class_alias_004.phpt create mode 100644 Zend/tests/class_alias_005.phpt create mode 100644 Zend/tests/class_alias_006.phpt create mode 100644 Zend/tests/class_alias_007.phpt create mode 100644 Zend/tests/class_alias_008.phpt create mode 100644 Zend/tests/class_alias_009.phpt create mode 100644 Zend/tests/class_alias_010.phpt create mode 100644 Zend/tests/class_alias_011.phpt create mode 100644 Zend/tests/class_alias_012.phpt create mode 100644 Zend/tests/class_alias_013.phpt create mode 100644 Zend/tests/class_alias_014.phpt create mode 100644 Zend/tests/class_alias_015.phpt create mode 100644 Zend/tests/class_alias_016.phpt create mode 100644 Zend/tests/class_alias_017.phpt create mode 100644 Zend/tests/class_alias_018.phpt create mode 100644 Zend/tests/class_alias_019.phpt create mode 100644 Zend/tests/class_alias_020.phpt create mode 100644 Zend/tests/class_alias_021.phpt create mode 100644 Zend/tests/class_constants_004.phpt create mode 100644 Zend/tests/class_exists_001.phpt create mode 100644 Zend/tests/class_exists_002.phpt create mode 100644 Zend/tests/class_exists_003.phpt create mode 100644 Zend/tests/clone_001.phpt create mode 100644 Zend/tests/clone_002.phpt create mode 100644 Zend/tests/clone_003.phpt create mode 100644 Zend/tests/clone_004.phpt delete mode 100644 Zend/tests/clone_uncloneable.phpt create mode 100644 Zend/tests/closure_001.phpt create mode 100644 Zend/tests/closure_002.phpt create mode 100644 Zend/tests/closure_003.phpt create mode 100644 Zend/tests/closure_004.phpt create mode 100644 Zend/tests/closure_006.phpt create mode 100644 Zend/tests/closure_008.phpt create mode 100644 Zend/tests/closure_009.phpt create mode 100644 Zend/tests/closure_010.phpt create mode 100644 Zend/tests/closure_011.phpt create mode 100644 Zend/tests/closure_012.phpt create mode 100644 Zend/tests/closure_013.phpt create mode 100644 Zend/tests/closure_014.phpt create mode 100644 Zend/tests/closure_015.phpt create mode 100755 Zend/tests/closure_016.phpt create mode 100644 Zend/tests/closure_017.phpt create mode 100644 Zend/tests/closure_018.phpt create mode 100644 Zend/tests/closure_019.phpt create mode 100644 Zend/tests/closure_020.phpt create mode 100644 Zend/tests/closure_021.phpt create mode 100755 Zend/tests/closure_022.phpt create mode 100755 Zend/tests/closure_023.phpt create mode 100644 Zend/tests/closure_024.phpt create mode 100644 Zend/tests/closure_025.phpt create mode 100644 Zend/tests/closure_026.phpt create mode 100644 Zend/tests/closure_027.phpt create mode 100644 Zend/tests/closure_028.phpt create mode 100644 Zend/tests/closure_029.phpt create mode 100644 Zend/tests/closure_030.phpt create mode 100644 Zend/tests/closure_031.phpt create mode 100644 Zend/tests/closure_032.phpt create mode 100755 Zend/tests/closure_033.phpt create mode 100755 Zend/tests/constants/dir-constant-eval.phpt create mode 100755 Zend/tests/constants/dir-constant-includes.phpt create mode 100755 Zend/tests/constants/dir-constant-nested_includes.phpt create mode 100755 Zend/tests/constants/dir-constant-normal.phpt create mode 100755 Zend/tests/constants/fixtures/folder1/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder1/subfolder1/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder1/subfolder2/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder1/subfolder3/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder1/subfolder4/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder2/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder2/subfolder1/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder2/subfolder2/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder2/subfolder3/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder2/subfolder4/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder3/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder3/subfolder1/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder3/subfolder2/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder3/subfolder3/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder3/subfolder4/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder4/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder4/subfolder1/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder4/subfolder2/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder4/subfolder3/fixture.php create mode 100755 Zend/tests/constants/fixtures/folder4/subfolder4/fixture.php create mode 100644 Zend/tests/constants_001.phpt create mode 100644 Zend/tests/constants_002.phpt create mode 100644 Zend/tests/constants_003.phpt create mode 100644 Zend/tests/constants_004.phpt create mode 100755 Zend/tests/constants_005.phpt create mode 100644 Zend/tests/constants_006.phpt create mode 100644 Zend/tests/constants_007.phpt create mode 100644 Zend/tests/constants_008.phpt create mode 100644 Zend/tests/constants_009.phpt create mode 100644 Zend/tests/constructor_args.phpt create mode 100644 Zend/tests/dynamic_call_001.phpt create mode 100644 Zend/tests/dynamic_call_002.phpt create mode 100644 Zend/tests/dynamic_call_003.phpt create mode 100644 Zend/tests/dynamic_call_004.phpt create mode 100644 Zend/tests/each_001.phpt create mode 100644 Zend/tests/each_002.phpt create mode 100644 Zend/tests/each_003.phpt create mode 100644 Zend/tests/errmsg_044.phpt create mode 100644 Zend/tests/exception_001.phpt create mode 100644 Zend/tests/exception_002.phpt create mode 100644 Zend/tests/exception_003.phpt create mode 100644 Zend/tests/exception_004.phpt create mode 100644 Zend/tests/exception_005.phpt create mode 100644 Zend/tests/exception_006.phpt create mode 100755 Zend/tests/exception_007.phpt create mode 100755 Zend/tests/exception_008.phpt create mode 100644 Zend/tests/float_prec_001.phpt create mode 100644 Zend/tests/foreach_002.phpt create mode 100644 Zend/tests/foreach_unset_globals.phpt create mode 100644 Zend/tests/gc_001.phpt create mode 100644 Zend/tests/gc_002.phpt create mode 100644 Zend/tests/gc_003.phpt create mode 100644 Zend/tests/gc_004.phpt create mode 100644 Zend/tests/gc_005.phpt create mode 100644 Zend/tests/gc_006.phpt create mode 100644 Zend/tests/gc_007.phpt create mode 100644 Zend/tests/gc_008.phpt create mode 100644 Zend/tests/gc_009.phpt create mode 100644 Zend/tests/gc_010.phpt create mode 100644 Zend/tests/gc_011.phpt create mode 100644 Zend/tests/gc_012.phpt create mode 100644 Zend/tests/gc_013.phpt create mode 100644 Zend/tests/gc_014.phpt create mode 100644 Zend/tests/gc_015.phpt create mode 100644 Zend/tests/gc_016.phpt create mode 100644 Zend/tests/gc_017.phpt create mode 100644 Zend/tests/gc_018.phpt create mode 100644 Zend/tests/gc_019.phpt create mode 100644 Zend/tests/gc_020.phpt create mode 100644 Zend/tests/gc_021.phpt create mode 100644 Zend/tests/gc_022.phpt create mode 100644 Zend/tests/gc_023.phpt create mode 100644 Zend/tests/gc_024.phpt create mode 100644 Zend/tests/gc_025.phpt create mode 100644 Zend/tests/gc_026.phpt create mode 100644 Zend/tests/gc_027.phpt create mode 100644 Zend/tests/gc_028.phpt create mode 100644 Zend/tests/gc_029.phpt create mode 100644 Zend/tests/gc_030.phpt create mode 100644 Zend/tests/gc_031.phpt create mode 100644 Zend/tests/get_called_class_001.phpt create mode 100644 Zend/tests/get_parent_class_001.phpt create mode 100644 Zend/tests/heredoc_001.phpt create mode 100644 Zend/tests/heredoc_002.phpt create mode 100644 Zend/tests/heredoc_003.phpt create mode 100644 Zend/tests/heredoc_004.phpt create mode 100644 Zend/tests/heredoc_005.phpt create mode 100644 Zend/tests/heredoc_006.phpt create mode 100644 Zend/tests/heredoc_007.phpt create mode 100644 Zend/tests/heredoc_008.phpt create mode 100644 Zend/tests/heredoc_009.phpt create mode 100644 Zend/tests/heredoc_010.phpt create mode 100644 Zend/tests/heredoc_011.phpt create mode 100644 Zend/tests/heredoc_012.phpt create mode 100644 Zend/tests/heredoc_013.phpt create mode 100644 Zend/tests/heredoc_014.phpt create mode 100644 Zend/tests/heredoc_015.phpt create mode 100644 Zend/tests/heredoc_016.phpt create mode 100644 Zend/tests/heredoc_017.phpt create mode 100644 Zend/tests/heredoc_018.phpt create mode 100644 Zend/tests/instanceof_001.phpt create mode 100644 Zend/tests/instanceof_002.phpt create mode 100644 Zend/tests/inter_007.phpt create mode 100644 Zend/tests/inter_01.phpt create mode 100644 Zend/tests/inter_02.phpt create mode 100644 Zend/tests/inter_03.phpt create mode 100644 Zend/tests/inter_04.phpt create mode 100644 Zend/tests/inter_05.phpt create mode 100644 Zend/tests/inter_06.phpt create mode 100644 Zend/tests/interface_exists_001.phpt create mode 100644 Zend/tests/interface_exists_002.phpt create mode 100755 Zend/tests/jump01.phpt create mode 100755 Zend/tests/jump02.phpt create mode 100755 Zend/tests/jump03.phpt create mode 100755 Zend/tests/jump04.phpt create mode 100755 Zend/tests/jump05.phpt create mode 100755 Zend/tests/jump06.phpt create mode 100755 Zend/tests/jump07.phpt create mode 100755 Zend/tests/jump08.phpt create mode 100755 Zend/tests/jump09.phpt create mode 100755 Zend/tests/jump10.phpt create mode 100644 Zend/tests/jump11.phpt create mode 100644 Zend/tests/jump12.phpt create mode 100644 Zend/tests/jump13.phpt create mode 100644 Zend/tests/jump14.phpt create mode 100644 Zend/tests/list_001.phpt create mode 100644 Zend/tests/list_002.phpt create mode 100644 Zend/tests/list_003.phpt create mode 100644 Zend/tests/list_004.phpt create mode 100644 Zend/tests/list_005.phpt create mode 100644 Zend/tests/list_006.phpt create mode 100644 Zend/tests/list_007.phpt create mode 100644 Zend/tests/lsb_001.phpt create mode 100644 Zend/tests/lsb_002.phpt create mode 100644 Zend/tests/lsb_003.phpt create mode 100644 Zend/tests/lsb_004.phpt create mode 100644 Zend/tests/lsb_005.phpt create mode 100644 Zend/tests/lsb_006.phpt create mode 100644 Zend/tests/lsb_007.phpt create mode 100644 Zend/tests/lsb_008.phpt create mode 100644 Zend/tests/lsb_009.phpt create mode 100644 Zend/tests/lsb_010.phpt create mode 100644 Zend/tests/lsb_011.phpt create mode 100644 Zend/tests/lsb_012.phpt create mode 100644 Zend/tests/lsb_013.phpt create mode 100644 Zend/tests/lsb_014.phpt create mode 100644 Zend/tests/lsb_015.phpt create mode 100644 Zend/tests/lsb_016.phpt create mode 100644 Zend/tests/lsb_017.phpt create mode 100755 Zend/tests/lsb_018.phpt create mode 100644 Zend/tests/lsb_019.phpt create mode 100644 Zend/tests/lsb_020.phpt create mode 100644 Zend/tests/lsb_021.phpt create mode 100755 Zend/tests/lsb_022.phpt create mode 100644 Zend/tests/magic_methods_001.phpt create mode 100644 Zend/tests/magic_methods_002.phpt create mode 100644 Zend/tests/magic_methods_003.phpt create mode 100644 Zend/tests/magic_methods_004.phpt create mode 100644 Zend/tests/magic_methods_005.phpt create mode 100644 Zend/tests/magic_methods_006.phpt create mode 100644 Zend/tests/magic_methods_007.phpt create mode 100644 Zend/tests/magic_methods_008.phpt create mode 100644 Zend/tests/magic_methods_009.phpt create mode 100644 Zend/tests/magic_methods_010.phpt create mode 100644 Zend/tests/multibyte/multibyte_encoding_004.phpt create mode 100644 Zend/tests/multibyte/multibyte_encoding_005.phpt create mode 100644 Zend/tests/nowdoc.inc create mode 100644 Zend/tests/nowdoc_001.phpt create mode 100644 Zend/tests/nowdoc_002.phpt create mode 100644 Zend/tests/nowdoc_003.phpt create mode 100644 Zend/tests/nowdoc_004.phpt create mode 100644 Zend/tests/nowdoc_005.phpt create mode 100644 Zend/tests/nowdoc_006.phpt create mode 100644 Zend/tests/nowdoc_007.phpt create mode 100644 Zend/tests/nowdoc_008.phpt create mode 100644 Zend/tests/nowdoc_009.phpt create mode 100644 Zend/tests/nowdoc_010.phpt create mode 100644 Zend/tests/nowdoc_011.phpt create mode 100644 Zend/tests/nowdoc_012.phpt create mode 100644 Zend/tests/nowdoc_013.phpt create mode 100644 Zend/tests/nowdoc_014.phpt create mode 100644 Zend/tests/nowdoc_015.phpt create mode 100644 Zend/tests/nowdoc_016.phpt create mode 100644 Zend/tests/nowdoc_017.phpt create mode 100755 Zend/tests/ns_001.phpt create mode 100755 Zend/tests/ns_002.phpt create mode 100755 Zend/tests/ns_003.phpt create mode 100755 Zend/tests/ns_004.phpt create mode 100755 Zend/tests/ns_005.phpt create mode 100755 Zend/tests/ns_006.phpt create mode 100755 Zend/tests/ns_007.phpt create mode 100755 Zend/tests/ns_008.phpt create mode 100755 Zend/tests/ns_009.phpt create mode 100755 Zend/tests/ns_010.phpt create mode 100755 Zend/tests/ns_011.phpt create mode 100755 Zend/tests/ns_012.phpt create mode 100755 Zend/tests/ns_013.phpt create mode 100755 Zend/tests/ns_014.phpt create mode 100755 Zend/tests/ns_015.phpt create mode 100755 Zend/tests/ns_016.phpt create mode 100755 Zend/tests/ns_017.phpt create mode 100755 Zend/tests/ns_018.phpt create mode 100755 Zend/tests/ns_019.phpt create mode 100755 Zend/tests/ns_020.phpt create mode 100755 Zend/tests/ns_021.phpt create mode 100755 Zend/tests/ns_022.inc create mode 100755 Zend/tests/ns_022.phpt create mode 100755 Zend/tests/ns_023.phpt create mode 100755 Zend/tests/ns_024.phpt create mode 100755 Zend/tests/ns_025.phpt create mode 100755 Zend/tests/ns_026.phpt create mode 100755 Zend/tests/ns_027.inc create mode 100755 Zend/tests/ns_027.phpt create mode 100755 Zend/tests/ns_028.inc create mode 100755 Zend/tests/ns_028.phpt create mode 100755 Zend/tests/ns_029.phpt create mode 100755 Zend/tests/ns_030.phpt create mode 100755 Zend/tests/ns_031.phpt create mode 100755 Zend/tests/ns_032.phpt create mode 100755 Zend/tests/ns_033.phpt create mode 100755 Zend/tests/ns_034.phpt create mode 100755 Zend/tests/ns_035.phpt create mode 100755 Zend/tests/ns_036.phpt create mode 100755 Zend/tests/ns_037.phpt create mode 100755 Zend/tests/ns_038.phpt create mode 100644 Zend/tests/ns_039.phpt create mode 100644 Zend/tests/ns_040.phpt create mode 100644 Zend/tests/ns_041.phpt create mode 100644 Zend/tests/ns_042.phpt create mode 100644 Zend/tests/ns_043.phpt create mode 100644 Zend/tests/ns_044.phpt create mode 100644 Zend/tests/ns_045.phpt create mode 100644 Zend/tests/ns_046.phpt create mode 100644 Zend/tests/ns_047.phpt create mode 100644 Zend/tests/ns_048.phpt create mode 100644 Zend/tests/ns_049.phpt create mode 100644 Zend/tests/ns_050.phpt create mode 100644 Zend/tests/ns_051.phpt create mode 100644 Zend/tests/ns_052.phpt create mode 100644 Zend/tests/ns_053.phpt create mode 100755 Zend/tests/ns_054.phpt create mode 100755 Zend/tests/ns_055.phpt create mode 100755 Zend/tests/ns_056.phpt create mode 100755 Zend/tests/ns_057.phpt create mode 100755 Zend/tests/ns_058.phpt create mode 100755 Zend/tests/ns_059.phpt create mode 100644 Zend/tests/ns_060.phpt create mode 100644 Zend/tests/ns_061.phpt create mode 100644 Zend/tests/ns_062.phpt create mode 100644 Zend/tests/ns_063.phpt create mode 100644 Zend/tests/ns_064.phpt create mode 100755 Zend/tests/ns_065.inc create mode 100755 Zend/tests/ns_065.phpt create mode 100644 Zend/tests/ns_066.phpt create mode 100644 Zend/tests/ns_067.inc create mode 100644 Zend/tests/ns_067.phpt create mode 100644 Zend/tests/ns_068.phpt create mode 100644 Zend/tests/ns_069.inc create mode 100644 Zend/tests/ns_069.phpt create mode 100644 Zend/tests/ns_070.phpt create mode 100644 Zend/tests/ns_071.phpt create mode 100644 Zend/tests/ns_072.phpt create mode 100644 Zend/tests/ns_073.phpt create mode 100644 Zend/tests/ns_074.phpt create mode 100755 Zend/tests/ns_075.phpt create mode 100755 Zend/tests/ns_076.phpt create mode 100755 Zend/tests/ns_077_1.phpt create mode 100755 Zend/tests/ns_077_2.phpt create mode 100755 Zend/tests/ns_077_3.phpt create mode 100755 Zend/tests/ns_077_4.phpt create mode 100755 Zend/tests/ns_077_5.phpt create mode 100755 Zend/tests/ns_077_6.phpt create mode 100755 Zend/tests/ns_077_7.phpt create mode 100755 Zend/tests/ns_077_8.phpt create mode 100755 Zend/tests/ns_078.phpt create mode 100644 Zend/tests/ns_079.phpt create mode 100644 Zend/tests/ns_080.phpt create mode 100644 Zend/tests/ns_081.phpt create mode 100644 Zend/tests/ns_082.phpt create mode 100644 Zend/tests/ns_083.phpt create mode 100644 Zend/tests/ns_084.phpt create mode 100644 Zend/tests/ns_085.phpt create mode 100644 Zend/tests/ns_086.phpt create mode 100644 Zend/tests/ns_087.phpt create mode 100644 Zend/tests/objects_017.phpt create mode 100644 Zend/tests/objects_018.phpt create mode 100644 Zend/tests/objects_019.phpt create mode 100644 Zend/tests/objects_020.phpt create mode 100644 Zend/tests/objects_021.phpt create mode 100644 Zend/tests/objects_022.phpt create mode 100644 Zend/tests/objects_023.phpt create mode 100644 Zend/tests/objects_024.phpt create mode 100644 Zend/tests/objects_025.phpt create mode 100644 Zend/tests/objects_026.phpt create mode 100644 Zend/tests/objects_027.phpt create mode 100644 Zend/tests/objects_028.phpt create mode 100644 Zend/tests/objects_029.phpt create mode 100644 Zend/tests/objects_030.phpt create mode 100644 Zend/tests/objects_031.phpt create mode 100644 Zend/tests/property_exists.phpt delete mode 100644 Zend/zend_arg_defs.c create mode 100755 Zend/zend_build.h create mode 100644 Zend/zend_closures.c create mode 100644 Zend/zend_closures.h create mode 100644 Zend/zend_float.c create mode 100644 Zend/zend_float.h create mode 100644 Zend/zend_gc.c create mode 100644 Zend/zend_gc.h create mode 100644 Zend/zend_ini_scanner_defs.h create mode 100644 Zend/zend_language_scanner_defs.h (limited to 'Zend') diff --git a/Zend/FlexLexer.h b/Zend/FlexLexer.h deleted file mode 100644 index 614fdeda0..000000000 --- a/Zend/FlexLexer.h +++ /dev/null @@ -1,186 +0,0 @@ -// $Header: /repository/ZendEngine2/Attic/FlexLexer.h,v 1.4 2000/07/03 00:55:36 sascha Exp $ - -// FlexLexer.h -- define interfaces for lexical analyzer classes generated -// by flex - -// Copyright (c) 1993 The Regents of the University of California. -// All rights reserved. -// -// This code is derived from software contributed to Berkeley by -// Kent Williams and Tom Epperly. -// -// Redistribution and use in source and binary forms with or without -// modification are permitted provided that: (1) source distributions retain -// this entire copyright notice and comment, and (2) distributions including -// binaries display the following acknowledgement: ``This product includes -// software developed by the University of California, Berkeley and its -// contributors'' in the documentation or other materials provided with the -// distribution and in all advertising materials mentioning features or use -// of this software. Neither the name of the University 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -// This file defines FlexLexer, an abstract class which specifies the -// external interface provided to flex C++ lexer objects, and yyFlexLexer, -// which defines a particular lexer class. -// -// If you want to create multiple lexer classes, you use the -P flag -// to rename each yyFlexLexer to some other xxFlexLexer. You then -// include in your other sources once per lexer class: -// -// #undef yyFlexLexer -// #define yyFlexLexer xxFlexLexer -// #include -// -// #undef yyFlexLexer -// #define yyFlexLexer zzFlexLexer -// #include -// ... - -#ifndef FLEXLEXER_H -// Never included before - need to define base class. -#define FLEXLEXER_H -#include - -extern "C++" { - -struct yy_buffer_state; -typedef int yy_state_type; - -class FlexLexer { -public: - virtual ~FlexLexer() { } - - const char* YYText() { return yytext; } - int YYLeng() { return yyleng; } - - virtual void - yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; - virtual struct yy_buffer_state* - yy_create_buffer( istream* s, int size ) = 0; - virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; - virtual void yyrestart( istream* s ) = 0; - - virtual int yylex() = 0; - - // Call yylex with new input/output sources. - int yylex( istream* new_in, ostream* new_out = 0 ) - { - switch_streams( new_in, new_out ); - return yylex(); - } - - // Switch to new input/output streams. A nil stream pointer - // indicates "keep the current one". - virtual void switch_streams( istream* new_in = 0, - ostream* new_out = 0 ) = 0; - - int lineno() const { return yylineno; } - - int debug() const { return yy_flex_debug; } - void set_debug( int flag ) { yy_flex_debug = flag; } - -protected: - char* yytext; - int yyleng; - int yylineno; // only maintained if you use %option yylineno - int yy_flex_debug; // only has effect with -d or "%option debug" -}; - -} -#endif - -#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) -// Either this is the first time through (yyFlexLexerOnce not defined), -// or this is a repeated include to define a different flavor of -// yyFlexLexer, as discussed in the flex man page. -#define yyFlexLexerOnce - -class yyFlexLexer : public FlexLexer { -public: - // arg_yyin and arg_yyout default to the cin and cout, but we - // only make that assignment when initializing in yylex(). - yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 ); - - virtual ~yyFlexLexer(); - - void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); - struct yy_buffer_state* yy_create_buffer( istream* s, int size ); - void yy_delete_buffer( struct yy_buffer_state* b ); - void yyrestart( istream* s ); - - virtual int yylex(); - virtual void switch_streams( istream* new_in, ostream* new_out ); - -protected: - virtual int LexerInput( char* buf, int max_size ); - virtual void LexerOutput( const char* buf, int size ); - virtual void LexerError( const char* msg ); - - void yyunput( int c, char* buf_ptr ); - int yyinput(); - - void yy_load_buffer_state(); - void yy_init_buffer( struct yy_buffer_state* b, istream* s ); - void yy_flush_buffer( struct yy_buffer_state* b ); - - int yy_start_stack_ptr; - int yy_start_stack_depth; - int* yy_start_stack; - - void yy_push_state( int new_state ); - void yy_pop_state(); - int yy_top_state(); - - yy_state_type yy_get_previous_state(); - yy_state_type yy_try_NUL_trans( yy_state_type current_state ); - int yy_get_next_buffer(); - - istream* yyin; // input source for default LexerInput - ostream* yyout; // output sink for default LexerOutput - - struct yy_buffer_state* yy_current_buffer; - - // yy_hold_char holds the character lost when yytext is formed. - char yy_hold_char; - - // Number of characters read into yy_ch_buf. - int yy_n_chars; - - // Points to current character in buffer. - char* yy_c_buf_p; - - int yy_init; // whether we need to initialize - int yy_start; // start state number - - // Flag which is used to allow yywrap()'s to do buffer switches - // instead of setting up a fresh yyin. A bit of a hack ... - int yy_did_buffer_switch_on_eof; - - // The following are not always needed, but may be depending - // on use of certain flex features (like REJECT or yymore()). - - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; - - yy_state_type* yy_state_buf; - yy_state_type* yy_state_ptr; - - char* yy_full_match; - int* yy_full_state; - int yy_full_lp; - - int yy_lp; - int yy_looking_for_trail_begin; - - int yy_more_flag; - int yy_more_len; - int yy_more_offset; - int yy_prev_more_offset; -}; - -#endif diff --git a/Zend/Makefile.am b/Zend/Makefile.am index 3ad54a9d1..219d2d3fc 100644 --- a/Zend/Makefile.am +++ b/Zend/Makefile.am @@ -17,7 +17,7 @@ libZend_la_SOURCES=\ zend_objects_API.c zend_ts_hash.c zend_stream.c \ zend_default_classes.c \ zend_iterators.c zend_interfaces.c zend_exceptions.c \ - zend_strtod.c zend_multibyte.c + zend_strtod.c zend_closures.c zend_float.c libZend_la_LDFLAGS = libZend_la_LIBADD = @ZEND_EXTRA_LIBS@ @@ -31,7 +31,7 @@ zend_ini_scanner.lo: zend_ini_parser.h # Language parser/scanner rules zend_language_scanner.c: $(srcdir)/zend_language_scanner.l - $(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l + $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_language_scanner_defs.h -o$@ $(srcdir)/zend_language_scanner.l zend_language_parser.h: zend_language_parser.c zend_language_parser.c: $(srcdir)/zend_language_parser.y @@ -43,7 +43,7 @@ zend_ini_parser.c: $(srcdir)/zend_ini_parser.y $(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o zend_ini_parser.c zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l - $(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l + $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_ini_scanner_defs.h -o$@ $(srcdir)/zend_ini_scanner.l zend_ini_parser.h: zend_ini_parser.c diff --git a/Zend/Zend.dsp b/Zend/Zend.dsp index a92125d89..0a7ed7753 100644 --- a/Zend/Zend.dsp +++ b/Zend/Zend.dsp @@ -123,6 +123,10 @@ SOURCE=.\zend_builtin_functions.c # End Source File # Begin Source File +SOURCE=.\zend_closures.c +# End Source File +# Begin Source File + SOURCE=.\zend_compile.c # End Source File # Begin Source File @@ -151,6 +155,10 @@ SOURCE=.\zend_extensions.c # End Source File # Begin Source File +SOURCE=.\zend_float.c +# End Source File +# Begin Source File + SOURCE=.\zend_hash.c # End Source File # Begin Source File diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 3802ef075..e6236790b 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -1,5 +1,5 @@ dnl -dnl $Id: Zend.m4,v 1.58.4.4 2006/12/20 10:49:32 dmitry Exp $ +dnl $Id: Zend.m4,v 1.58.4.4.2.5 2008/12/02 16:19:09 cseiler Exp $ dnl dnl This file contains Zend specific autoconf functions. dnl @@ -31,7 +31,6 @@ AC_DEFUN([LIBZEND_BASIC_CHECKS],[ AC_REQUIRE([AC_PROG_YACC]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CC_C_O]) -AC_REQUIRE([AC_PROG_LEX]) AC_REQUIRE([AC_HEADER_STDC]) LIBZEND_BISON_CHECK @@ -61,9 +60,20 @@ sys/time.h \ signal.h \ unix.h \ stdlib.h \ -mach-o/dyld.h \ dlfcn.h) +dnl Don't use mach-o/dyld.h on Darwin 8+, dl* is recommended by Apple from there on +dnl See http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachOTopics/Articles/loading_code.html +case $host_alias in +*darwin[[89]]*) + ;; +*) + AC_CHECK_HEADERS([ \ +mach-o/dyld.h +],[],[][]) + ;; +esac + AC_TYPE_SIZE_T AC_TYPE_SIGNAL @@ -99,12 +109,14 @@ dnl Checks for library functions. AC_FUNC_VPRINTF AC_FUNC_MEMCMP AC_FUNC_ALLOCA -AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass) +AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass sigsetjmp) AC_ZEND_BROKEN_SPRINTF AC_CHECK_FUNCS(finite isfinite isinf isnan) ZEND_FP_EXCEPT + +ZEND_CHECK_FLOAT_PRECISION ]) @@ -165,7 +177,7 @@ AC_MSG_RESULT($ZEND_DEBUG) AC_MSG_CHECKING(whether to enable Zend multibyte) AC_MSG_RESULT($ZEND_MULTIBYTE) - + case $PHP_ZEND_VM in SWITCH) AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_SWITCH,[virtual machine dispatch method]) diff --git a/Zend/ZendTS.dsp b/Zend/ZendTS.dsp index e70f123a0..2295b89eb 100644 --- a/Zend/ZendTS.dsp +++ b/Zend/ZendTS.dsp @@ -148,6 +148,10 @@ SOURCE=.\zend_builtin_functions.c # End Source File # Begin Source File +SOURCE=.\zend_closures.c +# End Source File +# Begin Source File + SOURCE=.\zend_compile.c # End Source File # Begin Source File diff --git a/Zend/acconfig.h b/Zend/acconfig.h index 13f284110..e376a5a52 100644 --- a/Zend/acconfig.h +++ b/Zend/acconfig.h @@ -17,10 +17,16 @@ +----------------------------------------------------------------------+ */ -/* $Id: acconfig.h,v 1.40.2.1.2.3 2008/12/31 11:17:32 sebastian Exp $ */ +/* $Id: acconfig.h,v 1.40.2.1.2.1.2.3 2008/12/31 11:15:31 sebastian Exp $ */ + +#if defined(__GNUC__) && __GNUC__ >= 4 +# define ZEND_API __attribute__ ((visibility("default"))) +# define ZEND_DLEXPORT __attribute__ ((visibility("default"))) +#else +# define ZEND_API +# define ZEND_DLEXPORT +#endif -#define ZEND_API -#define ZEND_DLEXPORT #define ZEND_DLIMPORT @TOP@ diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 51a8aef55..62ff872a2 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -1,4 +1,4 @@ -dnl $Id: acinclude.m4,v 1.15.2.2.2.4 2009/02/14 21:04:07 rasmus Exp $ +dnl $Id: acinclude.m4,v 1.15.2.2.2.2.2.4 2009/02/14 21:08:00 rasmus Exp $ dnl dnl This file contains local autoconf functions. @@ -105,3 +105,117 @@ int main(void) AC_DEFUN([AM_SET_LIBTOOL_VARIABLE],[ LIBTOOL='$(SHELL) $(top_builddir)/libtool $1' ]) + +dnl x87 floating point internal precision control checks +dnl See: http://wiki.php.net/rfc/rounding +AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[ + AC_MSG_CHECKING([for usable _FPU_SETCW]) + AC_TRY_LINK([ + #include + ],[ + fpu_control_t fpu_oldcw, fpu_cw; + volatile double result; + double a = 2877.0; + volatile double b = 1000000.0; + + _FPU_GETCW(fpu_oldcw); + fpu_cw = (fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_SINGLE) | _FPU_DOUBLE; + _FPU_SETCW(fpu_cw); + result = a / b; + _FPU_SETCW(fpu_oldcw); + ], [ac_cfp_have__fpu_setcw=yes], [ac_cfp_have__fpu_setcw=no]) + if test "$ac_cfp_have__fpu_setcw" = "yes" ; then + AC_DEFINE(HAVE__FPU_SETCW, 1, [whether _FPU_SETCW is present and usable]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + + AC_MSG_CHECKING([for usable fpsetprec]) + AC_TRY_LINK([ + #include + ],[ + fp_prec_t fpu_oldprec; + volatile double result; + double a = 2877.0; + volatile double b = 1000000.0; + + fpu_oldprec = fpgetprec(); + fpsetprec(FP_PD); + result = a / b; + fpsetprec(fpu_oldprec); + ], [ac_cfp_have_fpsetprec=yes], [ac_cfp_have_fpsetprec=no]) + if test "$ac_cfp_have_fpsetprec" = "yes" ; then + AC_DEFINE(HAVE_FPSETPREC, 1, [whether fpsetprec is present and usable]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + + AC_MSG_CHECKING([for usable _controlfp]) + AC_TRY_LINK([ + #include + ],[ + unsigned int fpu_oldcw; + volatile double result; + double a = 2877.0; + volatile double b = 1000000.0; + + fpu_oldcw = _controlfp(0, 0); + _controlfp(_PC_53, _MCW_PC); + result = a / b; + _controlfp(fpu_oldcw, _MCW_PC); + ], [ac_cfp_have__controlfp=yes], [ac_cfp_have__controlfp=no]) + if test "$ac_cfp_have__controlfp" = "yes" ; then + AC_DEFINE(HAVE__CONTROLFP, 1, [whether _controlfp is present usable]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + + AC_MSG_CHECKING([for usable _controlfp_s]) + AC_TRY_LINK([ + #include + ],[ + unsigned int fpu_oldcw, fpu_cw; + volatile double result; + double a = 2877.0; + volatile double b = 1000000.0; + + _controlfp_s(&fpu_cw, 0, 0); + fpu_oldcw = fpu_cw; + _controlfp_s(&fpu_cw, _PC_53, _MCW_PC); + result = a / b; + _controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC); + ], [ac_cfp_have__controlfp_s=yes], [ac_cfp_have__controlfp_s=no]) + if test "$ac_cfp_have__controlfp_s" = "yes" ; then + AC_DEFINE(HAVE__CONTROLFP_S, 1, [whether _controlfp_s is present and usable]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + + AC_MSG_CHECKING([whether FPU control word can be manipulated by inline assembler]) + AC_TRY_LINK([ + /* nothing */ + ],[ + unsigned int oldcw, cw; + volatile double result; + double a = 2877.0; + volatile double b = 1000000.0; + + __asm__ __volatile__ ("fnstcw %0" : "=m" (*&oldcw)); + cw = (oldcw & ~0x0 & ~0x300) | 0x200; + __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)); + + result = a / b; + + __asm__ __volatile__ ("fldcw %0" : : "m" (*&oldcw)); + ], [ac_cfp_have_fpu_inline_asm_x86=yes], [ac_cfp_have_fpu_inline_asm_x86=no]) + if test "$ac_cfp_have_fpu_inline_asm_x86" = "yes" ; then + AC_DEFINE(HAVE_FPU_INLINE_ASM_X86, 1, [whether FPU control word can be manipulated by inline assembler]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +]) diff --git a/Zend/bench.php b/Zend/bench.php index 44000d991..5f771803c 100644 --- a/Zend/bench.php +++ b/Zend/bench.php @@ -1,5 +1,7 @@ -%* - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -%+ -class istream; -%* -#if HAVE_UNISTD_H -#include -#endif - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -#undef YY_USE_PROTOS -#define YY_USE_PROTOS - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( SCNG(yy_in) TSRMLS_CC ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -%- -%* - - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr TSRMLS_CC ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { -%- - struct _zend_file_handle *yy_input_file; -%+ - istream* yy_input_file; -%* - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -%- Standard (non-C++) definition -#define yy_current_buffer SCNG(current_buffer) -#define yy_hold_char SCNG(_yy_hold_char) -%* - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -%- Standard (non-C++) definition -/* yy_hold_char holds the character lost when yytext is formed. */ - -#if 0 -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -#endif - -/* Points to current character in buffer. */ -#define yy_c_buf_p SCNG(c_buf_p) -#define yy_init SCNG(init) -#define yy_start SCNG(start) - -#ifdef ZTS -#define TSRMLS_D void ***tsrm_ls -#define TSRMLS_DC , TSRMLS_D -#define TSRMLS_C tsrm_ls -#define TSRMLS_CC , TSRMLS_C -#else -#define TSRMLS_D -#define TSRMLS_DC -#define TSRMLS_C -#define TSRMLS_CC -#endif - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -/* static int yy_did_buffer_switch_on_eof; */ -#define yy_did_buffer_switch_on_eof SCNG(_yy_did_buffer_switch_on_eof) - -void yyrestart YY_PROTO(( struct _zend_file_handle *input_file TSRMLS_DC )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer TSRMLS_DC )); -void yy_load_buffer_state YY_PROTO(( TSRMLS_D )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( struct _zend_file_handle *file, int size TSRMLS_DC )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer TSRMLS_CC ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size TSRMLS_DC )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str TSRMLS_DC )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len TSRMLS_DC )); - -%* - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here -#undef yyleng -#define yyleng SCNG(yy_leng) -#undef yytext -#define yytext SCNG(yy_text) -#undef yytext_ptr -#define yytext_ptr SCNG(yy_text) -#undef yyin -#define yyin SCNG(yy_in) -#undef yyout -#define yyout SCNG(yy_out) -#undef yy_last_accepting_state -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#undef yy_last_accepting_cpos -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#undef yy_more_flag -#define yy_more_flag SCNG(_yy_more_flag) -#undef yy_more_len -#define yy_more_len SCNG(_yy_more_len) - - -%- Standard (non-C++) definition -static yy_state_type yy_get_previous_state YY_PROTO(( TSRMLS_D )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state TSRMLS_DC )); -static int yy_get_next_buffer YY_PROTO(( TSRMLS_D )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); -%* - -#undef TSRMLS_D -#undef TSRMLS_DC -#undef TSRMLS_C -#undef TSRMLS_CC - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ -%% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ -%% code to copy yytext_ptr to yytext[] goes here, if %array - yy_c_buf_p = yy_cp; - -#undef yyleng -#undef yytext -#undef yytext_ptr -#undef yyin -#undef yyout -#undef yy_last_accepting_state -#undef yy_last_accepting_cpos -#undef yy_more_flag -#undef yy_more_len - - -%% data tables for the DFA and the user's section 1 definitions go here - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -%- -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr TSRMLS_DC )); -#endif -%* - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -%- Standard (non-C++) definition -#ifdef __cplusplus -static int 3 YY_PROTO(( TSRMLS_D )); -#else -static int input YY_PROTO(( TSRMLS_D )); -#endif -%* -#endif - -#if YY_STACK_USED -#define yy_start_stack_ptr SCNG(yy_start_stack_ptr) -#define yy_start_stack_depth SCNG(yy_start_stack_depth) -#define yy_start_stack SCNG(yy_start_stack) -/* -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -*/ -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state TSRMLS_DC )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( TSRMLS_D )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( TSRMLS_D )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -/* Zend file handle reading */ -#ifndef ECHO -#define ECHO /* There is no output */ -#endif - -#ifdef ZEND_MULTIBYTE -# define YY_INPUT(buf, result, max_size) \ - if ( ((result = zend_multibyte_yyinput(yyin, buf, max_size TSRMLS_CC)) == 0) \ - && zend_stream_ferror( yyin TSRMLS_CC) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#else -# define YY_INPUT(buf, result, max_size) \ - if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \ - && zend_stream_ferror( yyin TSRMLS_CC) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -#ifndef ECHO -%- Standard (non-C++) definition -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yy_out) ) -%+ C++ definition -#define ECHO LexerOutput( yytext, yyleng ) -%* -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ -%+ C++ definition - if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -%* -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -%- -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -%+ -#define YY_FATAL_ERROR(msg) LexerError( msg ) -%* -#endif - - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -%- Standard (non-C++) definition -#define YY_DECL int yylex YY_PROTO(( void )) -%+ C++ definition -#define YY_DECL int yyFlexLexer::yylex() -%* -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -%% YY_RULE_SETUP definition goes here - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -%% user's declarations go here - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - -#if 0 - if ( ! SCNG(yy_in) ) -%- - SCNG(yy_in) = stdin; -%+ - SCNG(yy_in) = &cin; -%* - - if ( ! SCNG(yy_out) ) -%- - SCNG(yy_out) = stdout; -%+ - SCNG(yy_out) = &cout; -%* -#endif - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); - - yy_load_buffer_state(TSRMLS_C); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -%% yymore()-related code goes here - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -%% code to set up and find next match goes here - -yy_find_action: -%% code to find the action number goes here - - YY_DO_BEFORE_ACTION; - -%% code for yylineno update goes here - -do_action: /* This label is used only to access EOF actions. */ - -%% debug code goes here - - switch ( yy_act ) - { /* beginning of action switch */ -%% actions go here - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = SCNG(yy_in); - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state TSRMLS_CC ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -%% code to do back-up for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer(TSRMLS_C) ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)]; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - -%+ -yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) - { - SCNG(yy_in) = arg_yyin; - SCNG(yy_out) = arg_yyout; - yy_c_buf_p = 0; - yy_init = 1; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - yy_more_offset = yy_prev_more_offset = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = 0; - - yy_current_buffer = 0; - -#ifdef YY_USES_REJECT - yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; -#else - yy_state_buf = 0; -#endif - } - -yyFlexLexer::~yyFlexLexer() - { - delete yy_state_buf; - yy_delete_buffer( yy_current_buffer TSRMLS_CC ); - } - -void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) - { - if ( new_in ) - { - yy_delete_buffer( SCNG(yy_current_buffer TSRMLS_CC ) ); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE TSRMLS_CC ) TSRMLS_CC ); - } - - if ( new_out ) - SCNG(yy_out) = new_out; - } - -int yyFlexLexer::LexerInput( char* buf, int max_size ) - { - if ( SCNG(yy_in)->eof() || SCNG(yy_in)->fail() ) - return 0; - - if (yy_current_buffer->yy_is_interactive) { - SCNG(yy_in)->get( buf[0] ); - - if ( SCNG(yy_in)->eof() ) - return 0; - - if ( SCNG(yy_in)->bad() ) - return -1; - - return 1; - } else { - (void) SCNG(yy_in)->read( buf, max_size ); - - if ( SCNG(yy_in)->bad() ) - return -1; - else - return SCNG(yy_in)->gcount(); - } - } - -void yyFlexLexer::LexerOutput( const char* buf, int size ) - { - (void) SCNG(yy_out)->write( buf, size ); - } -%* - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -%- -static int yy_get_next_buffer(TSRMLS_D) -%+ -int yyFlexLexer::yy_get_next_buffer(TSRMLS_D) -%* - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars) = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - SCNG(yy_n_chars), num_to_read ); - - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars); - } - - if ( SCNG(yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( SCNG(yy_in) TSRMLS_CC ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - SCNG(yy_n_chars) += number_to_move; - yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -%- -static yy_state_type yy_get_previous_state(TSRMLS_D) -%+ -yy_state_type yyFlexLexer::yy_get_previous_state(TSRMLS_D) -%* - { - register yy_state_type yy_current_state; - register char *yy_cp; - -%% code to get the start state into yy_current_state goes here - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { -%% code to find the next state goes here - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -%- -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state TSRMLS_CC ) -yy_state_type yy_current_state; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC ) -%* - { - register int yy_is_jam; -%% code to find the next state, and perhaps do backing up, goes here - - return yy_is_jam ? 0 : yy_current_state; - } - - -%- -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp TSRMLS_DC ) -#else -static void yyunput( c, yy_bp TSRMLS_CC ) -int c; -register char *yy_bp; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yyunput( int c, register char* yy_bp TSRMLS_DC ) -%* - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = SCNG(yy_n_chars) + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - SCNG(yy_n_chars) = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -%% update yylineno here - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -%- -#endif /* ifndef YY_NO_UNPUT */ -%* - - -%- -#ifdef __cplusplus -static int yyinput(TSRMLS_D) -#else -static int input(TSRMLS_C) -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -int yyFlexLexer::yyinput(TSRMLS_D) -%* - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer(TSRMLS_C) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( SCNG(yy_in) TSRMLS_CC ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(TSRMLS_C); -#else - return input(TSRMLS_C); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - -%% update BOL and yylineno - - return c; - } - - -%- -#ifdef YY_USE_PROTOS -void yyrestart( struct _zend_file_handle *input_file TSRMLS_DC ) -#else -void yyrestart( input_file TSRMLS_CC ) -struct _zend_file_handle *input_file; -#endif -%+ -void yyFlexLexer::yyrestart( istream* input_file TSRMLS_DC ) -%* - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); - - yy_init_buffer( yy_current_buffer, input_file TSRMLS_CC ); - yy_load_buffer_state(TSRMLS_C); - } - - -%- -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC) -#else -void yy_switch_to_buffer( new_buffer TSRMLS_CC) -YY_BUFFER_STATE new_buffer; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC ) -%* - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars); - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(TSRMLS_C); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( TSRMLS_D ) -#else -void yy_load_buffer_state(TSRMLS_C) -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yy_load_buffer_state() -%* - { - SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - SCNG(yy_in) = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( struct _zend_file_handle *file, int size TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size TSRMLS_CC ) -struct _zend_file_handle *file; -int size; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size TSRMLS_DC ) -%* - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file TSRMLS_CC ); - - return b; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -#else -void yy_delete_buffer( b TSRMLS_CC ) -YY_BUFFER_STATE b; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -%* - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -%- - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC ) -#else -void yy_init_buffer( b, file TSRMLS_CC ) -YY_BUFFER_STATE b; -struct _zend_file_handle *file; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - -%+ -extern "C" int isatty YY_PROTO(( int )); -void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file TSRMLS_DC ) -%* - - { - yy_flush_buffer( b TSRMLS_CC ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -%- -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file->handle.stream.interactive; -#endif -#endif -%+ - b->yy_is_interactive = (file == (istream *) &cin) ? 1 : 0; -%* - } - - -%- -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -#else -void yy_flush_buffer( b TSRMLS_CC ) -YY_BUFFER_STATE b; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - -%+ -void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -%* - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(TSRMLS_C); - } -%* - - -#ifndef YY_NO_SCAN_BUFFER -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size TSRMLS_CC ) -char *base; -yy_size_t size; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b TSRMLS_CC ); - - return b; - } -%* -#endif - - -#ifndef YY_NO_SCAN_STRING -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str TSRMLS_CC ) -yyconst char *yy_str; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len TSRMLS_CC ); - } -%* -#endif - - -#ifndef YY_NO_SCAN_BYTES -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len TSRMLS_CC ) -yyconst char *bytes; -int len; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n TSRMLS_CC); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -%* -#endif - - -#ifndef YY_NO_PUSH_STATE -%- -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state TSRMLS_DC ) -#else -static void yy_push_state( new_state TSRMLS_CC ) -int new_state; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yy_push_state( int new_state TSRMLS_DC ) -%* - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -%- -static void yy_pop_state(TSRMLS_D) -%+ -void yyFlexLexer::yy_pop_state(TSRMLS_D) -%* - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -%- -static int yy_top_state(TSRMLS_D) -%+ -int yyFlexLexer::yy_top_state() -%* - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -%- -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - -%+ - -void yyFlexLexer::LexerError( yyconst char msg[] ) - { - cerr << msg << '\n'; - exit( YY_EXIT_FAILURE ); - } -%* - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif diff --git a/Zend/header b/Zend/header index 4dd603ff9..baa68e23a 100644 --- a/Zend/header +++ b/Zend/header @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,4 +16,4 @@ +----------------------------------------------------------------------+ */ -/* $Id: header,v 1.1.2.1 2006/01/04 23:53:03 andi Exp $ */ +/* $Id: header,v 1.1.2.1.4.1 2009/01/02 20:45:41 felipe Exp $ */ diff --git a/Zend/tests/004.phpt b/Zend/tests/004.phpt index ff7863346..6beafe707 100644 --- a/Zend/tests/004.phpt +++ b/Zend/tests/004.phpt @@ -13,7 +13,7 @@ var_dump(strncmp("qwerty", "qwerty123", 7)); echo "Done\n"; ?> --EXPECTF-- -Warning: Wrong parameter count for strncmp() in %s on line %d +Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d NULL int(0) diff --git a/Zend/tests/005.phpt b/Zend/tests/005.phpt index 15a510bfe..00f320e94 100644 --- a/Zend/tests/005.phpt +++ b/Zend/tests/005.phpt @@ -15,7 +15,7 @@ var_dump(strcasecmp("01", "01")); echo "Done\n"; ?> --EXPECTF-- -Warning: Wrong parameter count for strcasecmp() in %s on line %d +Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d NULL int(0) int(-3) diff --git a/Zend/tests/006.phpt b/Zend/tests/006.phpt index c600baa01..eedb84971 100644 --- a/Zend/tests/006.phpt +++ b/Zend/tests/006.phpt @@ -16,7 +16,7 @@ var_dump(strncasecmp("01", "01", 1000)); echo "Done\n"; ?> --EXPECTF-- -Warning: Wrong parameter count for strncasecmp() in %s on line %d +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 diff --git a/Zend/tests/007.phpt b/Zend/tests/007.phpt index e04e0bf9e..3fff2b830 100644 --- a/Zend/tests/007.phpt +++ b/Zend/tests/007.phpt @@ -22,7 +22,7 @@ var_dump(each($a)); echo "Done\n"; ?> --EXPECTF-- -Warning: Wrong parameter count for each() in %s on line %d +Warning: each() expects exactly 1 parameter, 0 given in %s on line %d NULL Warning: Variable passed to each() is not an array or object in %s on line %d diff --git a/Zend/tests/009.phpt b/Zend/tests/009.phpt index 87eeb2755..f122b714d 100644 --- a/Zend/tests/009.phpt +++ b/Zend/tests/009.phpt @@ -40,6 +40,8 @@ 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) string(3) "foo" string(4) "foo2" diff --git a/Zend/tests/011.phpt b/Zend/tests/011.phpt index 58ed8d74d..57c621491 100644 --- a/Zend/tests/011.phpt +++ b/Zend/tests/011.phpt @@ -53,22 +53,22 @@ $bar->test(); echo "Done\n"; ?> --EXPECTF-- -Warning: Wrong parameter count for property_exists() in %s on line %d +Warning: property_exists() expects exactly 2 parameters, 0 given in %s on line %d NULL -Warning: Wrong parameter count for property_exists() in %s on line %d +Warning: property_exists() expects exactly 2 parameters, 1 given in %s on line %d NULL bool(true) -bool(false) -bool(false) +bool(true) +bool(true) bool(false) bool(false) bool(false) bool(false) bool(false) bool(true) -bool(false) -bool(false) +bool(true) +bool(true) bool(false) bool(false) @@ -84,6 +84,6 @@ bool(true) bool(true) bool(true) bool(true) -bool(false) +bool(true) bool(true) Done diff --git a/Zend/tests/014.phpt b/Zend/tests/014.phpt index f65f2a328..25995b797 100644 --- a/Zend/tests/014.phpt +++ b/Zend/tests/014.phpt @@ -32,7 +32,7 @@ array(2) { string(%d) "%s" } -Warning: Wrong parameter count for get_included_files() in %s on line %d +Warning: get_included_files() expects exactly 0 parameters, 2 given in %s on line %d NULL array(2) { [0]=> @@ -41,7 +41,7 @@ array(2) { string(%d) "%s" } -Warning: Wrong parameter count for get_included_files() in %s on line %d +Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d NULL array(2) { [0]=> diff --git a/Zend/tests/015.phpt b/Zend/tests/015.phpt index a80254281..ffe1a4f94 100644 --- a/Zend/tests/015.phpt +++ b/Zend/tests/015.phpt @@ -9,20 +9,19 @@ 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)); +var_dump(trigger_error("error", E_USER_DEPRECATED)); echo "Done\n"; ?> --EXPECTF-- -Warning: Wrong parameter count for trigger_error() in %s on line %d +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) -Notice: Array to string conversion in %s on line %d - -Notice: Array 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) @@ -32,4 +31,7 @@ bool(false) Warning: error in %s on line %d bool(true) + +Deprecated: error in %s on line %d +bool(true) Done diff --git a/Zend/tests/017.phpt b/Zend/tests/017.phpt index 9ed773276..09ad123c7 100644 --- a/Zend/tests/017.phpt +++ b/Zend/tests/017.phpt @@ -45,11 +45,11 @@ var_dump(count(get_extension_funcs("zend"))); echo "Done\n"; ?> --EXPECTF-- -Warning: Wrong parameter count for get_resource_type() in %s on line %d +Warning: get_resource_type() expects exactly 1 parameter, 0 given in %s on line %d NULL -Warning: Supplied argument is not a valid resource handle in %s on line %d -bool(false) +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" @@ -66,17 +66,17 @@ string(5) "array" string(5) "array" int(%d) -Warning: Wrong parameter count for get_defined_functions() in %s on line %d +Warning: get_defined_functions() expects exactly 0 parameters, 1 given in %s on line %d NULL string(5) "array" int(%d) -Warning: Wrong parameter count for get_declared_interfaces() in %s on line %d +Warning: get_declared_interfaces() expects exactly 0 parameters, 1 given in %s on line %d NULL string(5) "array" int(%d) -Warning: Wrong parameter count for get_extension_funcs() in %s on line %d +Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d NULL bool(false) string(5) "array" diff --git a/Zend/tests/018.phpt b/Zend/tests/018.phpt index ea875c678..9543cc4ca 100644 --- a/Zend/tests/018.phpt +++ b/Zend/tests/018.phpt @@ -18,18 +18,16 @@ var_dump(constant("TEST_CONST2")); echo "Done\n"; ?> --EXPECTF-- -Warning: Wrong parameter count for constant() in %s on line %d +Warning: constant() expects exactly 1 parameter, 0 given in %s on line %d NULL -Warning: Wrong parameter count for constant() in %s on line %d +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 -Notice: Array to string conversion in %s on line %d - -Warning: constant(): Couldn't find constant Array in %s on line %d +Warning: constant() expects parameter 1 to be string, array given in %s on line %d NULL int(1) string(4) "test" diff --git a/Zend/tests/020.phpt b/Zend/tests/020.phpt index fa49a9327..73a3a17e8 100644 --- a/Zend/tests/020.phpt +++ b/Zend/tests/020.phpt @@ -20,11 +20,14 @@ foo(1,2); echo "Done\n"; ?> --EXPECTF-- -bool(false) +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) -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) diff --git a/Zend/tests/021.phpt b/Zend/tests/021.phpt new file mode 100644 index 000000000..a40a41100 --- /dev/null +++ b/Zend/tests/021.phpt @@ -0,0 +1,37 @@ +--TEST-- +?: operator +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +int(23) +string(3) "bar" +int(23) +float(23.5) +int(1) +Array +( + [e] => e +) diff --git a/Zend/tests/022.phpt b/Zend/tests/022.phpt new file mode 100644 index 000000000..1226e2719 --- /dev/null +++ b/Zend/tests/022.phpt @@ -0,0 +1,24 @@ +--TEST-- +Implementating abstracting methods and optional parameters +--FILE-- +someMethod("foo"); +$a->someMethod(); +--EXPECT-- +foo +default diff --git a/Zend/tests/023.phpt b/Zend/tests/023.phpt new file mode 100644 index 000000000..6f975c655 --- /dev/null +++ b/Zend/tests/023.phpt @@ -0,0 +1,45 @@ +--TEST-- +Testing variable variables as function name +--FILE-- +$$b()->$b()); + + +$a = 'strtoupper'; +$b = 'a'; +$c = 'b'; +$d = 'c'; +var_dump($$$$d('foo')); + +?> +--EXPECT-- +Test +foo! +string(4) "bar!" +string(3) "FOO" diff --git a/Zend/tests/024.phpt b/Zend/tests/024.phpt new file mode 100644 index 000000000..6fe10201f --- /dev/null +++ b/Zend/tests/024.phpt @@ -0,0 +1,51 @@ +--TEST-- +Testing operations with undefined variable +--FILE-- +$b); +var_dump($a->$b); +var_dump($a->$b->$c[1]); + +?> +--EXPECTF-- +Notice: Undefined variable: a in %s on line %d +NULL + +Notice: Undefined variable: c in %s on line %d + +Notice: Undefined variable: a in %s on line %d +NULL + +Notice: Undefined variable: a in %s on line %d +int(1) + +Notice: Undefined variable: b in %s on line %d + +Notice: Undefined variable: a in %s on line %d +int(0) + +Notice: Undefined variable: a in %s on line %d +NULL + +Notice: Undefined variable: b in %s on line %d +int(1) + +Notice: Trying to get property of non-object in %s on line %d +NULL + +Notice: Trying to get property of non-object in %s on line %d +NULL + +Notice: Undefined variable: c in %s on line %d + +Notice: Trying to get property of non-object in %s on line %d + +Notice: 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 new file mode 100644 index 000000000..24e5520ee --- /dev/null +++ b/Zend/tests/025.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing dynamic calls +--FILE-- + +--EXPECT-- +ok +ok +ok +ok +ok +ok diff --git a/Zend/tests/026.phpt b/Zend/tests/026.phpt new file mode 100644 index 000000000..784b12c69 --- /dev/null +++ b/Zend/tests/026.phpt @@ -0,0 +1,25 @@ +--TEST-- +Trying assign value to property when an object is not returned in a function +--FILE-- +a()->a; +print "ok\n"; + +$test->a()->a = 1; +print "ok\n"; + +?> +--EXPECTF-- +Notice: Trying to get property of non-object in %s on line %d +ok + +Strict Standards: Creating default object from empty value in %s on line %d +ok diff --git a/Zend/tests/027.phpt b/Zend/tests/027.phpt new file mode 100644 index 000000000..a862d689e --- /dev/null +++ b/Zend/tests/027.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing dynamic calls using variable variables with curly syntax +--FILE-- + +--EXPECT-- +bool(true) +bool(true) diff --git a/Zend/tests/028.phpt b/Zend/tests/028.phpt new file mode 100644 index 000000000..2c58a87b3 --- /dev/null +++ b/Zend/tests/028.phpt @@ -0,0 +1,23 @@ +--TEST-- +Testing function call through of array item +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) + +Notice: Undefined offset: 2 in %s on line %d + +Fatal error: Function name must be a string in %s on line %d diff --git a/Zend/tests/029.phpt b/Zend/tests/029.phpt new file mode 100644 index 000000000..469dd081b --- /dev/null +++ b/Zend/tests/029.phpt @@ -0,0 +1,85 @@ +--TEST-- +Testing assign to property of an object in an array +--FILE-- +a = clone $arr[0]; +var_dump($arr); + +$arr[0]->b = new $arr[0]; +var_dump($arr); + +$arr[0]->c = $arr[0]->a; +var_dump($arr); + +?> +--EXPECT-- +array(1) { + [0]=> + object(stdClass)#1 (1) { + ["a"]=> + object(stdClass)#2 (0) { + } + } +} +array(1) { + [0]=> + object(stdClass)#1 (2) { + ["a"]=> + object(stdClass)#2 (0) { + } + ["b"]=> + object(stdClass)#3 (0) { + } + } +} +array(1) { + [0]=> + object(stdClass)#1 (3) { + ["a"]=> + object(stdClass)#2 (0) { + } + ["b"]=> + object(stdClass)#3 (0) { + } + ["c"]=> + object(stdClass)#2 (0) { + } + } +} +--UEXPECT-- +array(1) { + [0]=> + object(stdClass)#1 (1) { + [u"a"]=> + object(stdClass)#2 (0) { + } + } +} +array(1) { + [0]=> + object(stdClass)#1 (2) { + [u"a"]=> + object(stdClass)#2 (0) { + } + [u"b"]=> + object(stdClass)#3 (0) { + } + } +} +array(1) { + [0]=> + object(stdClass)#1 (3) { + [u"a"]=> + object(stdClass)#2 (0) { + } + [u"b"]=> + object(stdClass)#3 (0) { + } + [u"c"]=> + object(stdClass)#2 (0) { + } + } +} diff --git a/Zend/tests/030.phpt b/Zend/tests/030.phpt new file mode 100644 index 000000000..8afcb66bd --- /dev/null +++ b/Zend/tests/030.phpt @@ -0,0 +1,70 @@ +--TEST-- +Overriding $this in catch and checking the object properties later. +--FILE-- +baz(); + } + + public function baz() { + foreach ($this as $k => $v) { + printf("'%s' => '%s'\n", $k, $v); + } + print "ok\n"; + } +} + +$test = new foo; +$test->bar(); + +?> +--EXPECTF-- +object(Exception)#%d (7) { + ["message":protected]=> + string(3) "foo" + ["string":"Exception":private]=> + string(0) "" + ["code":protected]=> + int(0) + ["file":protected]=> + string(%d) "%s030.php" + ["line":protected]=> + int(%d) + ["trace":"Exception":private]=> + array(1) { + [0]=> + array(6) { + ["file"]=> + string(%d) "%s030.php" + ["line"]=> + int(%d) + ["function"]=> + string(3) "bar" + ["class"]=> + string(3) "foo" + ["type"]=> + string(2) "->" + ["args"]=> + array(0) { + } + } + } + ["previous":"Exception":private]=> + NULL +} +'test' => '0' +'test_2' => '1' +'test_3' => '2' +ok diff --git a/Zend/tests/031.phpt b/Zend/tests/031.phpt new file mode 100644 index 000000000..8db52a5de --- /dev/null +++ b/Zend/tests/031.phpt @@ -0,0 +1,11 @@ +--TEST-- +Testing array with '[]' passed as argument by value +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use [] for reading in %s on line %d diff --git a/Zend/tests/032.phpt b/Zend/tests/032.phpt new file mode 100644 index 000000000..8f7f99464 --- /dev/null +++ b/Zend/tests/032.phpt @@ -0,0 +1,13 @@ +--TEST-- +Testing array with '[]' passed as argument by reference +--FILE-- + +--EXPECT-- +ok! diff --git a/Zend/tests/033.phpt b/Zend/tests/033.phpt new file mode 100644 index 000000000..c8651159a --- /dev/null +++ b/Zend/tests/033.phpt @@ -0,0 +1,31 @@ +--TEST-- +Using undefined multidimensional array +--FILE-- +foo; + +$arr[1][2][3][4][5]->foo = 1; + +$arr[][] = 2; + +$arr[][]->bar = 2; + +?> +--EXPECTF-- + +Notice: Undefined variable: arr in %s on line %d + +Notice: Undefined variable: arr in %s on line %d + +Notice: Undefined variable: arr in %s on line %d + +Notice: Trying to get property of non-object in %s on line %d + +Strict Standards: Creating default object from empty value in %s on line %d + +Strict Standards: Creating default object from empty value in %s on line %d diff --git a/Zend/tests/034.phpt b/Zend/tests/034.phpt new file mode 100644 index 000000000..6e46f2645 --- /dev/null +++ b/Zend/tests/034.phpt @@ -0,0 +1,26 @@ +--TEST-- +Testing multiples 'default:' in switch +--FILE-- + +--EXPECT-- +3 diff --git a/Zend/tests/035.phpt b/Zend/tests/035.phpt new file mode 100644 index 000000000..75df786e8 --- /dev/null +++ b/Zend/tests/035.phpt @@ -0,0 +1,18 @@ +--TEST-- +Using 'static' and 'global' in global scope +--FILE-- + +--EXPECT-- +int(-1) +int(-1) +int(-1) diff --git a/Zend/tests/036.phpt b/Zend/tests/036.phpt new file mode 100644 index 000000000..6feb23f67 --- /dev/null +++ b/Zend/tests/036.phpt @@ -0,0 +1,13 @@ +--TEST-- +Trying to use lambda in array offset +--FILE-- + +--EXPECTF-- +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d diff --git a/Zend/tests/037.phpt b/Zend/tests/037.phpt new file mode 100644 index 000000000..d7057b484 --- /dev/null +++ b/Zend/tests/037.phpt @@ -0,0 +1,19 @@ +--TEST-- +Trying to access inexistent static property of Closure +--FILE-- + +--EXPECTF-- +int(1) + +Fatal error: Access to undeclared static property: Closure::$x in %s on line %d diff --git a/Zend/tests/038.phpt b/Zend/tests/038.phpt new file mode 100644 index 000000000..963e73f9e --- /dev/null +++ b/Zend/tests/038.phpt @@ -0,0 +1,12 @@ +--TEST-- +Trying to use lambda as array key +--FILE-- + 1)); + +?> +--EXPECTF-- +Warning: Illegal offset type in %s on line %d +array(0) { +} diff --git a/Zend/tests/access_modifiers_001.phpt b/Zend/tests/access_modifiers_001.phpt new file mode 100644 index 000000000..989b926be --- /dev/null +++ b/Zend/tests/access_modifiers_001.phpt @@ -0,0 +1,14 @@ +--TEST-- +using multiple access modifiers (methods) +--FILE-- + +--EXPECTF-- +Fatal error: Multiple access type modifiers are not allowed in %s on line %d diff --git a/Zend/tests/access_modifiers_002.phpt b/Zend/tests/access_modifiers_002.phpt new file mode 100644 index 000000000..cc5df306f --- /dev/null +++ b/Zend/tests/access_modifiers_002.phpt @@ -0,0 +1,13 @@ +--TEST-- +using multiple access modifiers (attributes) +--FILE-- + +--EXPECTF-- +Fatal error: Multiple access type modifiers are not allowed in %s on line %d diff --git a/Zend/tests/access_modifiers_003.phpt b/Zend/tests/access_modifiers_003.phpt new file mode 100644 index 000000000..dc2127802 --- /dev/null +++ b/Zend/tests/access_modifiers_003.phpt @@ -0,0 +1,13 @@ +--TEST-- +using multiple access modifiers (classes) +--FILE-- + +--EXPECTF-- +Parse error: %s error,%sexpecting %s in %s on line %d diff --git a/Zend/tests/access_modifiers_004.phpt b/Zend/tests/access_modifiers_004.phpt new file mode 100644 index 000000000..c023d2cb6 --- /dev/null +++ b/Zend/tests/access_modifiers_004.phpt @@ -0,0 +1,14 @@ +--TEST-- +using multiple access modifiers (abstract methods) +--FILE-- + +--EXPECTF-- +Fatal error: Multiple abstract modifiers are not allowed in %s on line %d diff --git a/Zend/tests/access_modifiers_005.phpt b/Zend/tests/access_modifiers_005.phpt new file mode 100644 index 000000000..b32394d7f --- /dev/null +++ b/Zend/tests/access_modifiers_005.phpt @@ -0,0 +1,14 @@ +--TEST-- +using multiple access modifiers (final methods) +--FILE-- + +--EXPECTF-- +Fatal error: Multiple final modifiers are not allowed in %s on line %d diff --git a/Zend/tests/access_modifiers_006.phpt b/Zend/tests/access_modifiers_006.phpt new file mode 100644 index 000000000..293fc1c64 --- /dev/null +++ b/Zend/tests/access_modifiers_006.phpt @@ -0,0 +1,14 @@ +--TEST-- +using multiple access modifiers (static methods) +--FILE-- + +--EXPECTF-- +Fatal error: Multiple static modifiers are not allowed in %s on line %d diff --git a/Zend/tests/access_modifiers_007.phpt b/Zend/tests/access_modifiers_007.phpt new file mode 100644 index 000000000..26779e6e6 --- /dev/null +++ b/Zend/tests/access_modifiers_007.phpt @@ -0,0 +1,13 @@ +--TEST-- +abstract final methods errmsg +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use the final modifier on an abstract class member in %s on line %d diff --git a/Zend/tests/access_modifiers_008.phpt b/Zend/tests/access_modifiers_008.phpt new file mode 100644 index 000000000..67886cfa7 --- /dev/null +++ b/Zend/tests/access_modifiers_008.phpt @@ -0,0 +1,21 @@ +--TEST-- +Inconsistencies when accessing protected members +--XFAIL-- +Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2 +--FILE-- + +--EXPECTF-- +Fatal error: Call to protected method B1::f() from context 'B2' in %s on line %d diff --git a/Zend/tests/access_modifiers_009.phpt b/Zend/tests/access_modifiers_009.phpt new file mode 100644 index 000000000..cb01fa13f --- /dev/null +++ b/Zend/tests/access_modifiers_009.phpt @@ -0,0 +1,26 @@ +--TEST-- +Inconsistencies when accessing protected members - 2 +--XFAIL-- +Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2 +--FILE-- + +--EXPECTF-- +bool(false) + +Fatal error: Call to protected method B1::f() from context 'B2' in %s on line %d diff --git a/Zend/tests/access_modifiers_010.phpt b/Zend/tests/access_modifiers_010.phpt new file mode 100644 index 000000000..637ea36ce --- /dev/null +++ b/Zend/tests/access_modifiers_010.phpt @@ -0,0 +1,31 @@ +--TEST-- +Testing visibility of methods +--FILE-- +test2(); + } +} + +abstract class b extends a { +} + +class c extends b { + public function __construct() { + $this->test(); + } +} + +new c; + +?> +--EXPECTF-- +Fatal error: Call to private method d::test2() from context 'a' in %s on line %d diff --git a/Zend/tests/anonymous_func_001.phpt b/Zend/tests/anonymous_func_001.phpt new file mode 100644 index 000000000..644a7f49a --- /dev/null +++ b/Zend/tests/anonymous_func_001.phpt @@ -0,0 +1,35 @@ +--TEST-- +Testing calls to anonymous function +--FILE-- + +--EXPECT-- +int(0) +int(0) +int(1) +int(1) +int(2) +int(2) +int(3) +int(3) +int(4) +int(4) +int(5) +int(5) +int(6) +int(6) +int(7) +int(7) +int(8) +int(8) +int(9) +int(9) diff --git a/Zend/tests/anonymous_func_002.phpt b/Zend/tests/anonymous_func_002.phpt new file mode 100644 index 000000000..4c40b6230 --- /dev/null +++ b/Zend/tests/anonymous_func_002.phpt @@ -0,0 +1,16 @@ +--TEST-- +Testing anonymous function return as array key and accessing $GLOBALS +--FILE-- + +--EXPECT-- +int(2) +bool(true) diff --git a/Zend/tests/anonymous_func_003.phpt b/Zend/tests/anonymous_func_003.phpt new file mode 100644 index 000000000..32c5cf085 --- /dev/null +++ b/Zend/tests/anonymous_func_003.phpt @@ -0,0 +1,15 @@ +--TEST-- +Using throw $var with anonymous function return +--FILE-- +getMessage() == 'test'); +} + +?> +--EXPECT-- +bool(true) diff --git a/Zend/tests/assign_to_var_001.phpt b/Zend/tests/assign_to_var_001.phpt new file mode 100644 index 000000000..d37ebbcbd --- /dev/null +++ b/Zend/tests/assign_to_var_001.phpt @@ -0,0 +1,18 @@ +--TEST-- +complex cases of variable assignment - 001 +--FILE-- + +--EXPECTF-- +int(2) +int(2) +Done diff --git a/Zend/tests/assign_to_var_002.phpt b/Zend/tests/assign_to_var_002.phpt new file mode 100644 index 000000000..e682765e5 --- /dev/null +++ b/Zend/tests/assign_to_var_002.phpt @@ -0,0 +1,18 @@ +--TEST-- +complex cases of variable assignment - 002 +--FILE-- + +--EXPECTF-- +string(1) "g" +string(1) "g" +Done diff --git a/Zend/tests/assign_to_var_003.phpt b/Zend/tests/assign_to_var_003.phpt new file mode 100644 index 000000000..911ee0bb8 --- /dev/null +++ b/Zend/tests/assign_to_var_003.phpt @@ -0,0 +1,18 @@ +--TEST-- +complex cases of variable assignment - 003 +--FILE-- + +--EXPECTF-- +NULL +NULL +Done diff --git a/Zend/tests/assign_to_var_004.phpt b/Zend/tests/assign_to_var_004.phpt new file mode 100644 index 000000000..787362acc --- /dev/null +++ b/Zend/tests/assign_to_var_004.phpt @@ -0,0 +1,22 @@ +--TEST-- +complex cases of variable assignment - 004 +--FILE-- + +--EXPECTF-- +string(5) "space" +string(5) "space" +string(5) "space" +Done diff --git a/Zend/tests/bug20242.phpt b/Zend/tests/bug20242.phpt index bd140f580..064f8235f 100755 --- a/Zend/tests/bug20242.phpt +++ b/Zend/tests/bug20242.phpt @@ -1,12 +1,7 @@ --TEST-- Bug #20242 (Method call in front of class definition) ---SKIPIF-- -=')) die('skip ZendEngine 2 does not support this'); ?> --FILE-- -===DONE=== ---EXPECT-- -===DONE=== +--TEST-- +Bug #26077 (Memory leaks when creating an instance of an object) +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/tests/bug26229.phpt b/Zend/tests/bug26229.phpt index f22aa2f41..347eb5557 100755 --- a/Zend/tests/bug26229.phpt +++ b/Zend/tests/bug26229.phpt @@ -1,29 +1,29 @@ ---TEST-- -Bug #26229 (getIterator() segfaults when it returns arrays or scalars) ---FILE-- - $value) - { - var_dump($value); - } -} -catch(Exception $e) -{ - echo $e->getMessage() . "\n"; -} -?> -===DONE=== ---EXPECTF-- -Objects returned by array_iterator::getIterator() must be traversable or implement interface Iterator -===DONE=== +--TEST-- +Bug #26229 (getIterator() segfaults when it returns arrays or scalars) +--FILE-- + $value) + { + var_dump($value); + } +} +catch(Exception $e) +{ + echo $e->getMessage() . "\n"; +} +?> +===DONE=== +--EXPECTF-- +Objects returned by array_iterator::getIterator() must be traversable or implement interface Iterator +===DONE=== diff --git a/Zend/tests/bug26698.phpt b/Zend/tests/bug26698.phpt index 56cfec6a8..aecc708a0 100755 --- a/Zend/tests/bug26698.phpt +++ b/Zend/tests/bug26698.phpt @@ -1,73 +1,73 @@ ---TEST-- -Bug #26698 (Thrown exceptions while evaluting argument to pass as parameter crash PHP) ---FILE-- -three($res->getNone()); - } - catch(Exception $e) - { - echo 'Caught: '.$e->getMessage()."\n"; - } - } - - function callTwo() - { - try - { - $res = new Object(); - $this->three(1, $res->getNone()); - } - catch(Exception $e) - { - echo 'Caught: '.$e->getMessage()."\n"; - } - } - - function callThree() - { - try - { - $res = new Object(); - $this->three(1, 2, $res->getNone()); - } - catch(Exception $e) - { - echo 'Caught: '.$e->getMessage()."\n"; - } - } -} - -$p = new Proxy(); - -$p->callOne(); -$p->callTwo(); -$p->callThree(); -?> -===DONE=== ---EXPECT-- -Caught: NONE -Caught: NONE -Caught: NONE -===DONE=== +--TEST-- +Bug #26698 (Thrown exceptions while evaluting argument to pass as parameter crash PHP) +--FILE-- +three($res->getNone()); + } + catch(Exception $e) + { + echo 'Caught: '.$e->getMessage()."\n"; + } + } + + function callTwo() + { + try + { + $res = new Object(); + $this->three(1, $res->getNone()); + } + catch(Exception $e) + { + echo 'Caught: '.$e->getMessage()."\n"; + } + } + + function callThree() + { + try + { + $res = new Object(); + $this->three(1, 2, $res->getNone()); + } + catch(Exception $e) + { + echo 'Caught: '.$e->getMessage()."\n"; + } + } +} + +$p = new Proxy(); + +$p->callOne(); +$p->callTwo(); +$p->callThree(); +?> +===DONE=== +--EXPECT-- +Caught: NONE +Caught: NONE +Caught: NONE +===DONE=== diff --git a/Zend/tests/bug27268.phpt b/Zend/tests/bug27268.phpt index 3c34c90fc..a86e8d029 100755 --- a/Zend/tests/bug27268.phpt +++ b/Zend/tests/bug27268.phpt @@ -1,28 +1,28 @@ ---TEST-- -Bug #27268 (Bad references accentuated by clone) ---FILE-- -a; - } -} - -$A = new A; -$A->a = array(1); -$x = $A->getA(); -$clone = clone $A; -$clone->a = array(); -print_r($A); -?> ---EXPECT-- -A Object -( - [a] => Array - ( - [0] => 1 - ) - -) +--TEST-- +Bug #27268 (Bad references accentuated by clone) +--FILE-- +a; + } +} + +$A = new A; +$A->a = array(1); +$x = $A->getA(); +$clone = clone $A; +$clone->a = array(); +print_r($A); +?> +--EXPECT-- +A Object +( + [a] => Array + ( + [0] => 1 + ) + +) diff --git a/Zend/tests/bug27598.phpt b/Zend/tests/bug27598.phpt index 6ec229b60..534e8cf85 100755 --- a/Zend/tests/bug27598.phpt +++ b/Zend/tests/bug27598.phpt @@ -1,12 +1,12 @@ ---TEST-- -Bug #27598 (list() array key assignment causes HUGE memory leak) ---FILE-- - ---EXPECT-- -array(1) { - [0]=> - int(1) -} +--TEST-- +Bug #27598 (list() array key assignment causes HUGE memory leak) +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + int(1) +} diff --git a/Zend/tests/bug28072.phpt b/Zend/tests/bug28072.phpt index 7959a1c4d..76208733f 100755 --- a/Zend/tests/bug28072.phpt +++ b/Zend/tests/bug28072.phpt @@ -41,6 +41,6 @@ Array ) Array ( - [a] => 111 + [a] => 222 [c] => 444 ) diff --git a/Zend/tests/bug28377.phpt b/Zend/tests/bug28377.phpt index 69c8b3dc3..9d1b43472 100755 --- a/Zend/tests/bug28377.phpt +++ b/Zend/tests/bug28377.phpt @@ -1,23 +1,23 @@ ---TEST-- -Bug #28377 (debug_backtrace is intermittently passing args) ---FILE-- - ---EXPECT-- -dereferenced -- args: 2 -direct -- args: 2 +--TEST-- +Bug #28377 (debug_backtrace is intermittently passing args) +--FILE-- + +--EXPECT-- +dereferenced -- args: 2 +direct -- args: 2 diff --git a/Zend/tests/bug29104.phpt b/Zend/tests/bug29104.phpt index e1de58eff..788b2190b 100644 --- a/Zend/tests/bug29104.phpt +++ b/Zend/tests/bug29104.phpt @@ -1,27 +1,27 @@ ---TEST-- -Bug #29104 (Function declaration in method doesn't work) ---FILE-- -g(); -f(); -?> ---EXPECT-- -function g - begin -function g - end -function f +--TEST-- +Bug #29104 (Function declaration in method doesn't work) +--FILE-- +g(); +f(); +?> +--EXPECT-- +function g - begin +function g - end +function f diff --git a/Zend/tests/bug29210.phpt b/Zend/tests/bug29210.phpt index d0de54312..3bae8064b 100644 --- a/Zend/tests/bug29210.phpt +++ b/Zend/tests/bug29210.phpt @@ -1,104 +1,104 @@ ---TEST-- -Bug #29210 (Function is_callable does not support private and protected methods) ---FILE-- -test_func1(); - } else { - echo "test_func1 isn't callable from inside\n"; - } - if (is_callable(array($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(); - } else { - echo "test_func3 isn't callable from inside\n"; - } - if (is_callable(array('test_class','test_func4'))) { - test_class::test_func4(); - } else { - echo "test_func4 isn't callable from inside\n"; - } - } -} - -class foo extends test_class { - function test() { - if (is_callable(array($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(); - } else { - echo "test_func2 isn't callable from child\n"; - } - if (is_callable(array('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(); - } else { - echo "test_func4 isn't callable from child\n"; - } - } -} - -$object = new test_class; -$object->test(); -if (is_callable(array($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(); -} else { - echo "test_func2 isn't callable from outside\n"; -} -if (is_callable(array('test_class','test_func3'))) { - test_class::test_func3(); -} else { - echo "test_func3 isn't callable from outside\n"; -} -if (is_callable(array('test_class','test_func4'))) { - test_class::test_func4(); -} else { - echo "test_func4 isn't callable from outside\n"; -} -$object = new foo(); -$object->test(); -?> ---EXPECTF-- -test_func1 -test_func2 -test_func3 -test_func4 -test_func1 isn't callable from outside -test_func2 isn't callable from outside -test_func3 isn't callable from outside -test_func4 isn't callable from outside -test_func1 isn't callable from child -test_func2 -test_func3 isn't callable from child -test_func4 +--TEST-- +Bug #29210 (Function is_callable does not support private and protected methods) +--FILE-- +test_func1(); + } else { + echo "test_func1 isn't callable from inside\n"; + } + if (is_callable(array($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(); + } else { + echo "test_func3 isn't callable from inside\n"; + } + if (is_callable(array('test_class','test_func4'))) { + test_class::test_func4(); + } else { + echo "test_func4 isn't callable from inside\n"; + } + } +} + +class foo extends test_class { + function test() { + if (is_callable(array($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(); + } else { + echo "test_func2 isn't callable from child\n"; + } + if (is_callable(array('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(); + } else { + echo "test_func4 isn't callable from child\n"; + } + } +} + +$object = new test_class; +$object->test(); +if (is_callable(array($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(); +} else { + echo "test_func2 isn't callable from outside\n"; +} +if (is_callable(array('test_class','test_func3'))) { + test_class::test_func3(); +} else { + echo "test_func3 isn't callable from outside\n"; +} +if (is_callable(array('test_class','test_func4'))) { + test_class::test_func4(); +} else { + echo "test_func4 isn't callable from outside\n"; +} +$object = new foo(); +$object->test(); +?> +--EXPECTF-- +test_func1 +test_func2 +test_func3 +test_func4 +test_func1 isn't callable from outside +test_func2 isn't callable from outside +test_func3 isn't callable from outside +test_func4 isn't callable from outside +test_func1 isn't callable from child +test_func2 +test_func3 isn't callable from child +test_func4 diff --git a/Zend/tests/bug29505.phpt b/Zend/tests/bug29505.phpt index 36fc6fd66..4d7c05351 100755 --- a/Zend/tests/bug29505.phpt +++ b/Zend/tests/bug29505.phpt @@ -1,31 +1,31 @@ ---TEST-- -Bug #29505 (get_class_vars() severely broken when used with arrays) ---FILE-- -"c", 3=>array()); -} - -var_dump(get_class_vars('Test')); - -?> -===DONE=== ---EXPECT-- -array(2) { - ["empty"]=> - array(0) { - } - ["three"]=> - array(3) { - [0]=> - int(1) - ["b"]=> - string(1) "c" - [3]=> - array(0) { - } - } -} -===DONE=== +--TEST-- +Bug #29505 (get_class_vars() severely broken when used with arrays) +--FILE-- +"c", 3=>array()); +} + +var_dump(get_class_vars('Test')); + +?> +===DONE=== +--EXPECT-- +array(2) { + ["empty"]=> + array(0) { + } + ["three"]=> + array(3) { + [0]=> + int(1) + ["b"]=> + string(1) "c" + [3]=> + array(0) { + } + } +} +===DONE=== diff --git a/Zend/tests/bug29890.phpt b/Zend/tests/bug29890.phpt index 17ed5afa3..32e8e1bd5 100644 --- a/Zend/tests/bug29890.phpt +++ b/Zend/tests/bug29890.phpt @@ -1,23 +1,23 @@ ---TEST-- -Bug #29890 (crash if error handler fails) ---FILE-- - ---EXPECT-- -error :Constant TEST already defined +--TEST-- +Bug #29890 (crash if error handler fails) +--FILE-- + +--EXPECT-- +error :Constant TEST already defined diff --git a/Zend/tests/bug29896.phpt b/Zend/tests/bug29896.phpt index 34d43522d..1e2eb0b06 100755 --- a/Zend/tests/bug29896.phpt +++ b/Zend/tests/bug29896.phpt @@ -1,28 +1,28 @@ ---TEST-- -Bug #29896 (Backtrace argument list out of sync) ---FILE-- - ---EXPECTF-- -#0 userErrorHandler(8, Undefined variable: b, %sbug29896.php, 11, Array ([A1] => Test1)) called at [%sbug29896.php:11] -#1 GenerateError1(Test1) called at [%sbug29896.php:16] -#2 GenerateError2(Test2) called at [%sbug29896.php:19] - +--TEST-- +Bug #29896 (Backtrace argument list out of sync) +--FILE-- + +--EXPECTF-- +#0 userErrorHandler(8, Undefined variable: b, %sbug29896.php, 11, Array ([A1] => Test1)) called at [%sbug29896.php:11] +#1 GenerateError1(Test1) called at [%sbug29896.php:16] +#2 GenerateError2(Test2) called at [%sbug29896.php:19] + diff --git a/Zend/tests/bug29944.phpt b/Zend/tests/bug29944.phpt index 2cb42ebb0..6c0cf1ec7 100644 --- a/Zend/tests/bug29944.phpt +++ b/Zend/tests/bug29944.phpt @@ -1,16 +1,16 @@ ---TEST-- -Bug #29944 (Function defined in switch, crashes) ---FILE-- - ---EXPECT-- -ok - +--TEST-- +Bug #29944 (Function defined in switch, crashes) +--FILE-- + +--EXPECT-- +ok + diff --git a/Zend/tests/bug30080.phpt b/Zend/tests/bug30080.phpt index 80a70147d..bd8401e1b 100755 --- a/Zend/tests/bug30080.phpt +++ b/Zend/tests/bug30080.phpt @@ -1,18 +1,18 @@ ---TEST-- -Bug #30080 (Passing array or non array of objects) ---FILE-- - ---EXPECT-- -array(1) { - [0]=> - object(stdClass)#2 (0) { - } -} +--TEST-- +Bug #30080 (Passing array or non array of objects) +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + object(stdClass)#2 (0) { + } +} diff --git a/Zend/tests/bug30140.phpt b/Zend/tests/bug30140.phpt index eb7f9cb37..1dfb83500 100755 --- a/Zend/tests/bug30140.phpt +++ b/Zend/tests/bug30140.phpt @@ -1,30 +1,30 @@ ---TEST-- -Bug #30140 (Problem with array in static properties) ---FILE-- - ---EXPECT-- -string(1) "x" -string(1) "y" -string(1) "z" -string(1) "x" -string(1) "y" -string(1) "z" +--TEST-- +Bug #30140 (Problem with array in static properties) +--FILE-- + +--EXPECT-- +string(1) "x" +string(1) "y" +string(1) "z" +string(1) "x" +string(1) "y" +string(1) "z" diff --git a/Zend/tests/bug30161.phpt b/Zend/tests/bug30161.phpt index e0c7060dc..22f8fb59e 100755 --- a/Zend/tests/bug30161.phpt +++ b/Zend/tests/bug30161.phpt @@ -1,34 +1,34 @@ ---TEST-- -Bug #30161 (Segmentation fault with exceptions) ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #30161 (Segmentation fault with exceptions) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug30332.phpt b/Zend/tests/bug30332.phpt deleted file mode 100644 index 873cd7d36..000000000 --- a/Zend/tests/bug30332.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Bug #30332 (zend.ze1_compatibility_mode isnt fully compatable with array_push()) ---INI-- -zend.ze1_compatibility_mode=on -error_reporting=4095 ---FILE-- -first = " im in the first"; - -print_r($first); -print_r($second); -print_r($container); -?> ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 4 - -Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 5 - -Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 7 -x Object -( - [first] => im in the first -) -x Object -( -) -Array -( - [0] => x Object - ( - ) - -) diff --git a/Zend/tests/bug30394.phpt b/Zend/tests/bug30394.phpt index a979e0796..b69eda4fe 100755 --- a/Zend/tests/bug30394.phpt +++ b/Zend/tests/bug30394.phpt @@ -1,30 +1,30 @@ ---TEST-- -Bug #30394 (Assignment operators yield wrong result with __get/__set) ---FILE-- -_p[ $what ]; - } - - public function __set( $what, $value ) - { - $this->_p[ $what ] = $value; - } - - private $_p = array(); -} - -$c = new Container(); -$c->a = 1; -$c->a += 1; -print $c->a; // --> 2 - -print " - "; -$c->a += max( 0, 1 ); -print $c->a; // --> 4 (!) -?> ---EXPECT-- -2 - 3 +--TEST-- +Bug #30394 (Assignment operators yield wrong result with __get/__set) +--FILE-- +_p[ $what ]; + } + + public function __set( $what, $value ) + { + $this->_p[ $what ] = $value; + } + + private $_p = array(); +} + +$c = new Container(); +$c->a = 1; +$c->a += 1; +print $c->a; // --> 2 + +print " - "; +$c->a += max( 0, 1 ); +print $c->a; // --> 4 (!) +?> +--EXPECT-- +2 - 3 diff --git a/Zend/tests/bug30451.phpt b/Zend/tests/bug30451.phpt index 91d51a68f..210f08757 100644 --- a/Zend/tests/bug30451.phpt +++ b/Zend/tests/bug30451.phpt @@ -1,36 +1,36 @@ ---TEST-- -Bug #30451 (static properties permissions broken) ---FILE-- - ---EXPECT-- -bool(true) -bool(true) -bool(true) -bool(true) +--TEST-- +Bug #30451 (static properties permissions broken) +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/Zend/tests/bug30519.phpt b/Zend/tests/bug30519.phpt index 0fe7b6b39..7d70cba07 100755 --- a/Zend/tests/bug30519.phpt +++ b/Zend/tests/bug30519.phpt @@ -1,10 +1,10 @@ ---TEST-- -Bug #30519 (Interface not existing says Class not found) ---FILE-- - ---EXPECTF-- -Fatal error: Interface 'a' not found in %sbug30519.php on line 2 - +--TEST-- +Bug #30519 (Interface not existing says Class not found) +--FILE-- + +--EXPECTF-- +Fatal error: Interface 'a' not found in %sbug30519.php on line 2 + diff --git a/Zend/tests/bug30702.phpt b/Zend/tests/bug30702.phpt index 90a1ee890..f23b1ecd4 100644 --- a/Zend/tests/bug30702.phpt +++ b/Zend/tests/bug30702.phpt @@ -1,39 +1,39 @@ ---TEST-- -Bug #30702 (cannot initialize class variable from class constant) ---FILE-- - ---EXPECT-- -object(bar)#1 (6) { - ["c1"]=> - int(1) - ["c2"]=> - int(2) - ["c3"]=> - int(1) - ["c4"]=> - int(2) - ["c5"]=> - int(1) - ["c6"]=> - int(1) -} +--TEST-- +Bug #30702 (cannot initialize class variable from class constant) +--FILE-- + +--EXPECT-- +object(bar)#1 (6) { + ["c1"]=> + int(1) + ["c2"]=> + int(2) + ["c3"]=> + int(1) + ["c4"]=> + int(2) + ["c5"]=> + int(1) + ["c6"]=> + int(1) +} diff --git a/Zend/tests/bug30791.phpt b/Zend/tests/bug30791.phpt index ce270c0ef..e9991f3ad 100755 --- a/Zend/tests/bug30791.phpt +++ b/Zend/tests/bug30791.phpt @@ -1,35 +1,35 @@ ---TEST-- -Bug #30791 (magic methods (__sleep/__wakeup/__toString) call __call if object is overloaded) ---FILE-- - ---EXPECT-- -string(50) "Object of class a could not be converted to string" - -string(50) "Object of class a could not be converted to string" - -object(a)#2 (1) { - ["a"]=> - int(4) -} +--TEST-- +Bug #30791 (magic methods (__sleep/__wakeup/__toString) call __call if object is overloaded) +--FILE-- + +--EXPECT-- +string(50) "Object of class a could not be converted to string" + +string(50) "Object of class a could not be converted to string" + +object(a)#2 (1) { + ["a"]=> + int(4) +} diff --git a/Zend/tests/bug30820.phpt b/Zend/tests/bug30820.phpt index 6c136a5fc..97e46e928 100755 --- a/Zend/tests/bug30820.phpt +++ b/Zend/tests/bug30820.phpt @@ -1,27 +1,27 @@ ---TEST-- -Bug #30820 (static member conflict with $this->member silently ignored) ---INI-- -error_reporting=4095 ---FILE-- -x = 5; // no warning, but refers to different variable - - echo 'Blah::$x = '. Blah::$x ."\n"; - echo '$this->x = '. $this->x ."\n"; - } -} - -$b = new Blah(); -$b->show(); -?> ---EXPECTF-- -Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 7 -Blah::$x = 1 - -Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 10 -$this->x = 5 +--TEST-- +Bug #30820 (static member conflict with $this->member silently ignored) +--INI-- +error_reporting=4095 +--FILE-- +x = 5; // no warning, but refers to different variable + + echo 'Blah::$x = '. Blah::$x ."\n"; + echo '$this->x = '. $this->x ."\n"; + } +} + +$b = new Blah(); +$b->show(); +?> +--EXPECTF-- +Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 7 +Blah::$x = 1 + +Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 10 +$this->x = 5 diff --git a/Zend/tests/bug30828.phpt b/Zend/tests/bug30828.phpt index eb003f1de..d05dbb606 100755 --- a/Zend/tests/bug30828.phpt +++ b/Zend/tests/bug30828.phpt @@ -1,61 +1,61 @@ ---TEST-- -Bug #30828 (debug_backtrace() reports incorrect class in overridden methods) ---FILE-- -foo(); -B::bar(); -?> ---EXPECTF-- -#0 A->__construct() called at [%sbug30828.php:30] -#1 B->__construct() called at [%sbug30828.php:42] -A->__construct -B->__construct -#0 A->foo() called at [%sbug30828.php:34] -#1 B->foo() called at [%sbug30828.php:43] -A->foo -B->foo -#0 A::bar() called at [%sbug30828.php:38] -#1 B::bar() called at [%sbug30828.php:44] -A::bar -B::bar +--TEST-- +Bug #30828 (debug_backtrace() reports incorrect class in overridden methods) +--FILE-- +foo(); +B::bar(); +?> +--EXPECTF-- +#0 A->__construct() called at [%sbug30828.php:30] +#1 B->__construct() called at [%sbug30828.php:42] +A->__construct +B->__construct +#0 A->foo() called at [%sbug30828.php:34] +#1 B->foo() called at [%sbug30828.php:43] +A->foo +B->foo +#0 A::bar() called at [%sbug30828.php:38] +#1 B::bar() called at [%sbug30828.php:44] +A::bar +B::bar diff --git a/Zend/tests/bug30889.phpt b/Zend/tests/bug30889.phpt index c80dbded7..fb92edfb0 100644 --- a/Zend/tests/bug30889.phpt +++ b/Zend/tests/bug30889.phpt @@ -1,31 +1,31 @@ ---TEST-- -Bug #30889 (Conflict between __get/__set and ++ operator) ---FILE-- -values = array('a' => 0); - } - function __set($name, $value) - { - print "set $name = $value ($name was ".$this->values[$name].")\n"; - $this->values[$name] = $value; - } - function __get($name) - { - print "get $name (returns ".$this->values[$name].")\n"; - return $this->values[$name]; - } -} -$test = new overloaded(); -$test->a++; // __get(), then __set() -++$test->a; -?> ---EXPECT-- -get a (returns 0) -set a = 1 (a was 0) -get a (returns 1) -set a = 2 (a was 1) +--TEST-- +Bug #30889 (Conflict between __get/__set and ++ operator) +--FILE-- +values = array('a' => 0); + } + function __set($name, $value) + { + print "set $name = $value ($name was ".$this->values[$name].")\n"; + $this->values[$name] = $value; + } + function __get($name) + { + print "get $name (returns ".$this->values[$name].")\n"; + return $this->values[$name]; + } +} +$test = new overloaded(); +$test->a++; // __get(), then __set() +++$test->a; +?> +--EXPECT-- +get a (returns 0) +set a = 1 (a was 0) +get a (returns 1) +set a = 2 (a was 1) diff --git a/Zend/tests/bug30922.phpt b/Zend/tests/bug30922.phpt index f4e437e49..8da0f2192 100644 --- a/Zend/tests/bug30922.phpt +++ b/Zend/tests/bug30922.phpt @@ -1,13 +1,13 @@ ---TEST-- -Bug #30922 (reflective functions crash PHP when interfaces extend themselves) ---FILE-- - ---EXPECTF-- -Fatal error: Interface RecurisiveFooFar cannot implement itself in %sbug30922.php on line %d +--TEST-- +Bug #30922 (reflective functions crash PHP when interfaces extend themselves) +--FILE-- + +--EXPECTF-- +Fatal error: Interface RecurisiveFooFar cannot implement itself in %sbug30922.php on line %d diff --git a/Zend/tests/bug31177-2.phpt b/Zend/tests/bug31177-2.phpt index a2d922c91..10083c59e 100755 --- a/Zend/tests/bug31177-2.phpt +++ b/Zend/tests/bug31177-2.phpt @@ -1,18 +1,18 @@ ---TEST-- -Bug #31177 (memory corruption because of incorrect refcounting) ---FILE-- -foo(1); -} catch (Exception $e) { - var_dump($x); -} ---EXPECT-- -object(foo)#1 (0) { -} +--TEST-- +Bug #31177 (memory corruption because of incorrect refcounting) +--FILE-- +foo(1); +} catch (Exception $e) { + var_dump($x); +} +--EXPECT-- +object(foo)#1 (0) { +} diff --git a/Zend/tests/bug31177.phpt b/Zend/tests/bug31177.phpt index ac0fd7289..5e8457362 100755 --- a/Zend/tests/bug31177.phpt +++ b/Zend/tests/bug31177.phpt @@ -1,44 +1,44 @@ ---TEST-- -Bug #31177 (Memory leak) ---FILE-- -query()); - } - - public function select2() { - new DbGowRecordSet($this->query()); - } - -} - -class DbGowRecordSet { - - public function __construct($resource) { - } - -} - -$db = new DbGow; - -try { - $rs = $db->select(); -} catch(Exception $e) { - echo "ok\n"; -} - -try { - $db->select2(); -} catch(Exception $e) { - echo "ok\n"; -} -?> ---EXPECT-- -ok -ok +--TEST-- +Bug #31177 (Memory leak) +--FILE-- +query()); + } + + public function select2() { + new DbGowRecordSet($this->query()); + } + +} + +class DbGowRecordSet { + + public function __construct($resource) { + } + +} + +$db = new DbGow; + +try { + $rs = $db->select(); +} catch(Exception $e) { + echo "ok\n"; +} + +try { + $db->select2(); +} catch(Exception $e) { + echo "ok\n"; +} +?> +--EXPECT-- +ok +ok diff --git a/Zend/tests/bug31525.phpt b/Zend/tests/bug31525.phpt index 9c1c846ce..b1a01b61e 100755 --- a/Zend/tests/bug31525.phpt +++ b/Zend/tests/bug31525.phpt @@ -1,22 +1,22 @@ ---TEST-- -Bug #31525 (object reference being dropped. $this getting lost) ---INI-- -error_reporting=4095 ---FILE-- -getThis(); - } -} -$bar = new Foo(); -$bar->destroyThis(); -var_dump($bar); -?> ---EXPECTF-- -Strict Standards: Only variables should be assigned by reference in %sbug31525.php on line 7 -object(Foo)#1 (0) { -} +--TEST-- +Bug #31525 (object reference being dropped. $this getting lost) +--INI-- +error_reporting=4095 +--FILE-- +getThis(); + } +} +$bar = new Foo(); +$bar->destroyThis(); +var_dump($bar); +?> +--EXPECTF-- +Strict Standards: Only variables should be assigned by reference in %sbug31525.php on line 7 +object(Foo)#1 (0) { +} diff --git a/Zend/tests/bug31720.phpt b/Zend/tests/bug31720.phpt index 3d62ac34e..c4680a478 100644 --- a/Zend/tests/bug31720.phpt +++ b/Zend/tests/bug31720.phpt @@ -10,7 +10,5 @@ array_walk($array, array($nonesuchvar,'show')); --EXPECTF-- Notice: Undefined variable: nonesuchvar in %s on line %d -Notice: Non-callable array passed to zend_call_function() in %s on line %d - -Warning: array_walk(): Unable to call Array() - function does not exist 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=== diff --git a/Zend/tests/bug31828.phpt b/Zend/tests/bug31828.phpt deleted file mode 100644 index e5c004fba..000000000 --- a/Zend/tests/bug31828.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #31828 (Crash with zend.ze1_compatibility_mode=On) ---INI-- -zend.ze1_compatibility_mode=on -error_reporting=4095 ---FILE-- -id = 77; -$o->name = "Aerospace"; -$a[] = $o; -$a = $a[0]; -print_r($a); -?> ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 2 - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 5 - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 6 -stdClass Object -( - [id] => 77 - [name] => Aerospace -) diff --git a/Zend/tests/bug32080.phpt b/Zend/tests/bug32080.phpt deleted file mode 100644 index c7227b4f5..000000000 --- a/Zend/tests/bug32080.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug #32080 (segfault when assigning object to itself with zend.ze1_compatibility_mode=On) ---INI-- -zend.ze1_compatibility_mode=on -error_reporting=4095 ---FILE-- - ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'test' because of 'zend.ze1_compatibility_mode' in %sbug32080.php on line 3 - -Strict Standards: Implicit cloning object of class 'test' because of 'zend.ze1_compatibility_mode' in %sbug32080.php on line 5 -object(test)#%d (0) { -} diff --git a/Zend/tests/bug32290.phpt b/Zend/tests/bug32290.phpt index c03808377..89da67b19 100755 --- a/Zend/tests/bug32290.phpt +++ b/Zend/tests/bug32290.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #32290 (calling call_user_func_array() ends in infinite loop within child class) +--INI-- +error_reporting=8191 --FILE-- doSomethingStatic(1)); --EXPECTF-- ===A=== TestB::doSomething(1) - -Strict Standards: Non-static method TestA::doSomething() cannot be called statically, assuming $this from compatible context TestB in %sbug32290.php on line %d TestA::doSomething(2) int(1) @@ -109,8 +109,6 @@ int(1) ===C=== TestB::doSomethingParent(1) - -Strict Standards: Non-static method TestA::doSomethingParent() cannot be called statically, assuming $this from compatible context TestB in %sbug32290.php on line %d TestA::doSomethingParent(2) int(1) diff --git a/Zend/tests/bug32296.phpt b/Zend/tests/bug32296.phpt index d2e6d0ca3..b3e705ec1 100755 --- a/Zend/tests/bug32296.phpt +++ b/Zend/tests/bug32296.phpt @@ -1,60 +1,60 @@ ---TEST-- -Bug #32296 (get_class_methods output has changed between 5.0.2 and 5.0.3) ---FILE-- -buggy(); -print_r(get_class_methods("square")); -print_r(get_class_methods($a)); -?> ---EXPECT-- -square -a:Array -( - [0] => x2 - [1] => buggy - [2] => unfold - [3] => __construct -) -b:Array -( - [0] => x2 - [1] => buggy - [2] => unfold - [3] => __construct -) -Array -( - [0] => buggy - [1] => __construct -) -Array -( - [0] => buggy - [1] => __construct -) +--TEST-- +Bug #32296 (get_class_methods output has changed between 5.0.2 and 5.0.3) +--FILE-- +buggy(); +print_r(get_class_methods("square")); +print_r(get_class_methods($a)); +?> +--EXPECT-- +square +a:Array +( + [0] => x2 + [1] => buggy + [2] => unfold + [3] => __construct +) +b:Array +( + [0] => x2 + [1] => buggy + [2] => unfold + [3] => __construct +) +Array +( + [0] => buggy + [1] => __construct +) +Array +( + [0] => buggy + [1] => __construct +) diff --git a/Zend/tests/bug32322.phpt b/Zend/tests/bug32322.phpt index fd79a0482..f69c5259e 100755 --- a/Zend/tests/bug32322.phpt +++ b/Zend/tests/bug32322.phpt @@ -1,80 +1,80 @@ ---TEST-- -Bug #32322 (Return values by reference broken( using self::),example singleton instance) ---INI-- -error_reporting=4095 ---FILE-- - myname = $value; - } - private function __clone() {} - static public function getInstance() - { - if ( self::$instance == null ) - { - self::$instance = new test('Singleton1'); - } - else { - echo "Using old class " . self::$instance -> myname . "\n"; - } - return self::$instance; - } - static public function getInstance2() - { - static $instance2 = null; - if ( $instance2 == null ) - { - $instance2 = new test('Singleton2'); - } - else { - echo "Using old class " . $instance2 -> myname . "\n"; - } - return $instance2; - } - public function __destruct() - { - if ( defined('SCRIPT_END') ) - { - echo "Class " . $this -> myname . " destroyed at script end\n"; - } else { - echo "Class " . $this -> myname . " destroyed beforce script end\n"; - } - } -} -echo "Try static instance inside class :\n"; -$getCopyofSingleton = test::getInstance(); -$getCopyofSingleton = null; -$getCopyofSingleton = &test::getInstance(); -$getCopyofSingleton = null; -$getCopyofSingleton = test::getInstance(); -echo "Try static instance inside function :\n"; -$getCopyofSingleton2 = test::getInstance2(); -$getCopyofSingleton2 = null; -$getCopyofSingleton2 = &test::getInstance2(); -$getCopyofSingleton2 = null; -$getCopyofSingleton2 = test::getInstance2(); - -define('SCRIPT_END',1); -?> ---EXPECTF-- -Try static instance inside class : -New class Singleton1 created -Using old class Singleton1 - -Strict Standards: Only variables should be assigned by reference in %sbug32322.php on line 49 -Using old class Singleton1 -Try static instance inside function : -New class Singleton2 created -Using old class Singleton2 - -Strict Standards: Only variables should be assigned by reference in %sbug32322.php on line 55 -Using old class Singleton2 -Class Singleton1 destroyed at script end -Class Singleton2 destroyed at script end +--TEST-- +Bug #32322 (Return values by reference broken( using self::),example singleton instance) +--INI-- +error_reporting=4095 +--FILE-- + myname = $value; + } + private function __clone() {} + static public function getInstance() + { + if ( self::$instance == null ) + { + self::$instance = new test('Singleton1'); + } + else { + echo "Using old class " . self::$instance -> myname . "\n"; + } + return self::$instance; + } + static public function getInstance2() + { + static $instance2 = null; + if ( $instance2 == null ) + { + $instance2 = new test('Singleton2'); + } + else { + echo "Using old class " . $instance2 -> myname . "\n"; + } + return $instance2; + } + public function __destruct() + { + if ( defined('SCRIPT_END') ) + { + echo "Class " . $this -> myname . " destroyed at script end\n"; + } else { + echo "Class " . $this -> myname . " destroyed beforce script end\n"; + } + } +} +echo "Try static instance inside class :\n"; +$getCopyofSingleton = test::getInstance(); +$getCopyofSingleton = null; +$getCopyofSingleton = &test::getInstance(); +$getCopyofSingleton = null; +$getCopyofSingleton = test::getInstance(); +echo "Try static instance inside function :\n"; +$getCopyofSingleton2 = test::getInstance2(); +$getCopyofSingleton2 = null; +$getCopyofSingleton2 = &test::getInstance2(); +$getCopyofSingleton2 = null; +$getCopyofSingleton2 = test::getInstance2(); + +define('SCRIPT_END',1); +?> +--EXPECTF-- +Try static instance inside class : +New class Singleton1 created +Using old class Singleton1 + +Strict Standards: Only variables should be assigned by reference in %sbug32322.php on line 49 +Using old class Singleton1 +Try static instance inside function : +New class Singleton2 created +Using old class Singleton2 + +Strict Standards: Only variables should be assigned by reference in %sbug32322.php on line 55 +Using old class Singleton2 +Class Singleton1 destroyed at script end +Class Singleton2 destroyed at script end diff --git a/Zend/tests/bug32427.phpt b/Zend/tests/bug32427.phpt index b7b478dc8..9b2d81865 100644 --- a/Zend/tests/bug32427.phpt +++ b/Zend/tests/bug32427.phpt @@ -1,19 +1,19 @@ ---TEST-- -Bug #32427 (Interfaces are not allowed 'static' access modifier) ---FILE-- - ---EXPECT-- -I am a silly error +--TEST-- +Bug #32427 (Interfaces are not allowed 'static' access modifier) +--FILE-- + +--EXPECT-- +I am a silly error diff --git a/Zend/tests/bug32428.phpt b/Zend/tests/bug32428.phpt index 3812d4382..0b5ca6aeb 100755 --- a/Zend/tests/bug32428.phpt +++ b/Zend/tests/bug32428.phpt @@ -1,13 +1,13 @@ ---TEST-- -Bug #32428 (The @ warning error supression operator is broken) ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #32428 (The @ warning error supression operator is broken) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug32596.phpt b/Zend/tests/bug32596.phpt index 35dcda7b3..2dd0cfe9f 100755 --- a/Zend/tests/bug32596.phpt +++ b/Zend/tests/bug32596.phpt @@ -1,27 +1,27 @@ ---TEST-- -Bug #32596 (Segfault/Memory Leak by getClass (etc) in __destruct) ---FILE-- -error; - } -} - - -BUG::instance()->error; -echo "this is still executed\n"; -?> ---EXPECT-- -BUG -please fix this thing, it wasted a nice part of my life! -this is still executed - +--TEST-- +Bug #32596 (Segfault/Memory Leak by getClass (etc) in __destruct) +--FILE-- +error; + } +} + + +BUG::instance()->error; +echo "this is still executed\n"; +?> +--EXPECT-- +BUG +please fix this thing, it wasted a nice part of my life! +this is still executed + diff --git a/Zend/tests/bug32660.phpt b/Zend/tests/bug32660.phpt index 5e28df4d1..3a307189a 100755 --- a/Zend/tests/bug32660.phpt +++ b/Zend/tests/bug32660.phpt @@ -1,39 +1,39 @@ ---TEST-- -Bug #32660 (Assignment by reference causes crash when field access is overloaded (__get)) ---FILE-- -q = 3;//array(); - } - - function __get($name) - { - return $this->q; - } -} - -$a = new A; - -$b = "short"; -$c =& $a->whatever; -$c = "long"; -print_r($a); -$a->whatever =& $b; -$b = "much longer"; -print_r($a); -?> ---EXPECTF-- -Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 20 -A Object -( - [q] => 3 -) - -Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 23 - -Fatal error: Cannot assign by reference to overloaded object in %sbug32660.php on line 23 +--TEST-- +Bug #32660 (Assignment by reference causes crash when field access is overloaded (__get)) +--FILE-- +q = 3;//array(); + } + + function __get($name) + { + return $this->q; + } +} + +$a = new A; + +$b = "short"; +$c =& $a->whatever; +$c = "long"; +print_r($a); +$a->whatever =& $b; +$b = "much longer"; +print_r($a); +?> +--EXPECTF-- +Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 20 +A Object +( + [q] => 3 +) + +Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 23 + +Fatal error: Cannot assign by reference to overloaded object in %sbug32660.php on line 23 diff --git a/Zend/tests/bug32674.phpt b/Zend/tests/bug32674.phpt index f986132a1..771270f93 100644 --- a/Zend/tests/bug32674.phpt +++ b/Zend/tests/bug32674.phpt @@ -1,62 +1,62 @@ ---TEST-- -Bug #32674 (exception in iterator causes crash) ---FILE-- -_elements); - } - - public function count() { - return count($this->_elements); - } - - public function current() { - $element = current($this->_elements); - return $element; - } - - public function next() { - $element = next($this->_elements); - return $element; - } - - public function key() { - $this->_fillCollection(); - $element = key($this->_elements); - return $element; - } - - public function valid() { - throw new Exception('shit happend'); - - return ($this->current() !== false); - } -} - -class class2 { - public $dummy; -} - -$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'; -} catch (Exception $e) { - echo "ok\n"; -} -?> ---EXPECT-- -ok +--TEST-- +Bug #32674 (exception in iterator causes crash) +--FILE-- +_elements); + } + + public function count() { + return count($this->_elements); + } + + public function current() { + $element = current($this->_elements); + return $element; + } + + public function next() { + $element = next($this->_elements); + return $element; + } + + public function key() { + $this->_fillCollection(); + $element = key($this->_elements); + return $element; + } + + public function valid() { + throw new Exception('shit happend'); + + return ($this->current() !== false); + } +} + +class class2 { + public $dummy; +} + +$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'; +} catch (Exception $e) { + echo "ok\n"; +} +?> +--EXPECT-- +ok diff --git a/Zend/tests/bug32799.phpt b/Zend/tests/bug32799.phpt index 12bffd4a4..c76daedde 100755 --- a/Zend/tests/bug32799.phpt +++ b/Zend/tests/bug32799.phpt @@ -1,21 +1,21 @@ ---TEST-- -Bug #32799 (crash: calling the corresponding global var during the destruct) ---FILE-- -c++; // no warning - print $GLOBALS['p']->c."\n"; // segfault - var_dump($GLOBALS['p']); - } -} -$p=new test; -$p=null; //destroy the object by a new assignment (segfault) -?> ---EXPECT-- -2 -object(test)#1 (1) { - ["c"]=> - int(2) -} +--TEST-- +Bug #32799 (crash: calling the corresponding global var during the destruct) +--FILE-- +c++; // no warning + print $GLOBALS['p']->c."\n"; // segfault + var_dump($GLOBALS['p']); + } + } +} +$p=new test; +$p=null; //destroy the object by a new assignment (segfault) +?> +--EXPECT-- +NULL diff --git a/Zend/tests/bug32833.phpt b/Zend/tests/bug32833.phpt index b8a8bbe1b..e58c8453d 100644 --- a/Zend/tests/bug32833.phpt +++ b/Zend/tests/bug32833.phpt @@ -1,10 +1,10 @@ ---TEST-- -Bug #32833 (Invalid opcode with $a[] .= '') ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #32833 (Invalid opcode with $a[] .= '') +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug32852.phpt b/Zend/tests/bug32852.phpt deleted file mode 100644 index 8b44bdcdf..000000000 --- a/Zend/tests/bug32852.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Bug #32852 (Crash with singleton and __destruct when zend.ze1_compatibility_mode = On) ---INI-- -zend.ze1_compatibility_mode=on -error_reporting=4095 ---FILE-- - ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 6 -i'm called - -Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 15 -i'm called - -Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 17 -i'm called -i'm called diff --git a/Zend/tests/bug32993.phpt b/Zend/tests/bug32993.phpt index 86d8e266f..88fb0230b 100755 --- a/Zend/tests/bug32993.phpt +++ b/Zend/tests/bug32993.phpt @@ -1,29 +1,29 @@ ---TEST-- -Bug #32993 (implemented Iterator function current() don't throw exception) ---FILE-- -arr); } - public function current() { throw new Exception(); } - public function key() { return key($this->arr); } - public function next() { return next($this->arr); } - public function valid() { return (current($this->arr) !== false); } -} - -$t = new Test(); -$t->arr = array(1, 2, 3); - -try { - foreach ($t as $v) { - echo "$v\n"; - } -} catch (Exception $e) { - ; // handle exception -} -echo "ok\n"; -?> ---EXPECT-- -ok +--TEST-- +Bug #32993 (implemented Iterator function current() don't throw exception) +--FILE-- +arr); } + public function current() { throw new Exception(); } + public function key() { return key($this->arr); } + public function next() { return next($this->arr); } + public function valid() { return (current($this->arr) !== false); } +} + +$t = new Test(); +$t->arr = array(1, 2, 3); + +try { + foreach ($t as $v) { + echo "$v\n"; + } +} catch (Exception $e) { + ; // handle exception +} +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/Zend/tests/bug33116.phpt b/Zend/tests/bug33116.phpt index 641f4bb99..aa714a1f8 100755 --- a/Zend/tests/bug33116.phpt +++ b/Zend/tests/bug33116.phpt @@ -1,22 +1,22 @@ ---TEST-- -Bug #33116 (crash when assigning class name to global variable in __autoload) ---FILE-- - ---EXPECT-- -DefClass Object -( -) -Array -( - [0] => DefClass -) +--TEST-- +Bug #33116 (crash when assigning class name to global variable in __autoload) +--FILE-- + +--EXPECT-- +DefClass Object +( +) +Array +( + [0] => DefClass +) diff --git a/Zend/tests/bug33171.phpt b/Zend/tests/bug33171.phpt index 8cc44a27a..27f5264ba 100755 --- a/Zend/tests/bug33171.phpt +++ b/Zend/tests/bug33171.phpt @@ -1,27 +1,27 @@ ---TEST-- -Bug #33171 (foreach enumerates private fields declared in base classes) ---FILE-- - $val) - { - echo "$key => $val\n"; - } - } -}; - -$x = new B; -$x->go(); -?> ---EXPECT-- -c => B's c +--TEST-- +Bug #33171 (foreach enumerates private fields declared in base classes) +--FILE-- + $val) + { + echo "$key => $val\n"; + } + } +}; + +$x = new B; +$x->go(); +?> +--EXPECT-- +c => B's c diff --git a/Zend/tests/bug33243.phpt b/Zend/tests/bug33243.phpt deleted file mode 100755 index 9b5b39dec..000000000 --- a/Zend/tests/bug33243.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #33243 (ze1_compatibility_mode does not work as expected) ---INI-- -zend.ze1_compatibility_mode=1 -error_reporting=4095 ---FILE-- -y->z = 0; -$b = $a; // should perform deep copy of $a -$b->y->z = 1; // hence this should have no effect on $a -var_dump($a); -?> ---EXPECTF-- -Strict Standards: Creating default object from empty value in %sbug33243.php on line 2 - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug33243.php on line 3 - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug33243.php on line 5 -object(stdClass)#%d (1) { - ["y"]=> - object(stdClass)#%d (1) { - ["z"]=> - int(0) - } -} diff --git a/Zend/tests/bug33257.phpt b/Zend/tests/bug33257.phpt index 5c5061bb0..c17ddfd17 100755 --- a/Zend/tests/bug33257.phpt +++ b/Zend/tests/bug33257.phpt @@ -1,25 +1,25 @@ ---TEST-- -Bug #33257 (array_splice() inconsistent when passed function instead of variable) ---INI-- -error_reporting=4095 ---FILE-- - ---EXPECTF-- -Strict Standards: Only variables should be passed by reference in %sbug33257.php on line 10 -Array -( - [0] => a - [1] => b - [2] => c -) +--TEST-- +Bug #33257 (array_splice() inconsistent when passed function instead of variable) +--INI-- +error_reporting=4095 +--FILE-- + +--EXPECTF-- +Strict Standards: Only variables should be passed by reference in %sbug33257.php on line 10 +Array +( + [0] => a + [1] => b + [2] => c +) diff --git a/Zend/tests/bug33277.phpt b/Zend/tests/bug33277.phpt index b653e43f2..859c44963 100644 --- a/Zend/tests/bug33277.phpt +++ b/Zend/tests/bug33277.phpt @@ -1,28 +1,28 @@ ---TEST-- -Bug #33277 (private method accessed by child class) ---FILE-- -bar(); - } -} - -class foo2son extends fooson { - - function bar() { - echo "public!\n"; - } -} - -$b = new foo2son(); -$b->barson(); -?> ---EXPECT-- -public! +--TEST-- +Bug #33277 (private method accessed by child class) +--FILE-- +bar(); + } +} + +class foo2son extends fooson { + + function bar() { + echo "public!\n"; + } +} + +$b = new foo2son(); +$b->barson(); +?> +--EXPECT-- +public! diff --git a/Zend/tests/bug33318.phpt b/Zend/tests/bug33318.phpt index 262627b74..dc1afbb15 100755 --- a/Zend/tests/bug33318.phpt +++ b/Zend/tests/bug33318.phpt @@ -1,8 +1,8 @@ ---TEST-- -Bug #33318 (throw 1; results in Invalid opcode 108/1/8) ---FILE-- - ---EXPECTF-- +--TEST-- +Bug #33318 (throw 1; results in Invalid opcode 108/1/8) +--FILE-- + +--EXPECTF-- Fatal error: Can only throw objects in %sbug33318.php on line 2 \ No newline at end of file diff --git a/Zend/tests/bug33558.phpt b/Zend/tests/bug33558.phpt index 15ac4a26a..9c87fc601 100755 --- a/Zend/tests/bug33558.phpt +++ b/Zend/tests/bug33558.phpt @@ -1,21 +1,21 @@ ---TEST-- -Bug #33558 (warning with nested calls to functions returning by reference) ---INI-- -error_reporting=4095 ---FILE-- - ---EXPECT-- -ok - +--TEST-- +Bug #33558 (warning with nested calls to functions returning by reference) +--INI-- +error_reporting=4095 +--FILE-- + +--EXPECT-- +ok + diff --git a/Zend/tests/bug33732.phpt b/Zend/tests/bug33732.phpt index e723c2064..4969791fa 100755 --- a/Zend/tests/bug33732.phpt +++ b/Zend/tests/bug33732.phpt @@ -1,45 +1,45 @@ ---TEST-- -Bug #33732 (Wrong behavior of constants in class and interface extending) ---FILE-- - ---EXPECT-- -const of iA -const of iA -const of iA -const of iA2 -const of iA2 -const of iA2 -const of iA2 +--TEST-- +Bug #33732 (Wrong behavior of constants in class and interface extending) +--FILE-- + +--EXPECT-- +const of iA +const of iA +const of iA +const of iA2 +const of iA2 +const of iA2 +const of iA2 diff --git a/Zend/tests/bug33771.phpt b/Zend/tests/bug33771.phpt index a786e5806..72d953c9f 100644 --- a/Zend/tests/bug33771.phpt +++ b/Zend/tests/bug33771.phpt @@ -34,7 +34,7 @@ var_dump(error_reporting()); echo "Done\n"; ?> --EXPECTF-- -int(8191) -int(8191) -int(6143) +int(32767) +int(32767) +int(30719) Done diff --git a/Zend/tests/bug33996.phpt b/Zend/tests/bug33996.phpt index e1677ce78..e722eceaf 100755 --- a/Zend/tests/bug33996.phpt +++ b/Zend/tests/bug33996.phpt @@ -1,29 +1,29 @@ ---TEST-- -Bug #33996 (No information given for fatal error on passing invalid value to typed argument) ---INI-- -error_reporting=8191 ---FILE-- - ---EXPECTF-- -Warning: Missing argument 1 for NormalTest(), called in %sbug33996.php on line %d and defined in %sbug33996.php on line %d -Hi! -Catchable fatal error: Argument 1 passed to FooTest() must be an instance of Foo, none given, called in %sbug33996.php on line %d and defined in %sbug33996.php on line %d +--TEST-- +Bug #33996 (No information given for fatal error on passing invalid value to typed argument) +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Warning: Missing argument 1 for NormalTest(), called in %sbug33996.php on line %d and defined in %sbug33996.php on line %d +Hi! +Catchable fatal error: Argument 1 passed to FooTest() must be an instance of Foo, none given, called in %sbug33996.php on line %d and defined in %sbug33996.php on line %d diff --git a/Zend/tests/bug33999.phpt b/Zend/tests/bug33999.phpt index cbc636052..194628071 100755 --- a/Zend/tests/bug33999.phpt +++ b/Zend/tests/bug33999.phpt @@ -1,30 +1,30 @@ ---TEST-- -Bug #33999 (object remains object when cast to int) ---INI-- -error_reporting=4095 ---FILE-- - ---EXPECTF-- -object(Foo)#1 (1) { - ["bar"]=> - string(3) "bat" -} - -Notice: Object of class Foo could not be converted to int in %sbug33999.php on line 9 -int(1) - -Notice: Object of class Foo could not be converted to double in %sbug33999.php on line 12 -float(1) +--TEST-- +Bug #33999 (object remains object when cast to int) +--INI-- +error_reporting=4095 +--FILE-- + +--EXPECTF-- +object(Foo)#1 (1) { + ["bar"]=> + string(3) "bat" +} + +Notice: Object of class Foo could not be converted to int in %sbug33999.php on line 9 +int(1) + +Notice: Object of class Foo could not be converted to double in %sbug33999.php on line 12 +float(1) diff --git a/Zend/tests/bug34064.phpt b/Zend/tests/bug34064.phpt index 22ddb89c5..84208a54f 100755 --- a/Zend/tests/bug34064.phpt +++ b/Zend/tests/bug34064.phpt @@ -1,35 +1,35 @@ ---TEST-- -Bug #34064 (arr[] as param to function in class gives invalid opcode) ---FILE-- -test_ref($ar[]); - var_dump($ar); - $this->test($ar[]); - } -} - -$o = new XmlTest(); -$o->run(); -?> ---EXPECTF-- -array(1) { - [0]=> - string(2) "ok" -} - -Fatal error: Cannot use [] for reading in %sbug34064.php on line 18 - +--TEST-- +Bug #34064 (arr[] as param to function in class gives invalid opcode) +--FILE-- +test_ref($ar[]); + var_dump($ar); + $this->test($ar[]); + } +} + +$o = new XmlTest(); +$o->run(); +?> +--EXPECTF-- +array(1) { + [0]=> + string(2) "ok" +} + +Fatal error: Cannot use [] for reading in %sbug34064.php on line 18 + diff --git a/Zend/tests/bug34065.phpt b/Zend/tests/bug34065.phpt index 9f6e00e61..9d76fca64 100755 --- a/Zend/tests/bug34065.phpt +++ b/Zend/tests/bug34065.phpt @@ -1,15 +1,15 @@ ---TEST-- -Bug #34065 (throw in foreach causes memory leaks) ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #34065 (throw in foreach causes memory leaks) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug34137.phpt b/Zend/tests/bug34137.phpt index 4e0a09ffa..585633333 100755 --- a/Zend/tests/bug34137.phpt +++ b/Zend/tests/bug34137.phpt @@ -1,10 +1,10 @@ ---TEST-- -Bug #34137 (assigning array element by reference causes binary mess) ---FILE-- - array('alfa' => 'ok')); -$arr1 =& $arr1['a1']; -echo '-'.$arr1['alfa']."-\n"; -?> ---EXPECT-- --ok- +--TEST-- +Bug #34137 (assigning array element by reference causes binary mess) +--FILE-- + array('alfa' => 'ok')); +$arr1 =& $arr1['a1']; +echo '-'.$arr1['alfa']."-\n"; +?> +--EXPECT-- +-ok- diff --git a/Zend/tests/bug34260.phpt b/Zend/tests/bug34260.phpt index 4a5920854..fa393d065 100755 --- a/Zend/tests/bug34260.phpt +++ b/Zend/tests/bug34260.phpt @@ -1,36 +1,36 @@ ---TEST-- -Bug #34260 (Segfault with callbacks (array_map) + overloading) ---FILE-- - ---EXPECT-- -I hate me -I hate me -I heart me -I heart me +--TEST-- +Bug #34260 (Segfault with callbacks (array_map) + overloading) +--FILE-- + +--EXPECT-- +I hate me +I hate me +I heart me +I heart me diff --git a/Zend/tests/bug34467.phpt b/Zend/tests/bug34467.phpt index 39862ada0..5f0ccafc4 100755 --- a/Zend/tests/bug34467.phpt +++ b/Zend/tests/bug34467.phpt @@ -1,27 +1,27 @@ ---TEST-- -Bug #34467 (foreach + __get + __set incosistency) ---FILE-- -arr[$key] = $value; - } - - 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); -} -?> ---EXPECT-- -int(0) -int(1) -int(1) -int(2) -int(2) -int(3) +--TEST-- +Bug #34467 (foreach + __get + __set incosistency) +--FILE-- +arr[$key] = $value; + } + + 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); +} +?> +--EXPECT-- +int(0) +int(1) +int(1) +int(2) +int(2) +int(3) diff --git a/Zend/tests/bug34518.phpt b/Zend/tests/bug34518.phpt index 1971fcb72..b94fdf498 100755 --- a/Zend/tests/bug34518.phpt +++ b/Zend/tests/bug34518.phpt @@ -1,38 +1,38 @@ ---TEST-- -Bug #34518 (Unset doesn't separate container in CV) ---FILE-- - ---EXPECT-- -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [foo] => Array - ( - [0] => 4 - [1] => 5 - [2] => 6 - ) - -) -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [foo] => Array - ( - [1] => 5 - [2] => 6 - ) - -) +--TEST-- +Bug #34518 (Unset doesn't separate container in CV) +--FILE-- + +--EXPECT-- +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [foo] => Array + ( + [0] => 4 + [1] => 5 + [2] => 6 + ) + +) +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [foo] => Array + ( + [1] => 5 + [2] => 6 + ) + +) diff --git a/Zend/tests/bug34617.phpt b/Zend/tests/bug34617.phpt index 826ff1000..25f785f90 100755 --- a/Zend/tests/bug34617.phpt +++ b/Zend/tests/bug34617.phpt @@ -1,18 +1,18 @@ ---TEST-- -Bug #34617 (zend_deactivate: objects_store used after zend_objects_store_destroy is called) ---SKIPIF-- - ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #34617 (zend_deactivate: objects_store used after zend_objects_store_destroy is called) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug34712.phpt b/Zend/tests/bug34712.phpt deleted file mode 100755 index d280c26f4..000000000 --- a/Zend/tests/bug34712.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #34712 (zend.ze1_compatibility_mode = on segfault) ---INI-- -zend.ze1_compatibility_mode=1 -error_reporting=4095 ---FILE-- -bar = &$obj_ref; - } -} - - -class bar { - function bar() { - $this->foo = new foo($this); - } -} - -$test = new bar; -echo "ok\n"; -?> ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'foo' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 11 - -Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 15 -ok diff --git a/Zend/tests/bug34767.phpt b/Zend/tests/bug34767.phpt deleted file mode 100755 index c81b44bee..000000000 --- a/Zend/tests/bug34767.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Bug #34767 (Zend Engine 1 Compatibility not copying objects correctly) ---INI-- -zend.ze1_compatibility_mode=1 -error_reporting=4095 ---FILE-- -y = &new stdClass(); -print_r($a); -$b = $a; -$a->y->z = 1; -print_r($b); -?> ---EXPECTF-- - -Strict Standards: Assigning the return value of new by reference is deprecated in %sbug34767.php on line 2 -stdClass Object -( - [y] => stdClass Object - ( - ) - -) - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug34767.php on line 4 -stdClass Object -( - [y] => stdClass Object - ( - [z] => 1 - ) - -) diff --git a/Zend/tests/bug34786.phpt b/Zend/tests/bug34786.phpt index 516e18ff2..18642848d 100755 --- a/Zend/tests/bug34786.phpt +++ b/Zend/tests/bug34786.phpt @@ -1,22 +1,22 @@ ---TEST-- -Bug #34786 (2 @ results in change to error_reporting() to random value) ---FILE-- - ---EXPECT-- -before: 1 -bar: 0 -foo: 0 -after: 1 +--TEST-- +Bug #34786 (2 @ results in change to error_reporting() to random value) +--FILE-- + +--EXPECT-- +before: 1 +bar: 0 +foo: 0 +after: 1 diff --git a/Zend/tests/bug34879.phpt b/Zend/tests/bug34879.phpt index 6b591002a..606142bde 100755 --- a/Zend/tests/bug34879.phpt +++ b/Zend/tests/bug34879.phpt @@ -1,11 +1,11 @@ ---TEST-- -Bug #34879 (str_replace, array_map corrupt negative array indexes on 64-bit platforms) ---FILE-- --1))); -?> ---EXPECT-- -Array -( - [-1] => -1 +--TEST-- +Bug #34879 (str_replace, array_map corrupt negative array indexes on 64-bit platforms) +--FILE-- +-1))); +?> +--EXPECT-- +Array +( + [-1] => -1 ) \ No newline at end of file diff --git a/Zend/tests/bug34893.phpt b/Zend/tests/bug34893.phpt index c117686ec..bbe02358e 100755 --- a/Zend/tests/bug34893.phpt +++ b/Zend/tests/bug34893.phpt @@ -1,33 +1,33 @@ ---TEST-- -Bug #34893 (PHP5.1 overloading, Cannot access private property) ---FILE-- -$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; - } -} -$a = new A; -$b = new B; -$a->p = $b; -$b->t = "foo"; - -echo $a->p->t; -$a->p->t = "bar"; -echo $a->p->t; -?> ---EXPECT-- -foobar +--TEST-- +Bug #34893 (PHP5.1 overloading, Cannot access private property) +--FILE-- +$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; + } +} +$a = new A; +$b = new B; +$a->p = $b; +$b->t = "foo"; + +echo $a->p->t; +$a->p->t = "bar"; +echo $a->p->t; +?> +--EXPECT-- +foobar diff --git a/Zend/tests/bug35017.phpt b/Zend/tests/bug35017.phpt index b138b7fdb..0a89d23aa 100755 --- a/Zend/tests/bug35017.phpt +++ b/Zend/tests/bug35017.phpt @@ -1,21 +1,21 @@ ---TEST-- -Bug #35017 (Exception thrown in error handler may cause unexpected behavior) ---FILE-- - ---EXPECT-- -This Exception should be catched +--TEST-- +Bug #35017 (Exception thrown in error handler may cause unexpected behavior) +--FILE-- + +--EXPECT-- +This Exception should be catched diff --git a/Zend/tests/bug35106.phpt b/Zend/tests/bug35106.phpt index a3f166cd5..61a66d014 100755 --- a/Zend/tests/bug35106.phpt +++ b/Zend/tests/bug35106.phpt @@ -1,14 +1,14 @@ ---TEST-- -Bug #35106 (nested foreach fails when array variable has a reference) ---FILE-- - ---EXPECT-- -12 +--TEST-- +Bug #35106 (nested foreach fails when array variable has a reference) +--FILE-- + +--EXPECT-- +12 diff --git a/Zend/tests/bug35163.phpt b/Zend/tests/bug35163.phpt new file mode 100755 index 000000000..4501fa937 --- /dev/null +++ b/Zend/tests/bug35163.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #35163 (Array elements can lose references) +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + &array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +} diff --git a/Zend/tests/bug35163_2.phpt b/Zend/tests/bug35163_2.phpt new file mode 100755 index 000000000..4adf7709a --- /dev/null +++ b/Zend/tests/bug35163_2.phpt @@ -0,0 +1,65 @@ +--TEST-- +Bug #35163.2 (Array elements can lose references) +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +} + diff --git a/Zend/tests/bug35163_3.phpt b/Zend/tests/bug35163_3.phpt new file mode 100755 index 000000000..d2b3c25bf --- /dev/null +++ b/Zend/tests/bug35163_3.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #35163.3 (Array elements can lose references) +--FILE-- +b = array(1); +$a->b[] =& $a->b; +$a->b[] =& $a->b; +$a->b[0] = 2; +var_dump($a); +$a->b = null; +$a = null; +?> +--EXPECT-- +object(stdClass)#1 (1) { + ["b"]=> + &array(3) { + [0]=> + int(2) + [1]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + int(2) + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +} diff --git a/Zend/tests/bug35239.phpt b/Zend/tests/bug35239.phpt index ad999c4ad..7fc7b7d3b 100755 --- a/Zend/tests/bug35239.phpt +++ b/Zend/tests/bug35239.phpt @@ -1,41 +1,41 @@ ---TEST-- -Bug #35239 (Objects can lose references) ---FILE-- -x0 = new stdClass; -$a->x0->y0 = 'a'; -$a->x0->y1 =& $a->x0; -$a->x0->y2 =& $a->x0; -$a->x0->y0 = 'b'; -var_dump($a); -$a->x0->y1 = "ok\n"; -echo $a->x0; -?> ---EXPECT-- -object(stdClass)#1 (1) { - ["x0"]=> - &object(stdClass)#2 (3) { - ["y0"]=> - string(1) "b" - ["y1"]=> - &object(stdClass)#2 (3) { - ["y0"]=> - string(1) "b" - ["y1"]=> - *RECURSION* - ["y2"]=> - *RECURSION* - } - ["y2"]=> - &object(stdClass)#2 (3) { - ["y0"]=> - string(1) "b" - ["y1"]=> - *RECURSION* - ["y2"]=> - *RECURSION* - } - } -} -ok +--TEST-- +Bug #35239 (Objects can lose references) +--FILE-- +x0 = new stdClass; +$a->x0->y0 = 'a'; +$a->x0->y1 =& $a->x0; +$a->x0->y2 =& $a->x0; +$a->x0->y0 = 'b'; +var_dump($a); +$a->x0->y1 = "ok\n"; +echo $a->x0; +?> +--EXPECT-- +object(stdClass)#1 (1) { + ["x0"]=> + &object(stdClass)#2 (3) { + ["y0"]=> + string(1) "b" + ["y1"]=> + &object(stdClass)#2 (3) { + ["y0"]=> + string(1) "b" + ["y1"]=> + *RECURSION* + ["y2"]=> + *RECURSION* + } + ["y2"]=> + &object(stdClass)#2 (3) { + ["y0"]=> + string(1) "b" + ["y1"]=> + *RECURSION* + ["y2"]=> + *RECURSION* + } + } +} +ok diff --git a/Zend/tests/bug35393.phpt b/Zend/tests/bug35393.phpt index 059621c9f..ce3bdd001 100755 --- a/Zend/tests/bug35393.phpt +++ b/Zend/tests/bug35393.phpt @@ -1,30 +1,30 @@ ---TEST-- -Bug #35393 (changing static protected members from outside the class) ---INI-- -error_reporting=4095 ---FILE-- -'main'); - - static function getType() - { - return self::$type; - } -} -print_r(ObjectPath::getType()); -$object_type = array_pop((ObjectPath::getType())); -print_r(ObjectPath::getType()); -?> ---EXPECTF-- -Array -( - [0] => main -) - -Strict Standards: Only variables should be passed by reference in %sbug35393.php on line 12 -Array -( - [0] => main -) +--TEST-- +Bug #35393 (changing static protected members from outside the class) +--INI-- +error_reporting=4095 +--FILE-- +'main'); + + static function getType() + { + return self::$type; + } +} +print_r(ObjectPath::getType()); +$object_type = array_pop((ObjectPath::getType())); +print_r(ObjectPath::getType()); +?> +--EXPECTF-- +Array +( + [0] => main +) + +Strict Standards: Only variables should be passed by reference in %sbug35393.php on line 12 +Array +( + [0] => main +) diff --git a/Zend/tests/bug35411.phpt b/Zend/tests/bug35411.phpt index df2aa4f26..90957aa57 100755 --- a/Zend/tests/bug35411.phpt +++ b/Zend/tests/bug35411.phpt @@ -1,19 +1,19 @@ ---TEST-- -Bug #35411 (Regression with \{$ handling) ---FILE-- - ---EXPECT-- -foo\{bar}baz -foo\{ bar}baz -foobarbaz -foo\{bar}baz -foo\{ bar}baz +--TEST-- +Bug #35411 (Regression with \{$ handling) +--FILE-- + +--EXPECT-- +foo\{bar}baz +foo\{ bar}baz +foobarbaz +foo\{bar}baz +foo\{ bar}baz diff --git a/Zend/tests/bug35437.phpt b/Zend/tests/bug35437.phpt index 965acf5fa..73222a9f2 100755 --- a/Zend/tests/bug35437.phpt +++ b/Zend/tests/bug35437.phpt @@ -1,27 +1,27 @@ ---TEST-- -Bug #35437 (Segfault or Invalid Opcode 137/1/4) ---FILE-- -getMessage()."\n"; -} -?> ---EXPECT-- -Catched: Error occuried: Non-static method TestClass::testMethod() should not be called statically +--TEST-- +Bug #35437 (Segfault or Invalid Opcode 137/1/4) +--FILE-- +getMessage()."\n"; +} +?> +--EXPECT-- +Catched: Error occuried: Non-static method TestClass::testMethod() should not be called statically diff --git a/Zend/tests/bug35470.phpt b/Zend/tests/bug35470.phpt index 3d708862c..5a854552b 100755 --- a/Zend/tests/bug35470.phpt +++ b/Zend/tests/bug35470.phpt @@ -1,11 +1,11 @@ ---TEST-- -Bug #35470 (Assigning global using variable name from array doesn't function) ---FILE-- - ---EXPECT-- -Test: 55 +--TEST-- +Bug #35470 (Assigning global using variable name from array doesn't function) +--FILE-- + +--EXPECT-- +Test: 55 diff --git a/Zend/tests/bug35655.phpt b/Zend/tests/bug35655.phpt index e35764a60..10d9c0c74 100755 --- a/Zend/tests/bug35655.phpt +++ b/Zend/tests/bug35655.phpt @@ -20,6 +20,6 @@ highlight_string($code); ?> --EXPECT-- -
<?php
  $x 
= <<<EOT
some string    
EOT
  
$y 2;
?> +
<?php
  $x 
= <<<EOT
some string    
EOT
  
$y 2;
?>
diff --git a/Zend/tests/bug36071.phpt b/Zend/tests/bug36071.phpt index 19e74980e..e5146091e 100755 --- a/Zend/tests/bug36071.phpt +++ b/Zend/tests/bug36071.phpt @@ -1,11 +1,11 @@ ---TEST-- -Bug #36071 (Engine Crash related with 'clone') ---INI-- -error_reporting=4095 ---FILE-- -b = 0; -?> ---EXPECTF-- +--TEST-- +Bug #36071 (Engine Crash related with 'clone') +--INI-- +error_reporting=4095 +--FILE-- +b = 0; +?> +--EXPECTF-- Fatal error: __clone method called on non-object in %sbug36071.php on line 2 \ No newline at end of file diff --git a/Zend/tests/bug36214.phpt b/Zend/tests/bug36214.phpt index dae25452c..630773713 100755 --- a/Zend/tests/bug36214.phpt +++ b/Zend/tests/bug36214.phpt @@ -1,54 +1,57 @@ ---TEST-- -Bug #36214 (__get method works properly only when conditional operator is used) ---SKIPIF-- - ---FILE-- -stack[$name] = $var;return; - } - - public function &__get($name) { - return $this->stack[$name]; - } -} - -$ctx = new context; -$ctx->comment_preview = array(); -$ctx->comment_preview[0] = 1; -$ctx->comment_preview[1] = 2; -var_dump($ctx->comment_preview); - -$comment_preview = array(); -$comment_preview[0] = 1; -$comment_preview[1] = 2; -$ctx->comment_preview = $comment_preview; -var_dump($ctx->comment_preview); - -$ctx->comment_preview = new ArrayObject(); -$ctx->comment_preview[0] = 1; -$ctx->comment_preview[1] = 2; -var_dump($ctx->comment_preview); -?> ---EXPECT-- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} -object(ArrayObject)#2 (2) { - [0]=> - int(1) - [1]=> - int(2) -} +--TEST-- +Bug #36214 (__get method works properly only when conditional operator is used) +--SKIPIF-- + +--FILE-- +stack[$name] = $var;return; + } + + public function &__get($name) { + return $this->stack[$name]; + } +} + +$ctx = new context; +$ctx->comment_preview = array(); +$ctx->comment_preview[0] = 1; +$ctx->comment_preview[1] = 2; +var_dump($ctx->comment_preview); + +$comment_preview = array(); +$comment_preview[0] = 1; +$comment_preview[1] = 2; +$ctx->comment_preview = $comment_preview; +var_dump($ctx->comment_preview); + +$ctx->comment_preview = new ArrayObject(); +$ctx->comment_preview[0] = 1; +$ctx->comment_preview[1] = 2; +var_dump($ctx->comment_preview); +?> +--EXPECTF-- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} diff --git a/Zend/tests/bug36303.phpt b/Zend/tests/bug36303.phpt index 13c21b7c5..0f9232383 100755 --- a/Zend/tests/bug36303.phpt +++ b/Zend/tests/bug36303.phpt @@ -1,12 +1,14 @@ ---TEST-- -Bug #36303 (foreach on error_zval produces segfault) ---FILE-- -a->b as &$v) { -} -echo "ok\n"; -?> ---EXPECTF-- -Warning: Invalid argument supplied for foreach() in %sbug36303.php on line 3 -ok +--TEST-- +Bug #36303 (foreach on error_zval produces segfault) +--FILE-- +a->b as &$v) { +} +echo "ok\n"; +?> +--EXPECTF-- +Warning: Attempt to modify property 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/bug36513.phpt b/Zend/tests/bug36513.phpt index 2c8ca8450..f46da4efc 100755 --- a/Zend/tests/bug36513.phpt +++ b/Zend/tests/bug36513.phpt @@ -1,22 +1,22 @@ ---TEST-- -Bug #36513 (comment will be outputed in last line) ---FILE-- -5'); -echo "\n"; - -//test('5'); -?> ---EXPECT-- -135 -'5' +--TEST-- +Bug #36513 (comment will be outputed in last line) +--FILE-- +5'); +echo "\n"; + +//test('5'); +?> +--EXPECT-- +135 +'5' diff --git a/Zend/tests/bug36568.phpt b/Zend/tests/bug36568.phpt index 0401d1e01..d621491a4 100755 --- a/Zend/tests/bug36568.phpt +++ b/Zend/tests/bug36568.phpt @@ -1,15 +1,15 @@ ---TEST-- -Bug #36568 (memory_limit has no effect) ---SKIPIF-- - ---INI-- -memory_limit=16M ---FILE-- - ---EXPECT-- -32M +--TEST-- +Bug #36568 (memory_limit has no effect) +--SKIPIF-- + +--INI-- +memory_limit=16M +--FILE-- + +--EXPECT-- +32M diff --git a/Zend/tests/bug37046.phpt b/Zend/tests/bug37046.phpt index 8049944ff..09b8f0cb5 100755 --- a/Zend/tests/bug37046.phpt +++ b/Zend/tests/bug37046.phpt @@ -1,23 +1,23 @@ ---TEST-- -Bug #37046 (foreach breaks static scope) ---FILE-- - $function) { - echo "op1 $k\n"; - if ($k == 0) { - foreach (s() as $k => $function) { - echo "op2 $k\n"; - } - } -} -?> ---EXPECT-- -op1 0 -op2 0 -op2 1 -op1 1 +--TEST-- +Bug #37046 (foreach breaks static scope) +--FILE-- + $function) { + echo "op1 $k\n"; + if ($k == 0) { + foreach (s() as $k => $function) { + echo "op2 $k\n"; + } + } +} +?> +--EXPECT-- +op1 0 +op2 0 +op2 1 +op1 1 diff --git a/Zend/tests/bug37144.phpt b/Zend/tests/bug37144.phpt index 6191a2938..b3e548946 100755 --- a/Zend/tests/bug37144.phpt +++ b/Zend/tests/bug37144.phpt @@ -1,16 +1,16 @@ ---TEST-- -Bug #37144 (PHP crashes trying to assign into property of dead object) ---FILE-- -bar = array(1); - return $x; -} -foo()->bar[1] = "123"; -foo()->bar[0]++; -unset(foo()->bar[0]); -echo "ok\n"; -?> ---EXPECT-- -ok +--TEST-- +Bug #37144 (PHP crashes trying to assign into property of dead object) +--FILE-- +bar = array(1); + return $x; +} +foo()->bar[1] = "123"; +foo()->bar[0]++; +unset(foo()->bar[0]); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/Zend/tests/bug37212.phpt b/Zend/tests/bug37212.phpt index 81cc34fdb..212ef23ec 100755 --- a/Zend/tests/bug37212.phpt +++ b/Zend/tests/bug37212.phpt @@ -41,15 +41,15 @@ var_dump($B); ===DONE=== --EXPECTF-- object(B)#%d (1) { - ["value:protected"]=> + ["value":protected]=> string(1) "B" } object(C)#%d (1) { - ["value:protected"]=> + ["value":protected]=> string(1) "C" } object(B)#%d (1) { - ["value:protected"]=> + ["value":protected]=> string(1) "C" } ===DONE=== diff --git a/Zend/tests/bug37251.phpt b/Zend/tests/bug37251.phpt new file mode 100644 index 000000000..320d544ce --- /dev/null +++ b/Zend/tests/bug37251.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #37251 (deadlock when custom error handler is to catch array type hint error) +--FILE-- +bar(); +--EXPECT-- +OK diff --git a/Zend/tests/bug37667.phpt b/Zend/tests/bug37667.phpt index b05f296f0..ecf43c5b8 100755 --- a/Zend/tests/bug37667.phpt +++ b/Zend/tests/bug37667.phpt @@ -30,10 +30,10 @@ var_dump($obj); --EXPECTF-- string(3) "bar" -Notice: Undefined offset: 2 in %sbug37667.php on line 16 +Notice: Undefined offset: 2 in %sbug37667.php on line 16 NULL object(Test)#%d (1) { - ["property:protected"]=> + ["property":protected]=> array(1) { ["foo"]=> string(3) "bar" @@ -44,7 +44,7 @@ Notice: Indirect modification of overloaded property Test::$property has no effe Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 21 object(Test)#%d (1) { - ["property:protected"]=> + ["property":protected]=> array(1) { ["foo"]=> string(3) "bar" diff --git a/Zend/tests/bug37715.phpt b/Zend/tests/bug37715.phpt index 3a69b717f..a585c78e5 100755 --- a/Zend/tests/bug37715.phpt +++ b/Zend/tests/bug37715.phpt @@ -1,29 +1,29 @@ ---TEST-- -Bug #37715 (array pointers resetting on copy) ---FILE-- - array( - 'A', 'B', 'C', 'D', - ), - 'b' => array( - 'AA', 'BB', 'CC', 'DD', - ), -); - -// Set the pointer of $a to 'b' and the pointer of 'b' to 'CC' -reset($a); -next($a); -next($a['b']); -next($a['b']); -next($a['b']); - -var_dump(key($a['b'])); -foreach($a as $k => $d) -{ -} -// Alternatively $c = $a; and foreachloop removal will cause identical results. -var_dump(key($a['b'])); ---EXPECT-- -int(3) -int(3) +--TEST-- +Bug #37715 (array pointers resetting on copy) +--FILE-- + array( + 'A', 'B', 'C', 'D', + ), + 'b' => array( + 'AA', 'BB', 'CC', 'DD', + ), +); + +// Set the pointer of $a to 'b' and the pointer of 'b' to 'CC' +reset($a); +next($a); +next($a['b']); +next($a['b']); +next($a['b']); + +var_dump(key($a['b'])); +foreach($a as $k => $d) +{ +} +// Alternatively $c = $a; and foreachloop removal will cause identical results. +var_dump(key($a['b'])); +--EXPECT-- +int(3) +int(3) diff --git a/Zend/tests/bug38146.phpt b/Zend/tests/bug38146.phpt index 1f022f342..e321e11c8 100755 --- a/Zend/tests/bug38146.phpt +++ b/Zend/tests/bug38146.phpt @@ -1,19 +1,19 @@ ---TEST-- -Bug #38146 (Cannot use array returned from foo::__get('bar') in write context) ---FILE-- -"bar","bar"=>"foo"); - return $f; - } -} - -$f = new foo(); -foreach($f->bar as $key => $value) { - print "$key => $value\n"; -} -?> ---EXPECT-- -foo => bar -bar => foo +--TEST-- +Bug #38146 (Cannot use array returned from foo::__get('bar') in write context) +--FILE-- +"bar","bar"=>"foo"); + return $f; + } +} + +$f = new foo(); +foreach($f->bar as $key => $value) { + print "$key => $value\n"; +} +?> +--EXPECT-- +foo => bar +bar => foo diff --git a/Zend/tests/bug38211.phpt b/Zend/tests/bug38211.phpt index 4b088125a..6ae9430e8 100755 --- a/Zend/tests/bug38211.phpt +++ b/Zend/tests/bug38211.phpt @@ -1,10 +1,10 @@ ---TEST-- -Bug #38211 (variable name and cookie name match breaks script execution) ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #38211 (variable name and cookie name match breaks script execution) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug38220.phpt b/Zend/tests/bug38220.phpt index 3e1b2dc81..bee3ffc75 100755 --- a/Zend/tests/bug38220.phpt +++ b/Zend/tests/bug38220.phpt @@ -1,92 +1,92 @@ ---TEST-- -Bug #38220 (Crash on some object operations) ---FILE-- -obj->i}\n"; - } - - function close() { - echo "close(): {$this->obj->i}\n"; - } -} - -class A { - public $i; - - function __construct($i) { - $this->i = $i; - - } - - function __call($method, $args) { - $drv = myserv::drv(); - - $drv->obj = $this; - - 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 -// $drv->obj = null; - } - - function __destruct() { - echo "A::__destruct()\n"; - $this->close(); - } -} - -class myserv { - private static $drv = null; - - static function drv() { - if (is_null(self::$drv)) - self::$drv = new drv; - return self::$drv; - } -} - -$obj1 = new A(1); -$obj1->func1(); - -$obj2 = new A(2); -unset($obj1); -$obj2->func1(); -?> ---EXPECT-- -before call func1 -A Object -( - [i] => 1 -) -func1(): 1 -after call func1 -A::__destruct() -before call close -A Object -( - [i] => 1 -) -close(): 1 -after call close -before call func1 -A Object -( - [i] => 2 -) -func1(): 1 -after call func1 -A::__destruct() -before call close -A Object -( - [i] => 2 -) -close(): 2 -after call close +--TEST-- +Bug #38220 (Crash on some object operations) +--FILE-- +obj->i}\n"; + } + + function close() { + echo "close(): {$this->obj->i}\n"; + } +} + +class A { + public $i; + + function __construct($i) { + $this->i = $i; + + } + + function __call($method, $args) { + $drv = myserv::drv(); + + $drv->obj = $this; + + 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 +// $drv->obj = null; + } + + function __destruct() { + echo "A::__destruct()\n"; + $this->close(); + } +} + +class myserv { + private static $drv = null; + + static function drv() { + if (is_null(self::$drv)) + self::$drv = new drv; + return self::$drv; + } +} + +$obj1 = new A(1); +$obj1->func1(); + +$obj2 = new A(2); +unset($obj1); +$obj2->func1(); +?> +--EXPECT-- +before call func1 +A Object +( + [i] => 1 +) +func1(): 1 +after call func1 +A::__destruct() +before call close +A Object +( + [i] => 1 +) +close(): 1 +after call close +before call func1 +A Object +( + [i] => 2 +) +func1(): 1 +after call func1 +A::__destruct() +before call close +A Object +( + [i] => 2 +) +close(): 2 +after call close diff --git a/Zend/tests/bug38234.phpt b/Zend/tests/bug38234.phpt index 337420667..a81a3aadc 100755 --- a/Zend/tests/bug38234.phpt +++ b/Zend/tests/bug38234.phpt @@ -1,18 +1,18 @@ ---TEST-- -Bug #38234 (Exception in __clone makes memory leak) ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #38234 (Exception in __clone makes memory leak) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug38287.phpt b/Zend/tests/bug38287.phpt index 3052fc7f9..9a53a9335 100755 --- a/Zend/tests/bug38287.phpt +++ b/Zend/tests/bug38287.phpt @@ -1,45 +1,45 @@ ---TEST-- -Bug #38287 (static variables mess up global vars) ---FILE-- -vars[]=1; - self::get_object()->vars[]=2; - self::get_object()->vars[]=3; - var_dump(self::get_object()->vars); - } -} -?> ---EXPECT-- -array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) -} -NULL +--TEST-- +Bug #38287 (static variables mess up global vars) +--FILE-- +vars[]=1; + self::get_object()->vars[]=2; + self::get_object()->vars[]=3; + var_dump(self::get_object()->vars); + } +} +?> +--EXPECT-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +NULL diff --git a/Zend/tests/bug38469.phpt b/Zend/tests/bug38469.phpt index 1200335d5..6afcaf5fd 100644 --- a/Zend/tests/bug38469.phpt +++ b/Zend/tests/bug38469.phpt @@ -1,54 +1,54 @@ ---TEST-- -Bug #38469 (Unexpected creation of cycle) ---FILE-- - ---EXPECT-- -array(1) { - [0]=> - array(0) { - } -} -array(1) { - [0]=> - array(1) { - [0]=> - array(1) { - [0]=> - array(0) { - } - } - } -} -array(1) { - [0]=> - array(0) { - } -} -array(1) { - [0]=> - array(1) { - [0]=> - array(1) { - [0]=> - array(0) { - } - } - } -} +--TEST-- +Bug #38469 (Unexpected creation of cycle) +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + array(0) { + } +} +array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + array(0) { + } + } + } +} +array(1) { + [0]=> + array(0) { + } +} +array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + array(0) { + } + } + } +} diff --git a/Zend/tests/bug38623.phpt b/Zend/tests/bug38623.phpt index 8b03539db..9b042a914 100755 --- a/Zend/tests/bug38623.phpt +++ b/Zend/tests/bug38623.phpt @@ -1,16 +1,16 @@ ---TEST-- -Bug #38623 (leaks in a tricky code with switch() and exceptions) ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #38623 (leaks in a tricky code with switch() and exceptions) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug38779.phpt b/Zend/tests/bug38779.phpt index b551767c9..5ffe990a0 100644 --- a/Zend/tests/bug38779.phpt +++ b/Zend/tests/bug38779.phpt @@ -19,6 +19,9 @@ class Loader { function stream_eof() { return $this->position >= strlen($this->data); } + function stream_stat() { + return array('size' => strlen($this->data)); + } } stream_wrapper_register('Loader', 'Loader'); require 'Loader://qqq.php'; diff --git a/Zend/tests/bug38942.phpt b/Zend/tests/bug38942.phpt index 5b86e15d7..85bb56d20 100755 --- a/Zend/tests/bug38942.phpt +++ b/Zend/tests/bug38942.phpt @@ -1,17 +1,17 @@ ---TEST-- -Bug #38942 (Double old-style-ctor inheritance) ---FILE-- - ---EXPECT-- -Array -( - [0] => foo -) +--TEST-- +Bug #38942 (Double old-style-ctor inheritance) +--FILE-- + +--EXPECT-- +Array +( + [0] => foo +) diff --git a/Zend/tests/bug39017.phpt b/Zend/tests/bug39017.phpt index f38b9a310..70204758d 100755 --- a/Zend/tests/bug39017.phpt +++ b/Zend/tests/bug39017.phpt @@ -1,11 +1,11 @@ ---TEST-- -Bug #39017 (foreach(($obj = new myClass) as $v); echo $obj; segfaults) ---FILE-- - ---EXPECTF-- -object(A)#%d (0) { -} +--TEST-- +Bug #39017 (foreach(($obj = new myClass) as $v); echo $obj; segfaults) +--FILE-- + +--EXPECTF-- +object(A)#%d (0) { +} diff --git a/Zend/tests/bug39018.phpt b/Zend/tests/bug39018.phpt new file mode 100644 index 000000000..1bc23d3ba --- /dev/null +++ b/Zend/tests/bug39018.phpt @@ -0,0 +1,82 @@ +--TEST-- +Bug #39018 (Error control operator '@' fails to suppress "Uninitialized string offset") +--FILE-- + +--EXPECTF-- + +Notice: Uninitialized string offset: 0 in %s on line 12 + +Notice: Uninitialized string offset: -%d in %s on line 16 + +Notice: Uninitialized string offset: 4 in %s on line 28 + +Notice: Uninitialized string offset: 4 in %s on line 34 + +Notice: Uninitialized string offset: 4 in %s on line 38 + +Notice: Uninitialized string offset: 4 in %s on line 42 + +Notice: Uninitialized string offset: 4 in %s on line 46 + +Notice: Uninitialized string offset: 12 in %s on line 52 +b +Done diff --git a/Zend/tests/bug39018_2.phpt b/Zend/tests/bug39018_2.phpt new file mode 100644 index 000000000..81831d51e --- /dev/null +++ b/Zend/tests/bug39018_2.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #39018 [2] (Error control operator '@' fails to suppress "Uninitialized string offset") +--FILE-- + +--EXPECT-- +0 +Done diff --git a/Zend/tests/bug39127.phpt b/Zend/tests/bug39127.phpt new file mode 100644 index 000000000..a013da145 --- /dev/null +++ b/Zend/tests/bug39127.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #39127 (Old-style constructor fallbacks produce strange results) +--FILE-- + +--EXPECTF-- +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 01e3f9172..92f91a555 100755 --- a/Zend/tests/bug39297.phpt +++ b/Zend/tests/bug39297.phpt @@ -1,45 +1,45 @@ ---TEST-- -Bug #39297 (Memory corryption because of indirect modification of overloaded array) ---FILE-- -children[$cannonicalName] = $value; - $value->parent = $this; - } - - public function offsetGet($offset) { - echo "offsetGet()\n"; - $cannonicalName = strtolower($offset); - return $this->children[$cannonicalName]; - } - -} - -$id = 'Test'; - -$root = new MyTree(); -$child = new MyTree(); -$root[$id] = $child; - -var_dump(compareByRef($root[$id], $child)); -?> ---EXPECT-- -offsetSet() -offsetGet() -bool(true) +--TEST-- +Bug #39297 (Memory corryption because of indirect modification of overloaded array) +--FILE-- +children[$cannonicalName] = $value; + $value->parent = $this; + } + + public function offsetGet($offset) { + echo "offsetGet()\n"; + $cannonicalName = strtolower($offset); + return $this->children[$cannonicalName]; + } + +} + +$id = 'Test'; + +$root = new MyTree(); +$child = new MyTree(); +$root[$id] = $child; + +var_dump(compareByRef($root[$id], $child)); +?> +--EXPECT-- +offsetSet() +offsetGet() +bool(true) diff --git a/Zend/tests/bug39304.phpt b/Zend/tests/bug39304.phpt index 5529d700d..0129d2134 100755 --- a/Zend/tests/bug39304.phpt +++ b/Zend/tests/bug39304.phpt @@ -1,9 +1,11 @@ ---TEST-- -Bug #39304 (Segmentation fault with list unpacking of string offset) ---FILE-- - ---EXPECTF-- -Fatal error: Cannot use string offset as an array in %sbug39304.php on line 3 +--TEST-- +Bug #39304 (Segmentation fault with list unpacking of string offset) +--FILE-- + +--EXPECTF-- +Notice: Uninitialized string offset: 0 in %sbug39304.php on line 3 + +Fatal error: Cannot use string offset as an array in %sbug39304.php on line 3 diff --git a/Zend/tests/bug39346.phpt b/Zend/tests/bug39346.phpt new file mode 100644 index 000000000..4a614c9e9 --- /dev/null +++ b/Zend/tests/bug39346.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #39346 (Unsetting a static variable inside a destructor causes segfault later on) +--FILE-- +_id = $id; + self::$instances[$this->_id] = $this; + } + + function __destruct() { + unset(self::$instances[$this->_id]); + } +} +$test = new test(2); +$test = new test(1); +$test = new test(2); +$test = new test(3); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/Zend/tests/bug39438.phpt b/Zend/tests/bug39438.phpt index 2dac58ac6..e1ed8e886 100755 --- a/Zend/tests/bug39438.phpt +++ b/Zend/tests/bug39438.phpt @@ -1,45 +1,45 @@ ---TEST-- -Bug #39438 (Fatal error: Out of memory) ---INI-- -memory_limit=16M ---FILE-- - array( - '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', - ) - ) - ) -); -$test=array(); -while($i<1200) { - $test[]=$test2; - $i++; -} -$out=serialize($test); -echo "ok\n"; -?> ---EXPECT-- -ok +--TEST-- +Bug #39438 (Fatal error: Out of memory) +--INI-- +memory_limit=16M +--FILE-- + array( + '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', + ) + ) + ) +); +$test=array(); +while($i<1200) { + $test[]=$test2; + $i++; +} +$out=serialize($test); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/Zend/tests/bug39445.phpt b/Zend/tests/bug39445.phpt index 87f5f03ff..cf1607f2d 100755 --- a/Zend/tests/bug39445.phpt +++ b/Zend/tests/bug39445.phpt @@ -1,16 +1,16 @@ ---TEST-- -Bug #39445 (Calling debug_backtrace() in the __toString() function produces a crash) ---FILE-- - ---EXPECT-- -LOWERCASE +--TEST-- +Bug #39445 (Calling debug_backtrace() in the __toString() function produces a crash) +--FILE-- + +--EXPECT-- +LOWERCASE diff --git a/Zend/tests/bug39449.phpt b/Zend/tests/bug39449.phpt index 725c0d47b..c725147ac 100755 --- a/Zend/tests/bug39449.phpt +++ b/Zend/tests/bug39449.phpt @@ -1,40 +1,40 @@ ---TEST-- -Bug #39449 (Overloaded array properties do not work correctly) ---FILE-- -keys[$val]; - } - public function __set($k, $v) { - $this->keys[$k] = $v; - } -} - -$a =new A(); -$a->arr = array('a','b','c'); - -$b = &$a->arr; -$b[]= 'd'; - -foreach ($a->arr as $k => $v) { - echo "$k => $v\n"; -} - -$a->arr[]='d'; - -foreach ($a->arr as $k => $v) { - echo "$k => $v\n"; -} -?> ---EXPECT-- -0 => a -1 => b -2 => c -3 => d -0 => a -1 => b -2 => c -3 => d -4 => d +--TEST-- +Bug #39449 (Overloaded array properties do not work correctly) +--FILE-- +keys[$val]; + } + public function __set($k, $v) { + $this->keys[$k] = $v; + } +} + +$a =new A(); +$a->arr = array('a','b','c'); + +$b = &$a->arr; +$b[]= 'd'; + +foreach ($a->arr as $k => $v) { + echo "$k => $v\n"; +} + +$a->arr[]='d'; + +foreach ($a->arr as $k => $v) { + echo "$k => $v\n"; +} +?> +--EXPECT-- +0 => a +1 => b +2 => c +3 => d +0 => a +1 => b +2 => c +3 => d +4 => d diff --git a/Zend/tests/bug39542.phpt b/Zend/tests/bug39542.phpt index 1b8ae3360..13ddc0a91 100755 --- a/Zend/tests/bug39542.phpt +++ b/Zend/tests/bug39542.phpt @@ -1,24 +1,24 @@ ---TEST-- -Bug #39542 (Behaviour of require_once/include_once different to < 5.2.0) ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #39542 (Behaviour of require_once/include_once different to < 5.2.0) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug39775.phpt b/Zend/tests/bug39775.phpt index b06797df8..4c6ce6baf 100755 --- a/Zend/tests/bug39775.phpt +++ b/Zend/tests/bug39775.phpt @@ -1,20 +1,20 @@ ---TEST-- -Bug #39775 ("Indirect modification ..." message is not shown) ---FILE-- -array; - return $this->array; - } -} -$t = new test; -$t->anything[] = 'bar'; -print_r($t->anything); -?> ---EXPECTF-- -Notice: Indirect modification of overloaded property test::$anything has no effect in %sbug39775.php on line 10 -Array -( -) +--TEST-- +Bug #39775 ("Indirect modification ..." message is not shown) +--FILE-- +array; + return $this->array; + } +} +$t = new test; +$t->anything[] = 'bar'; +print_r($t->anything); +?> +--EXPECTF-- +Notice: Indirect modification of overloaded property test::$anything has no effect in %sbug39775.php on line 10 +Array +( +) diff --git a/Zend/tests/bug39825.phpt b/Zend/tests/bug39825.phpt index 294b32d87..791b329f7 100755 --- a/Zend/tests/bug39825.phpt +++ b/Zend/tests/bug39825.phpt @@ -1,13 +1,13 @@ ---TEST-- -Bug #39825 (foreach produces memory error) ---FILE-- - 2, "foo" => "bar"); -$obj = (object)$array; -foreach ($obj as $name => $value) { - echo "$name -> $value\n"; -} -?> ---EXPECT-- -1 -> 2 -foo -> bar +--TEST-- +Bug #39825 (foreach produces memory error) +--FILE-- + 2, "foo" => "bar"); +$obj = (object)$array; +foreach ($obj as $name => $value) { + echo "$name -> $value\n"; +} +?> +--EXPECT-- +1 -> 2 +foo -> bar diff --git a/Zend/tests/bug39990.phpt b/Zend/tests/bug39990.phpt index b2df0b540..d7545eeec 100755 --- a/Zend/tests/bug39990.phpt +++ b/Zend/tests/bug39990.phpt @@ -1,17 +1,17 @@ ---TEST-- -Bug #39990 (Cannot "foreach" over overloaded properties) ---FILE-- -arr as $value) - echo "$value\n"; -?> ---EXPECT-- -Hello -World +--TEST-- +Bug #39990 (Cannot "foreach" over overloaded properties) +--FILE-- +arr as $value) + echo "$value\n"; +?> +--EXPECT-- +Hello +World diff --git a/Zend/tests/bug40236.phpt b/Zend/tests/bug40236.phpt index c19caefb6..f9a427724 100755 --- a/Zend/tests/bug40236.phpt +++ b/Zend/tests/bug40236.phpt @@ -1,17 +1,17 @@ ---TEST-- -Bug #40236 (php -a function allocation eats memory) ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Interactive %s - -ok +--TEST-- +Bug #40236 (php -a function allocation eats memory) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Interactive %s + +ok diff --git a/Zend/tests/bug40261.phpt b/Zend/tests/bug40261.phpt index 93a555708..b7e2c98c5 100755 --- a/Zend/tests/bug40261.phpt +++ b/Zend/tests/bug40261.phpt @@ -1,25 +1,25 @@ ---TEST-- -Bug #40261 (Extremely slow data handling due to memory fragmentation) ---INI-- -memory_limit=128M ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #40261 (Extremely slow data handling due to memory fragmentation) +--INI-- +memory_limit=128M +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug40509.phpt b/Zend/tests/bug40509.phpt index 4ee8e0061..21eaae944 100755 --- a/Zend/tests/bug40509.phpt +++ b/Zend/tests/bug40509.phpt @@ -1,26 +1,26 @@ ---TEST-- -Bug #40509 (key() function changed behaviour if global array is used within function) ---FILE-- - $v) { - var_dump($k); -} -var_dump(key($arr["v"])); ---EXPECT-- -int(0) -int(0) -int(0) -NULL +--TEST-- +Bug #40509 (key() function changed behaviour if global array is used within function) +--FILE-- + $v) { + var_dump($k); +} +var_dump(key($arr["v"])); +--EXPECT-- +int(0) +int(0) +int(0) +NULL diff --git a/Zend/tests/bug40705.phpt b/Zend/tests/bug40705.phpt index 5628b37bf..374f73b75 100755 --- a/Zend/tests/bug40705.phpt +++ b/Zend/tests/bug40705.phpt @@ -1,26 +1,26 @@ ---TEST-- -Bug #40705 (Iterating within function moves original array pointer) ---FILE-- - $v) { - // do stuff - } -} - -$foo = array('foo', 'bar', 'baz'); -var_dump(key($foo)); -doForeach($foo); -var_dump(key($foo)); -foreach ($foo as $k => $v) { - var_dump($k); -} -var_dump(key($foo)); ---EXPECT-- -int(0) -int(0) -int(0) -int(1) -int(2) -NULL +--TEST-- +Bug #40705 (Iterating within function moves original array pointer) +--FILE-- + $v) { + // do stuff + } +} + +$foo = array('foo', 'bar', 'baz'); +var_dump(key($foo)); +doForeach($foo); +var_dump(key($foo)); +foreach ($foo as $k => $v) { + var_dump($k); +} +var_dump(key($foo)); +--EXPECT-- +int(0) +int(0) +int(0) +int(1) +int(2) +NULL diff --git a/Zend/tests/bug40757.phpt b/Zend/tests/bug40757.phpt index d413b1022..b5c91c79c 100755 --- a/Zend/tests/bug40757.phpt +++ b/Zend/tests/bug40757.phpt @@ -1,28 +1,28 @@ ---TEST-- -Bug #40757 (get_object_vars() get nothing in child class) ---FILE-- -getFields(new Base())); -$child=new Child(); -print_r($child->getFields(new Base())); -?> ---EXPECT-- -Array -( - [p1] => sadf -) -Array -( - [p1] => sadf -) +--TEST-- +Bug #40757 (get_object_vars() get nothing in child class) +--FILE-- +getFields(new Base())); +$child=new Child(); +print_r($child->getFields(new Base())); +?> +--EXPECT-- +Array +( + [p1] => sadf +) +Array +( + [p1] => sadf +) diff --git a/Zend/tests/bug40770.phpt b/Zend/tests/bug40770.phpt index 432a27aea..c4c78c222 100755 --- a/Zend/tests/bug40770.phpt +++ b/Zend/tests/bug40770.phpt @@ -1,22 +1,22 @@ ---TEST-- -Bug #40770 (Apache child exits when PHP memory limit reached) ---INI-- -memory_limit=8M ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Fatal error: Allowed memory size of 8388608 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +--TEST-- +Bug #40770 (Apache child exits when PHP memory limit reached) +--INI-- +memory_limit=8M +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Allowed memory size of 8388608 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/Zend/tests/bug40809.phpt b/Zend/tests/bug40809.phpt index a90754d91..08fc89f55 100755 --- a/Zend/tests/bug40809.phpt +++ b/Zend/tests/bug40809.phpt @@ -1,33 +1,33 @@ ---TEST-- -Bug #40809 (Poor perfomance of ".=") ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #40809 (Poor perfomance of ".=") +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug41209.phpt b/Zend/tests/bug41209.phpt index 0834b376b..5498ede02 100644 --- a/Zend/tests/bug41209.phpt +++ b/Zend/tests/bug41209.phpt @@ -41,6 +41,6 @@ echo "Done\n"; --EXPECTF-- Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: id' in %s:%d Stack trace: -#0 %s(%d): env::errorHandler() +#0 %s(%d): env::errorHandler(8, '%s', '%s', 34, Array) #1 {main} thrown in %s on line %d diff --git a/Zend/tests/bug41633_1.phpt b/Zend/tests/bug41633_1.phpt index fbd27418c..1c1d552dd 100755 --- a/Zend/tests/bug41633_1.phpt +++ b/Zend/tests/bug41633_1.phpt @@ -1,12 +1,12 @@ ---TEST-- -Bug #41633.1 (self:: doesn't work for constants) ---FILE-- - ---EXPECT-- -ok +--TEST-- +Bug #41633.1 (self:: doesn't work for constants) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug41633_2.phpt b/Zend/tests/bug41633_2.phpt index 1aa76be21..3deb4516a 100755 --- a/Zend/tests/bug41633_2.phpt +++ b/Zend/tests/bug41633_2.phpt @@ -1,11 +1,11 @@ ---TEST-- -Bug #41633.2 (Undefined class constants must not be substituted by strings) ---FILE-- - ---EXPECTF-- -Fatal error: Undefined class constant 'self::B' in %sbug41633_2.php on line 5 +--TEST-- +Bug #41633.2 (Undefined class constants must not be substituted by strings) +--FILE-- + +--EXPECTF-- +Fatal error: Undefined class constant 'self::B' in %sbug41633_2.php on line 5 diff --git a/Zend/tests/bug41633_3.phpt b/Zend/tests/bug41633_3.phpt index 9b537fe35..7b9452db8 100755 --- a/Zend/tests/bug41633_3.phpt +++ b/Zend/tests/bug41633_3.phpt @@ -1,12 +1,12 @@ ---TEST-- -Bug #41633.3 (Crash instantiating classes with self-referencing constants) ---FILE-- - ---EXPECTF-- -Fatal error: Cannot declare self-referencing constant 'Foo::B' in %sbug41633_3.php on line %d +--TEST-- +Bug #41633.3 (Crash instantiating classes with self-referencing constants) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot declare self-referencing constant 'Foo::B' in %sbug41633_3.php on line %d diff --git a/Zend/tests/bug41633_4.phpt b/Zend/tests/bug41633_4.phpt index 16e58954d..3507f6a08 100755 --- a/Zend/tests/bug41633_4.phpt +++ b/Zend/tests/bug41633_4.phpt @@ -1,12 +1,12 @@ ---TEST-- -Bug #41633.4 (self:: doesn't work for constants) ---FILE-- - ---EXPECT-- -bool(true) +--TEST-- +Bug #41633.4 (self:: doesn't work for constants) +--FILE-- + +--EXPECT-- +bool(true) diff --git a/Zend/tests/bug41929.phpt b/Zend/tests/bug41929.phpt index 7fa4bbcc8..c332aba2d 100755 --- a/Zend/tests/bug41929.phpt +++ b/Zend/tests/bug41929.phpt @@ -1,24 +1,24 @@ ---TEST-- -Bug #41929 (Foreach on object does not iterate over all visible properties) ---FILE-- -priv,"\n"; - foreach ($this as $k=>$v) { - echo "$k: $v\n"; - } - } -} - -class D extends C { -} - -$myD = new D; -$myD->doLoop(); -?> ---EXPECT-- -ok -priv: ok +--TEST-- +Bug #41929 (Foreach on object does not iterate over all visible properties) +--FILE-- +priv,"\n"; + foreach ($this as $k=>$v) { + echo "$k: $v\n"; + } + } +} + +class D extends C { +} + +$myD = new D; +$myD->doLoop(); +?> +--EXPECT-- +ok +priv: ok diff --git a/Zend/tests/bug41961.phpt b/Zend/tests/bug41961.phpt index 1a6e52308..514265b60 100755 --- a/Zend/tests/bug41961.phpt +++ b/Zend/tests/bug41961.phpt @@ -1,29 +1,29 @@ ---TEST-- -Bug #41961 (Ensure search for hidden private methods does not stray from class hierarchy) ---FILE-- -secret(); // bug - invokes X::secret() instead of ChildClass::secret() - } - private function secret() { - echo "Called private " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n"; - } -} - -class ParentClass { - private function secret() { } -} - -class ChildClass extends ParentClass { - public function secret() { - echo "Called public " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n"; - } -} -?> ---EXPECT-- -Called public ChildClass::secret() on an instance of: ChildClass +--TEST-- +Bug #41961 (Ensure search for hidden private methods does not stray from class hierarchy) +--FILE-- +secret(); // bug - invokes X::secret() instead of ChildClass::secret() + } + private function secret() { + echo "Called private " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n"; + } +} + +class ParentClass { + private function secret() { } +} + +class ChildClass extends ParentClass { + public function secret() { + echo "Called public " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n"; + } +} +?> +--EXPECT-- +Called public ChildClass::secret() on an instance of: ChildClass diff --git a/Zend/tests/bug42119.phpt b/Zend/tests/bug42119.phpt deleted file mode 100755 index 79d70f0ae..000000000 --- a/Zend/tests/bug42119.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Bug #42119 (array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On) ---INI-- -allow_call_time_pass_reference=1 -zend.ze1_compatibility_mode=1 ---FILE-- -item = 2; -echo $arr[0]->item,"\n"; -?> ---EXPECT-- -2 diff --git a/Zend/tests/bug42211.phpt b/Zend/tests/bug42211.phpt index e9f2a1e21..c6ea10652 100644 --- a/Zend/tests/bug42211.phpt +++ b/Zend/tests/bug42211.phpt @@ -22,9 +22,8 @@ $b = new B(); $b->foo(); --EXPECT-- bool(true) -bool(false) -bool(false) bool(true) bool(true) -bool(false) - +bool(true) +bool(true) +bool(true) diff --git a/Zend/tests/bug42767.phpt b/Zend/tests/bug42767.phpt index 0de4dba5f..484918cdb 100644 --- a/Zend/tests/bug42767.phpt +++ b/Zend/tests/bug42767.phpt @@ -1,5 +1,12 @@ --TEST-- Bug #42767 (highlight_string() truncates trailing comments) +--INI-- +highlight.string = #DD0000 +highlight.comment = #FF8000 +highlight.keyword = #007700 +highlight.bg = #FFFFFF +highlight.default = #0000BB +highlight.html = #000000 --FILE-- +--FILE-- + 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); +} + +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); +} + +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); +} + +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); +} + +echo "first\n"; +echo C; +echo foo\C; +echo foo\foo::C; +echo foo::C; +echo \foo\foo::C; +echo ArrayObject::STD_PROP_LIST . "\n"; +echo E_ERROR . "\n"; +echo "second\n"; +echo \foo\foo::C1; +echo \foo\foo::C2; +echo \foo\foo::C3; +echo \foo\foo::C4; +echo \foo\foo::C5; +echo \foo\foo::C6 . "\n"; +echo \foo\foo::C7 . "\n"; + +print_r(bar1::$a1); +print_r(bar1::$a2); +print_r(bar1::$a3); +print_r(bar1::$a4); +print_r(bar1::$a5); +print_r(bar1::$a6); +print_r(bar1::$a7); + +print_r(bar2::$a1); +print_r(bar2::$a2); +print_r(bar2::$a3); +print_r(bar2::$a4); +print_r(bar2::$a5); +print_r(bar2::$a6); +print_r(bar2::$a7); + +print_r(bar3::$a1); +print_r(bar3::$a2); +print_r(bar3::$a3); +print_r(bar3::$a4); +print_r(bar3::$a5); +print_r(bar3::$a6); +print_r(bar3::$a7); + +print_r(bar4::$a1); +print_r(bar4::$a2); +print_r(bar4::$a3); +print_r(bar4::$a4); +print_r(bar4::$a5); +print_r(bar4::$a6); +print_r(bar4::$a7); + +print_r(bar5::$a1); +print_r(bar5::$a2); +print_r(bar5::$a3); +print_r(bar5::$a4); +print_r(bar5::$a5); +print_r(bar5::$a6); +print_r(bar5::$a7); +function oops($a = array(foo\unknown)){} +oops(); +?> +--EXPECTF-- +first +foo\C +foo\foo\C +foo\foo\foo::C +foo\foo::C +foo\foo::C +1 +1 +second +foo\C +foo\foo\C +foo\foo\foo::C +foo\C +foo\foo::C +1 +1 +Array +( + [11] => 0 +) +Array +( + [12] => 0 +) +Array +( + [32] => 0 +) +Array +( + [11] => 0 +) +Array +( + [22] => 0 +) +Array +( + [1] => 0 +) +Array +( + [1] => 0 +) +Array +( + [11] => 11 +) +Array +( + [12] => 11 +) +Array +( + [32] => 11 +) +Array +( + [11] => 11 +) +Array +( + [22] => 11 +) +Array +( + [1] => 11 +) +Array +( + [1] => 11 +) +Array +( + [11] => 12 +) +Array +( + [12] => 12 +) +Array +( + [32] => 12 +) +Array +( + [11] => 12 +) +Array +( + [22] => 12 +) +Array +( + [1] => 12 +) +Array +( + [1] => 12 +) +Array +( + [11] => 1 +) +Array +( + [12] => 1 +) +Array +( + [32] => 1 +) +Array +( + [11] => 1 +) +Array +( + [22] => 1 +) +Array +( + [1] => 1 +) +Array +( + [1] => 1 +) +Array +( + [11] => 1 +) +Array +( + [12] => 1 +) +Array +( + [32] => 1 +) +Array +( + [11] => 1 +) +Array +( + [22] => 1 +) +Array +( + [1] => 1 +) +Array +( + [1] => 1 +) + +Fatal error: Undefined constant 'foo\foo\unknown' in %sbug42819.php on line %d \ No newline at end of file diff --git a/Zend/tests/bug42820.phpt b/Zend/tests/bug42820.phpt new file mode 100755 index 000000000..921f0090a --- /dev/null +++ b/Zend/tests/bug42820.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #42820 (defined() on constant with namespace prefixes tries to load class) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use Blah\Ex as Ex because the name is already in use in %sbug42859.php on line 6 diff --git a/Zend/tests/bug42937.phpt b/Zend/tests/bug42937.phpt index 875f0d922..537c56792 100755 --- a/Zend/tests/bug42937.phpt +++ b/Zend/tests/bug42937.phpt @@ -18,9 +18,10 @@ class B extends A { function test() { self::test1(); parent::test2(); - A::test3(); - B::test4(); - C::test5(); + static::test3(); + A::test4(); + B::test5(); + C::test6(); } } @@ -36,5 +37,6 @@ test1 test2 test3 test4 +test5 -Fatal error: Call to undefined method C::test5() in %sbug42937.php on line 20 +Fatal error: Call to undefined method C::test6() in %sbug42937.php on line 21 diff --git a/Zend/tests/bug43027.phpt b/Zend/tests/bug43027.phpt new file mode 100755 index 000000000..32f68d0bd --- /dev/null +++ b/Zend/tests/bug43027.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #43027 (Declare cause fatal error) +--FILE-- + +--EXPECTF-- +Deprecated: Ticks is deprecated and will be removed in PHP 6 in %s on line %d +ok diff --git a/Zend/tests/bug43128.phpt b/Zend/tests/bug43128.phpt index 2832acaeb..629f46c59 100755 --- a/Zend/tests/bug43128.phpt +++ b/Zend/tests/bug43128.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #43128 (Very long class name causes segfault) +--INI-- +memory_limit=128000000 --FILE-- bar($foo); // Ok! +$foo->bar(new \stdclass); // Error, ok! +--EXPECTF-- +Catchable fatal error: Argument 1 passed to foobar\foo::bar() must be an instance of foobar\foo, instance of stdClass given, called in %sbug43332_1.php on line 10 and defined in %sbug43332_1.php on line 5 diff --git a/Zend/tests/bug43332_2.phpt b/Zend/tests/bug43332_2.phpt new file mode 100644 index 000000000..b8adef3b1 --- /dev/null +++ b/Zend/tests/bug43332_2.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #43332.2 (self and parent as type hint in namespace) +--FILE-- +bar($foo); // Ok! +$foo->bar(new stdclass); // Error, ok! +--EXPECTF-- +Fatal error: '\self' is an invalid class name in %sbug43332_2.php on line 5 diff --git a/Zend/tests/bug43343.phpt b/Zend/tests/bug43343.phpt new file mode 100644 index 000000000..79b3e5a24 --- /dev/null +++ b/Zend/tests/bug43343.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #43343 (Variable class name) +--FILE-- + +--EXPECTF-- +Parse error: %s error%sexpecting%sT_NS_SEPARATOR%sin %sbug43343.php on line 5 diff --git a/Zend/tests/bug43344_1.phpt b/Zend/tests/bug43344_1.phpt new file mode 100644 index 000000000..59129d75c --- /dev/null +++ b/Zend/tests/bug43344_1.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #43344.1 (Wrong error message for undefined namespace constant) +--FILE-- +0)) { + reset($a); + return key($a); +} +echo bar."\n"; +echo f1()."\n"; +echo f2()."\n"; +echo f3()."\n"; +?> +--EXPECTF-- +Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 13 +bar + +Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 3 +bar + +Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 6 +bar + +Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 9 +bar diff --git a/Zend/tests/bug43344_10.phpt b/Zend/tests/bug43344_10.phpt new file mode 100644 index 000000000..e9f918cd6 --- /dev/null +++ b/Zend/tests/bug43344_10.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #43344.10 (Wrong error message for undefined namespace constant) +--FILE-- + +--EXPECTF-- +Fatal error: Undefined constant 'bar' in %sbug43344_10.php on line %d diff --git a/Zend/tests/bug43344_11.phpt b/Zend/tests/bug43344_11.phpt new file mode 100644 index 000000000..b55cdccde --- /dev/null +++ b/Zend/tests/bug43344_11.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #43344.11 (Wrong error message for undefined namespace constant) +--FILE-- + +--EXPECTF-- +Fatal error: Undefined constant 'bar' in %sbug43344_11.php on line %d diff --git a/Zend/tests/bug43344_12.phpt b/Zend/tests/bug43344_12.phpt new file mode 100644 index 000000000..4d1e154f3 --- /dev/null +++ b/Zend/tests/bug43344_12.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #43344.12 (Wrong error message for undefined namespace constant) +--FILE-- + +--EXPECTF-- +Fatal error: Undefined constant 'bar' in %sbug43344_12.php on line %d diff --git a/Zend/tests/bug43344_13.phpt b/Zend/tests/bug43344_13.phpt new file mode 100644 index 000000000..c6aaf92fb --- /dev/null +++ b/Zend/tests/bug43344_13.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #43344.13 (Wrong error message for undefined namespace constant) +--FILE-- +0)) { + reset($a); + return key($a); +} +echo f()."\n"; +?> +--EXPECTF-- +Fatal error: Undefined constant 'bar' in %sbug43344_13.php on line %d diff --git a/Zend/tests/bug43344_2.phpt b/Zend/tests/bug43344_2.phpt new file mode 100644 index 000000000..57766afa9 --- /dev/null +++ b/Zend/tests/bug43344_2.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #43344.2 (Wrong error message for undefined namespace constant) +--FILE-- + +--EXPECTF-- +Fatal error: Class 'Foo\Foo' not found in %sbug43344_2.php on line %d diff --git a/Zend/tests/bug43344_3.phpt b/Zend/tests/bug43344_3.phpt new file mode 100644 index 000000000..579ed81ad --- /dev/null +++ b/Zend/tests/bug43344_3.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #43344.3 (Wrong error message for undefined namespace constant) +--FILE-- + +--EXPECTF-- +Fatal error: Class 'Foo\Foo' not found in %sbug43344_3.php on line %d diff --git a/Zend/tests/bug43344_4.phpt b/Zend/tests/bug43344_4.phpt new file mode 100644 index 000000000..97e08b366 --- /dev/null +++ b/Zend/tests/bug43344_4.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #43344.4 (Wrong error message for undefined namespace constant) +--FILE-- + +--EXPECTF-- +Fatal error: Class 'Foo\Foo' not found in %sbug43344_4.php on line %d diff --git a/Zend/tests/bug43344_5.phpt b/Zend/tests/bug43344_5.phpt new file mode 100644 index 000000000..645ef33e7 --- /dev/null +++ b/Zend/tests/bug43344_5.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #43344.5 (Wrong error message for undefined namespace constant) +--FILE-- +0)) { + reset($a); + return key($a); +} +echo f()."\n"; +?> +--EXPECTF-- +Fatal error: Class 'Foo\Foo' not found in %sbug43344_5.php on line %d diff --git a/Zend/tests/bug43344_6.phpt b/Zend/tests/bug43344_6.phpt new file mode 100644 index 000000000..38e1961aa --- /dev/null +++ b/Zend/tests/bug43344_6.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #43344.6 (Wrong error message for undefined namespace constant) +--FILE-- + +--EXPECTF-- +Fatal error: Undefined constant 'Foo\bar' in %sbug43344_6.php on line %d diff --git a/Zend/tests/bug43344_7.phpt b/Zend/tests/bug43344_7.phpt new file mode 100644 index 000000000..94e00d9e1 --- /dev/null +++ b/Zend/tests/bug43344_7.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #43344.7 (Wrong error message for undefined namespace constant) +--FILE-- + +--EXPECTF-- +Fatal error: Undefined constant 'Foo\bar' in %sbug43344_7.php on line %d diff --git a/Zend/tests/bug43344_8.phpt b/Zend/tests/bug43344_8.phpt new file mode 100644 index 000000000..eb694f711 --- /dev/null +++ b/Zend/tests/bug43344_8.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #43344.8 (Wrong error message for undefined namespace constant) +--FILE-- + +--EXPECTF-- +Fatal error: Undefined constant 'Foo\bar' in %sbug43344_8.php on line %d diff --git a/Zend/tests/bug43344_9.phpt b/Zend/tests/bug43344_9.phpt new file mode 100644 index 000000000..31604e7a9 --- /dev/null +++ b/Zend/tests/bug43344_9.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #43344.9 (Wrong error message for undefined namespace constant) +--FILE-- +0)) { + reset($a); + return key($a); +} +echo f()."\n"; +?> +--EXPECTF-- +Fatal error: Undefined constant 'Foo\bar' in %sbug43344_9.php on line %d diff --git a/Zend/tests/bug43426.phpt b/Zend/tests/bug43426.phpt new file mode 100644 index 000000000..73c38df2b --- /dev/null +++ b/Zend/tests/bug43426.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #43426 (crash on nested call_user_func calls) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug43450.phpt b/Zend/tests/bug43450.phpt index c55b4f722..926e146f4 100644 --- a/Zend/tests/bug43450.phpt +++ b/Zend/tests/bug43450.phpt @@ -1,35 +1,35 @@ ---TEST-- -Bug #43450 (Memory leak on some functions with implicit object __toString() call) ---SKIPIF-- - ---FILE-- - ---EXPECT-- -PASS +--TEST-- +Bug #43450 (Memory leak on some functions with implicit object __toString() call) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +PASS diff --git a/Zend/tests/bug43651.phpt b/Zend/tests/bug43651.phpt new file mode 100644 index 000000000..ea70cf103 --- /dev/null +++ b/Zend/tests/bug43651.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #43651 (is_callable() with one or more nonconsecutive colons crashes) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug43918.phpt b/Zend/tests/bug43918.phpt new file mode 100644 index 000000000..c76ce83de --- /dev/null +++ b/Zend/tests/bug43918.phpt @@ -0,0 +1,44 @@ +--TEST-- +Bug #43918 (Segmentation fault in garbage collector) +--SKIPIF-- + +--FILE-- + + + + TEST + + + TEST + + + TEST + + + TEST + + + TEST + + + TEST + + + TEST + + +XML; + +$Array = array( ); +for( $XX = 0; $XX < 2000; ++$XX ) +{ + $Array[] = $xml = new SimpleXMLElement($xmlstr); +} + +gc_collect_cycles( ); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/Zend/tests/bug44414.phpt b/Zend/tests/bug44414.phpt new file mode 100644 index 000000000..1f3a2583d --- /dev/null +++ b/Zend/tests/bug44414.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #44414 (incomplete reporting about abstract methods) +--FILE-- + +--EXPECTF-- +Fatal error: Class C contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (A::foo, B::bar) in %sbug44414.php on line 9 diff --git a/Zend/tests/bug44653.phpt b/Zend/tests/bug44653.phpt new file mode 100644 index 000000000..1abf9747c --- /dev/null +++ b/Zend/tests/bug44653.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #44653 (Invalid namespace name resolution) +--FILE-- + +--EXPECT-- +int(1) +bag1 +A\fooBar +bag2 +B\fooBar +B\fooBar diff --git a/Zend/tests/bug44660.phpt b/Zend/tests/bug44660.phpt new file mode 100755 index 000000000..1027377d3 --- /dev/null +++ b/Zend/tests/bug44660.phpt @@ -0,0 +1,49 @@ +--TEST-- +Bug #44660 (Indexed and reference assignment to propery of non-object don't trigger warning) +--FILE-- + read access: "; +echo $a->p; + +echo "\n--> direct assignment: "; +$a->p = $s; + +echo "\n--> increment: "; +$a->p++; + +echo "\n--> reference assignment:"; +$a->p =& $s; + +echo "\n--> reference assignment:"; +$s =& $a->p; + +echo "\n--> indexed assignment:"; +$a->p[0] = $s; + +echo "\n--> Confirm assignments have had no impact:\n"; +var_dump($a); +?> +--EXPECTF-- +--> read access: +Notice: Trying to get property of non-object in %sbug44660.php on line 6 + +--> direct assignment: +Warning: Attempt to assign property of non-object in %sbug44660.php on line 9 + +--> increment: +Warning: Attempt to increment/decrement property of non-object in %sbug44660.php on line 12 + +--> reference assignment: +Warning: Attempt to modify property of non-object in %sbug44660.php on line 15 + +--> reference assignment: +Warning: Attempt to modify property of non-object in %sbug44660.php on line 18 + +--> indexed assignment: +Warning: Attempt to modify property of non-object in %sbug44660.php on line 21 + +--> Confirm assignments have had no impact: +bool(true) diff --git a/Zend/tests/bug44899.phpt b/Zend/tests/bug44899.phpt new file mode 100644 index 000000000..d62033a24 --- /dev/null +++ b/Zend/tests/bug44899.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #44899 (__isset usage changes behavior of empty()) +--FILE-- +_data = $data; + } + + function __isset($field_name) + { + return isset($this->_data[$field_name]); + } +} + +$arr = array('foo' => ''); + +$myclass = new myclass($arr) ; + +echo (isset($myclass->foo)) ? 'isset' : 'not isset'; +echo "\n"; +echo (empty($myclass->foo)) ? 'empty' : 'not empty'; +echo "\n"; +echo ($myclass->foo) ? 'not empty' : 'empty'; +echo "\n"; + +?> +--EXPECTF-- +isset +empty + +Notice: Undefined property: myclass::$foo in %s on line %d +empty diff --git a/Zend/tests/bug44899_2.phpt b/Zend/tests/bug44899_2.phpt new file mode 100644 index 000000000..e98714929 --- /dev/null +++ b/Zend/tests/bug44899_2.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug #44899 (__isset usage changes behavior of empty()) - 2 +--FILE-- +_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' => ''); + +$myclass = new myclass($arr) ; + +echo (isset($myclass->foo)) ? 'isset' : 'not isset'; +echo "\n"; +echo (empty($myclass->foo)) ? 'empty' : 'not empty'; +echo "\n"; +echo ($myclass->foo) ? 'not empty' : 'empty'; +echo "\n"; + +?> +--EXPECT-- +isset +bool(true) +empty +bool(true) +empty diff --git a/Zend/tests/bug44913.phpt b/Zend/tests/bug44913.phpt new file mode 100644 index 000000000..0c2551fb0 --- /dev/null +++ b/Zend/tests/bug44913.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #44913 (Segfault when using return in combination with nested loops and continue 2) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/bug45147.phpt b/Zend/tests/bug45147.phpt new file mode 100644 index 000000000..b940777d1 --- /dev/null +++ b/Zend/tests/bug45147.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #45147 (unexpected T_ENDFOR) +--FILE-- + + ## + +--EXPECT-- + # diff --git a/Zend/tests/bug45178.phpt b/Zend/tests/bug45178.phpt index 156a5a703..5ce185994 100755 --- a/Zend/tests/bug45178.phpt +++ b/Zend/tests/bug45178.phpt @@ -20,9 +20,9 @@ $b->_rme2 = 0; var_dump($b); ?> --EXPECTF-- -Strict Standards: Assigning the return value of new by reference is deprecated in %sbug45178.php on line 7 +Deprecated: Assigning the return value of new by reference is deprecated in %sbug45178.php on line 7 -Strict Standards: Assigning the return value of new by reference is deprecated in %sbug45178.php on line 15 +Deprecated: Assigning the return value of new by reference is deprecated in %sbug45178.php on line 15 object(Bar)#%d (1) { ["_rme2"]=> int(0) diff --git a/Zend/tests/bug45180.phpt b/Zend/tests/bug45180.phpt new file mode 100644 index 000000000..285543aaf --- /dev/null +++ b/Zend/tests/bug45180.phpt @@ -0,0 +1,61 @@ +--TEST-- +Testing callback formats within class method +--FILE-- +test(); + +$x::A(); + +foo::B(); + +$f = 'FOO'; + +$f::C(); + +$f::$f(); + +foo::$f(); + +?> +--EXPECT-- +__call: +string(3) "ABC" +__call: +string(3) "ABC" +__call: +string(3) "XYZ" +__call: +string(3) "WWW" +__call: +string(3) "ABC" +__callstatic: +string(1) "A" +__callstatic: +string(1) "B" +__callstatic: +string(1) "C" +__callstatic: +string(3) "FOO" +__callstatic: +string(3) "FOO" diff --git a/Zend/tests/bug45186.phpt b/Zend/tests/bug45186.phpt new file mode 100644 index 000000000..bcf88a189 --- /dev/null +++ b/Zend/tests/bug45186.phpt @@ -0,0 +1,54 @@ +--TEST-- +Bug #45186 (__call depends on __callstatic in class scope) +--FILE-- +test(); + +call_user_func(array('BAR','x')); +call_user_func('BAR::www'); +call_user_func('self::y'); + +?> +--EXPECTF-- +__call: +string(3) "ABC" +__call: +string(3) "ABC" +__call: +string(3) "xyz" +__call: +string(3) "www" +__call: +string(1) "y" +__call: +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 diff --git a/Zend/tests/bug45186_2.phpt b/Zend/tests/bug45186_2.phpt new file mode 100644 index 000000000..9a707ace8 --- /dev/null +++ b/Zend/tests/bug45186_2.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #45186.2 (__call depends on __callstatic in class scope) +--FILE-- +test(); + +call_user_func(array('BAR','x')); +call_user_func('BAR::www'); +call_user_func('self::y'); + +?> +--EXPECTF-- +__call: +string(3) "ABC" +__call: +string(3) "ABC" +__call: +string(3) "xyz" +__call: +string(3) "www" +__call: +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 diff --git a/Zend/tests/bug45742.phpt b/Zend/tests/bug45742.phpt new file mode 100644 index 000000000..b21e09304 --- /dev/null +++ b/Zend/tests/bug45742.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #45742 Wrong class array inpretetion using constant indexes +--FILE-- + 23, + Constants::B => 42, + ); +} + +var_dump( ArrayProperty::$array ); +?> +--EXPECT-- +array(1) { + [1]=> + int(23) +} diff --git a/Zend/tests/bug45744.phpt b/Zend/tests/bug45744.phpt new file mode 100644 index 000000000..029efcfe6 --- /dev/null +++ b/Zend/tests/bug45744.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #45744 (Case sensitive callback behaviour) +--FILE-- + + --FILE-- +--EXPECTF-- +array(3) { + [%d7]=> + int(1) + [-%d8]=> + int(1) + ["%d8"]=> + int(1) +} diff --git a/Zend/tests/bug45910.phpt b/Zend/tests/bug45910.phpt new file mode 100644 index 000000000..1041877fe --- /dev/null +++ b/Zend/tests/bug45910.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #45910 (Cannot declare self-referencing constant) +--FILE-- + 'a', + self::CCC => 'b', + self::DDD => self::AAA + ); + + public static function test() { + self::$foo; + } +} + +foo::test(); + +print 1; +?> +--EXPECT-- +1 diff --git a/Zend/tests/bug45910_2.phpt b/Zend/tests/bug45910_2.phpt new file mode 100644 index 000000000..68ca9a117 --- /dev/null +++ b/Zend/tests/bug45910_2.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #45910.2 (Cannot declare self-referencing constant) +--FILE-- + 'a', + self::CCC => 'b', + self::DDD => 11 + ); + + public static function test() { + self::$foo; + } +} + +foo::test(); + +print 1; +?> +--EXPECT-- +1 diff --git a/Zend/tests/bug46106.phpt b/Zend/tests/bug46106.phpt new file mode 100644 index 000000000..9afb0ef46 --- /dev/null +++ b/Zend/tests/bug46106.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #46106 (Memory leaks when using global statement) +--FILE-- +invokeArgs(array(0)); +} + +$x = new ReflectionFunction('str_pad'); +test($x); +?> +DONE +--EXPECT-- +DONE diff --git a/Zend/tests/bug46196.phpt b/Zend/tests/bug46196.phpt new file mode 100644 index 000000000..7526d802a --- /dev/null +++ b/Zend/tests/bug46196.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test restore_error_handler() function : bug #46196 +--CREDITS-- +Olivier Doucet +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing restore_error_handler() : error bug #46196 *** +NULL +bool(true) +NULL +===DONE=== diff --git a/Zend/tests/bug46238.phpt b/Zend/tests/bug46238.phpt new file mode 100644 index 000000000..87a1c15c1 --- /dev/null +++ b/Zend/tests/bug46238.phpt @@ -0,0 +1,120 @@ +--TEST-- +Bug #46238 (Segmentation fault on static call with empty string method) +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + string(1) "a" + } +} +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + array(0) { + } + } +} +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + NULL + } +} +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + int(1) + } +} +array(2) { + [0]=> + string(0) "" + [1]=> + array(0) { + } +} +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + string(1) "a" + } +} +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + array(0) { + } + } +} +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + NULL + } +} +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + int(1) + } +} +array(2) { + [0]=> + string(0) "" + [1]=> + array(0) { + } +} diff --git a/Zend/tests/bug46241.phpt b/Zend/tests/bug46241.phpt new file mode 100644 index 000000000..40ed7c8e8 --- /dev/null +++ b/Zend/tests/bug46241.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #46241 (error handler stacks) +--FILE-- + +==END== +--EXPECT-- +Caught on second level: 'Foo' +Caught on second level: 'Foo' +==END== diff --git a/Zend/tests/bug46304.phpt b/Zend/tests/bug46304.phpt new file mode 100755 index 000000000..0a6e3bffc --- /dev/null +++ b/Zend/tests/bug46304.phpt @@ -0,0 +1,65 @@ +--TEST-- +Bug #46304 (defining namespaced constant using define()) +--FILE-- + +--EXPECTF-- +value1 +value1 +value1 +value2 +value2 +value2 +value3 +value3 +value3 +value4 +value4 +value4 +value4 +value5 +value5 +value5 +value5 +value6 +value6 +value6 +value6 + +Fatal error: Undefined constant 'NS1\ns2\coNSt1' in %sbug46304.php on line %d diff --git a/Zend/tests/bug46409.phpt b/Zend/tests/bug46409.phpt new file mode 100644 index 000000000..1986e88b1 --- /dev/null +++ b/Zend/tests/bug46409.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #46409 (__invoke method called outside of object context when using array_map) +--FILE-- +val; + } +} + +$cb = new Callback(); +echo $cb(),"\n"; +$a = array(1, 2); +$b = array_map($cb, $a); +print_r($b); +?> +--EXPECT-- +hello, world +Array +( + [0] => hello, world + [1] => hello, world +) diff --git a/Zend/tests/bug46665.phpt b/Zend/tests/bug46665.phpt new file mode 100644 index 000000000..8e7fc086d --- /dev/null +++ b/Zend/tests/bug46665.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #46665 (Triggering autoload with a variable classname causes truncated autoload param) +--FILE-- + +--EXPECTF-- +%string|unicode%(12) "\Foo\Bar\Baz" diff --git a/Zend/tests/bug46665_autoload.inc b/Zend/tests/bug46665_autoload.inc new file mode 100644 index 000000000..092b27296 --- /dev/null +++ b/Zend/tests/bug46665_autoload.inc @@ -0,0 +1,5 @@ + --EXPECT-- -array(1) { - [-2147483648]=> +array(3) { + [-866368000]=> + int(1) + [-835511808]=> + int(2) + [-835350528]=> int(3) } -int(3) +int(2) array(1) { - [-2147483648]=> + [-835350528]=> int(3) } diff --git a/Zend/tests/bug46811.phpt b/Zend/tests/bug46811.phpt new file mode 100644 index 000000000..e98f6e772 --- /dev/null +++ b/Zend/tests/bug46811.phpt @@ -0,0 +1,13 @@ +--TEST-- +ini_set() function +--INI-- +arg_separator.output=& +--FILE-- + +--EXPECTF-- +bool(false) +%unicode|string%(1) "&" + diff --git a/Zend/tests/bug46813.phpt b/Zend/tests/bug46813.phpt new file mode 100644 index 000000000..91837db1f --- /dev/null +++ b/Zend/tests/bug46813.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #46813: class_exists doesn`t work with fully qualified namespace +--FILE-- + +--EXPECT-- +autoload == true: +bool(true) +autoload == false: +bool(true) diff --git a/Zend/tests/bug47054.phpt b/Zend/tests/bug47054.phpt new file mode 100644 index 000000000..ab6c6e1de --- /dev/null +++ b/Zend/tests/bug47054.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #47054 (BC break in static functions called as dynamic) +--FILE-- +s(); + } +} + +$d = new D(); +$d->m(); + +C::s(); + +$c = new C(); +$c->s(); + +get_called_class(); + +D::m(); + +?> +--EXPECTF-- +Called class: D +Called class: C +Called class: C + +Warning: get_called_class() called from outside a class in %s on line %d + +Strict Standards: Non-static method D::m() should not be called statically in %s on line %d + +Fatal error: Using $this when not in object context in %s on line %d diff --git a/Zend/tests/bug47320.phpt b/Zend/tests/bug47320.phpt new file mode 100644 index 000000000..47db35eda --- /dev/null +++ b/Zend/tests/bug47320.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #47320 ($php_errormsg out of scope in functions) +--INI-- +display_errors=0 +track_errors=1 +--FILE-- + +--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 new file mode 100644 index 000000000..07a3b4e33 --- /dev/null +++ b/Zend/tests/bug47343.phpt @@ -0,0 +1,44 @@ +--TEST-- +Bug #47343 (gc_collect_cycles causes a segfault when called within a destructor in one case) +--FILE-- +data['foo'] = new B($this); + $this->data['bar'] = new B($this); + // Return either of the above + return $this->data['foo']; + } +} + +class B +{ + public function B($A) + { + $this->A = $A; + } + + public function __destruct() + { + } +} + +for ($i = 0; $i < 2; $i++) +{ + $Aobj = new A; + $Bobj = $Aobj->getB(); + unset($Bobj); + unset($Aobj); +} + +echo "DONE\n"; +?> +--EXPECT-- +DONE diff --git a/Zend/tests/bug47572.phpt b/Zend/tests/bug47572.phpt new file mode 100644 index 000000000..695cc3a7f --- /dev/null +++ b/Zend/tests/bug47572.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #47572 (zval_update_constant_ex: Segmentation fault) +--FILE-- + "bar" + ); + +} + +$foo = new Foo(); + +?> +--EXPECTF-- +Notice: Use of undefined constant FOO - assumed 'FOO' in %s on line %d diff --git a/Zend/tests/bug47593.phpt b/Zend/tests/bug47593.phpt new file mode 100644 index 000000000..98aa19a91 --- /dev/null +++ b/Zend/tests/bug47593.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #47593 (interface_exists() returns false when using absolute namespace path) +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +int(11) +bool(true) +bool(false) diff --git a/Zend/tests/bug47704.phpt b/Zend/tests/bug47704.phpt new file mode 100644 index 000000000..151754a4f --- /dev/null +++ b/Zend/tests/bug47704.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #47704 (crashes on some "bad" operations with string offsets) +--FILE-- +a += 1; +?> +--EXPECTF-- +Fatal error: Cannot use string offset as an object in %sbug47704.php on line %d diff --git a/Zend/tests/call_static.phpt b/Zend/tests/call_static.phpt new file mode 100755 index 000000000..c37bc7223 --- /dev/null +++ b/Zend/tests/call_static.phpt @@ -0,0 +1,20 @@ +--TEST-- +__callStatic() Magic method +--FILE-- + +--EXPECTF-- +nonstatic +string(3) "aAa" +static +string(3) "aAa" diff --git a/Zend/tests/call_static_003.phpt b/Zend/tests/call_static_003.phpt new file mode 100644 index 000000000..566ff0fdf --- /dev/null +++ b/Zend/tests/call_static_003.phpt @@ -0,0 +1,38 @@ +--TEST-- +Testing method name case +--FILE-- +fOoBaR(); + self::foOBAr(); + $this::fOOBAr(); + } +} + +$a = new Foo; +$a->test(); +$a::bAr(); +foo::BAZ(); + +?> +--EXPECT-- +nonstatic +string(6) "fOoBaR" +nonstatic +string(6) "foOBAr" +nonstatic +string(6) "fOOBAr" +static +string(3) "bAr" +static +string(3) "BAZ" diff --git a/Zend/tests/call_static_004.phpt b/Zend/tests/call_static_004.phpt new file mode 100644 index 000000000..5af33ef45 --- /dev/null +++ b/Zend/tests/call_static_004.phpt @@ -0,0 +1,21 @@ +--TEST-- +Invalid method name in dynamic static call +--FILE-- + +--EXPECTF-- +string(3) "AaA" + +Fatal error: Function name must be a string in %s on line %d diff --git a/Zend/tests/call_static_005.phpt b/Zend/tests/call_static_005.phpt new file mode 100644 index 000000000..7259857e5 --- /dev/null +++ b/Zend/tests/call_static_005.phpt @@ -0,0 +1,17 @@ +--TEST-- +Invalid method name in dynamic static call +--FILE-- + +--EXPECTF-- +Fatal error: Call to undefined function foo::() in %s on line %d diff --git a/Zend/tests/call_static_006.phpt b/Zend/tests/call_static_006.phpt new file mode 100644 index 000000000..6d6b3ca77 --- /dev/null +++ b/Zend/tests/call_static_006.phpt @@ -0,0 +1,30 @@ +--TEST-- +Testing __callStatic +--FILE-- + +--EXPECTF-- +Strict Standards: Non-static method foo::aa() should not be called statically in %s on line %d +ok + +Strict Standards: Non-static method foo::aa() should not be called statically in %s on line %d +ok + +Fatal error: Can not call constructor in %s on line %d diff --git a/Zend/tests/call_static_007.phpt b/Zend/tests/call_static_007.phpt new file mode 100644 index 000000000..419f10231 --- /dev/null +++ b/Zend/tests/call_static_007.phpt @@ -0,0 +1,34 @@ +--TEST-- +Testing __call and __callstatic +--FILE-- +$b(); + +$a->baz(); + +a::Foo(); + +?> +--EXPECT-- +__callstatic: Test +__call: Test +__call: Bar +__callstatic: Foo diff --git a/Zend/tests/catch.phpt b/Zend/tests/catch.phpt index 624039afa..0ec5cf759 100755 --- a/Zend/tests/catch.phpt +++ b/Zend/tests/catch.phpt @@ -1,23 +1,23 @@ ---TEST-- -catch shouldn't call __autoload ---FILE-- - ---EXPECT-- -ok +--TEST-- +catch shouldn't call __autoload +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/catch_002.phpt b/Zend/tests/catch_002.phpt index 73fa97b0a..11d736abe 100755 --- a/Zend/tests/catch_002.phpt +++ b/Zend/tests/catch_002.phpt @@ -1,33 +1,33 @@ ---TEST-- -Catching an exception in a constructor ---FILE-- - -===DONE=== ---EXPECT-- -Caught -===DONE=== +--TEST-- +Catching an exception in a constructor +--FILE-- + +===DONE=== +--EXPECT-- +Caught +===DONE=== diff --git a/Zend/tests/catch_003.phpt b/Zend/tests/catch_003.phpt index 9210e3f1f..414d50f81 100755 --- a/Zend/tests/catch_003.phpt +++ b/Zend/tests/catch_003.phpt @@ -1,38 +1,38 @@ ---TEST-- -Catching an exception in a constructor fired form a static method ---FILE-- - -===DONE=== ---EXPECT-- -Caught -===DONE=== +--TEST-- +Catching an exception in a constructor fired form a static method +--FILE-- + +===DONE=== +--EXPECT-- +Caught +===DONE=== diff --git a/Zend/tests/catch_004.phpt b/Zend/tests/catch_004.phpt index f1df06788..54920b894 100755 --- a/Zend/tests/catch_004.phpt +++ b/Zend/tests/catch_004.phpt @@ -1,43 +1,43 @@ ---TEST-- -Catching an exception in a constructor inside a static method ---FILE-- - -===DONE=== ---EXPECT-- -Caught -===DONE=== +--TEST-- +Catching an exception in a constructor inside a static method +--FILE-- + +===DONE=== +--EXPECT-- +Caught +===DONE=== diff --git a/Zend/tests/class_alias_001.phpt b/Zend/tests/class_alias_001.phpt new file mode 100644 index 000000000..371f08f80 --- /dev/null +++ b/Zend/tests/class_alias_001.phpt @@ -0,0 +1,30 @@ +--TEST-- +Testing class_alias() +--FILE-- + +--EXPECT-- +bool(true) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/Zend/tests/class_alias_002.phpt b/Zend/tests/class_alias_002.phpt new file mode 100644 index 000000000..9601cb25e --- /dev/null +++ b/Zend/tests/class_alias_002.phpt @@ -0,0 +1,12 @@ +--TEST-- +Trying redeclare class with class_alias() +--FILE-- + +--EXPECTF-- +Warning: Cannot redeclare class FOO in %s on line %d diff --git a/Zend/tests/class_alias_003.phpt b/Zend/tests/class_alias_003.phpt new file mode 100644 index 000000000..57e2fd572 --- /dev/null +++ b/Zend/tests/class_alias_003.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing declaration of alias to 'static' +--FILE-- +test()); + +?> +--EXPECTF-- +object(foo)#%d (0) { +} diff --git a/Zend/tests/class_alias_004.phpt b/Zend/tests/class_alias_004.phpt new file mode 100644 index 000000000..b7dbabdeb --- /dev/null +++ b/Zend/tests/class_alias_004.phpt @@ -0,0 +1,15 @@ +--TEST-- +Testing creation of alias using an existing interface name +--FILE-- + +--EXPECTF-- +Warning: Cannot redeclare class test in %s on line %d diff --git a/Zend/tests/class_alias_005.phpt b/Zend/tests/class_alias_005.phpt new file mode 100644 index 000000000..47c825b41 --- /dev/null +++ b/Zend/tests/class_alias_005.phpt @@ -0,0 +1,27 @@ +--TEST-- +Testing static call method using the original class name +--FILE-- + +--EXPECT-- +hello diff --git a/Zend/tests/class_alias_006.phpt b/Zend/tests/class_alias_006.phpt new file mode 100644 index 000000000..d14ad7c93 --- /dev/null +++ b/Zend/tests/class_alias_006.phpt @@ -0,0 +1,10 @@ +--TEST-- +Testing creation of alias to an internal class +--FILE-- + +--EXPECTF-- +Warning: First argument of class_alias() must be a name of user defined class in %s on line %d diff --git a/Zend/tests/class_alias_007.phpt b/Zend/tests/class_alias_007.phpt new file mode 100644 index 000000000..247398e2e --- /dev/null +++ b/Zend/tests/class_alias_007.phpt @@ -0,0 +1,19 @@ +--TEST-- +Testing class_alias() using autoload +--FILE-- + +--EXPECTF-- +object(foo)#%d (0) { +} +object(foo)#%d (0) { +} diff --git a/Zend/tests/class_alias_008.phpt b/Zend/tests/class_alias_008.phpt new file mode 100644 index 000000000..8ee8fa03f --- /dev/null +++ b/Zend/tests/class_alias_008.phpt @@ -0,0 +1,16 @@ +--TEST-- +Testing class_alias() with abstract class using an arbitrary class name as alias +--FILE-- + +--EXPECTF-- +Fatal error: Cannot instantiate abstract class foo in %s on line %d diff --git a/Zend/tests/class_alias_009.phpt b/Zend/tests/class_alias_009.phpt new file mode 100644 index 000000000..f17769e1f --- /dev/null +++ b/Zend/tests/class_alias_009.phpt @@ -0,0 +1,14 @@ +--TEST-- +Testing interface declaration using the original and alias class name +--FILE-- + +--EXPECTF-- +Fatal error: Class c cannot implement previously implemented interface a in %s on line %d diff --git a/Zend/tests/class_alias_010.phpt b/Zend/tests/class_alias_010.phpt new file mode 100644 index 000000000..38590b664 --- /dev/null +++ b/Zend/tests/class_alias_010.phpt @@ -0,0 +1,14 @@ +--TEST-- +Trying use an existing alias name in class declaration +--FILE-- + +--EXPECTF-- +Warning: Cannot redeclare class b in %s on line %d diff --git a/Zend/tests/class_alias_011.phpt b/Zend/tests/class_alias_011.phpt new file mode 100644 index 000000000..58ba28a2b --- /dev/null +++ b/Zend/tests/class_alias_011.phpt @@ -0,0 +1,26 @@ +--TEST-- +Testing callback in alias +--FILE-- + +--EXPECT-- +hello +foobar! diff --git a/Zend/tests/class_alias_012.phpt b/Zend/tests/class_alias_012.phpt new file mode 100644 index 000000000..dd1c9b107 --- /dev/null +++ b/Zend/tests/class_alias_012.phpt @@ -0,0 +1,33 @@ +--TEST-- +Testing dynamic alias name +--FILE-- + +--EXPECTF-- +object(test\baz\foo)#%d (0) { +} +object(test\baz\foo)#%d (0) { +} +object(test\baz\foo)#%d (0) { +} +object(test\baz\foo)#%d (0) { +} diff --git a/Zend/tests/class_alias_013.phpt b/Zend/tests/class_alias_013.phpt new file mode 100644 index 000000000..4991d0fd3 --- /dev/null +++ b/Zend/tests/class_alias_013.phpt @@ -0,0 +1,26 @@ +--TEST-- +Testing alias of alias +--FILE-- + +--EXPECTF-- +object(test\baz\foo)#%d (0) { +} +object(test\baz\foo)#%d (0) { +} diff --git a/Zend/tests/class_alias_014.phpt b/Zend/tests/class_alias_014.phpt new file mode 100644 index 000000000..7c4bdb9b0 --- /dev/null +++ b/Zend/tests/class_alias_014.phpt @@ -0,0 +1,15 @@ +--TEST-- +Testing creation of alias to class name without namespace prefix +--FILE-- + +--EXPECTF-- +Warning: Class 'bar' not found in %s on line %d diff --git a/Zend/tests/class_alias_015.phpt b/Zend/tests/class_alias_015.phpt new file mode 100644 index 000000000..c79c07718 --- /dev/null +++ b/Zend/tests/class_alias_015.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing instantiation using namespace:: prefix +--FILE-- + +--EXPECTF-- +object(foo\bar)#%d (0) { +} diff --git a/Zend/tests/class_alias_016.phpt b/Zend/tests/class_alias_016.phpt new file mode 100644 index 000000000..930f2ee0e --- /dev/null +++ b/Zend/tests/class_alias_016.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing creation of alias to global scope +--FILE-- + +--EXPECTF-- +object(foo\bar)#%d (0) { +} + +Fatal error: Class 'foo\foo' not found in %s on line %d diff --git a/Zend/tests/class_alias_017.phpt b/Zend/tests/class_alias_017.phpt new file mode 100644 index 000000000..f4d3626e4 --- /dev/null +++ b/Zend/tests/class_alias_017.phpt @@ -0,0 +1,33 @@ +--TEST-- +Testing alias with get_called_class() and get_class() +--FILE-- + +--EXPECTF-- +foo +baz +foo +foo diff --git a/Zend/tests/class_alias_018.phpt b/Zend/tests/class_alias_018.phpt new file mode 100644 index 000000000..4666e76f8 --- /dev/null +++ b/Zend/tests/class_alias_018.phpt @@ -0,0 +1,37 @@ +--TEST-- +Testing class alias with is_subclass_of() +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +bool(false) diff --git a/Zend/tests/class_alias_019.phpt b/Zend/tests/class_alias_019.phpt new file mode 100644 index 000000000..a0dd249d5 --- /dev/null +++ b/Zend/tests/class_alias_019.phpt @@ -0,0 +1,17 @@ +--TEST-- +Trying to redeclare class name in global scope inside namespace +--FILE-- + +--EXPECTF-- +Warning: Cannot redeclare class foo in %s on line %d diff --git a/Zend/tests/class_alias_020.phpt b/Zend/tests/class_alias_020.phpt new file mode 100644 index 000000000..e2c7d9245 --- /dev/null +++ b/Zend/tests/class_alias_020.phpt @@ -0,0 +1,33 @@ +--TEST-- +Testing class alias in multiple namespaces +--FILE-- + +--EXPECTF-- +object(foo\foo)#1 (0) { +} +object(foo\bar\foo)#2 (0) { +} + +Fatal error: Class 'foo\bar' not found in %s on line %d diff --git a/Zend/tests/class_alias_021.phpt b/Zend/tests/class_alias_021.phpt new file mode 100644 index 000000000..dd90e127f --- /dev/null +++ b/Zend/tests/class_alias_021.phpt @@ -0,0 +1,25 @@ +--TEST-- +Overriding internal class with class alias +--FILE-- + +--EXPECTF-- +object(foo\bar)#%d (0) { +} +object(foo\bar)#%d (0) { +} +object(foo\bar)#%d (0) { +} diff --git a/Zend/tests/class_constants_004.phpt b/Zend/tests/class_constants_004.phpt new file mode 100644 index 000000000..73a42ede7 --- /dev/null +++ b/Zend/tests/class_constants_004.phpt @@ -0,0 +1,44 @@ +--TEST-- +Testing constants (normal, namespace, class and interface) +--FILE-- + +--EXPECT-- +int(1) +int(1) +int(1) +int(2) +int(2) +int(3) +int(3) +int(4) +int(4) diff --git a/Zend/tests/class_exists_001.phpt b/Zend/tests/class_exists_001.phpt new file mode 100644 index 000000000..8af96a49f --- /dev/null +++ b/Zend/tests/class_exists_001.phpt @@ -0,0 +1,27 @@ +--TEST-- +Testing class_exists() inside namespace +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(false) +bool(true) +bool(false) diff --git a/Zend/tests/class_exists_002.phpt b/Zend/tests/class_exists_002.phpt new file mode 100644 index 000000000..d326f06ae --- /dev/null +++ b/Zend/tests/class_exists_002.phpt @@ -0,0 +1,26 @@ +--TEST-- +Testing several valid and invalid parameters +--FILE-- + +--EXPECTF-- +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_exists_003.phpt b/Zend/tests/class_exists_003.phpt new file mode 100644 index 000000000..ad7bafa3a --- /dev/null +++ b/Zend/tests/class_exists_003.phpt @@ -0,0 +1,20 @@ +--TEST-- +Checking if exists interface, abstract and final class +--FILE-- + +--EXPECT-- +bool(false) +bool(true) +bool(true) diff --git a/Zend/tests/clone_001.phpt b/Zend/tests/clone_001.phpt new file mode 100644 index 000000000..c8ff8d834 --- /dev/null +++ b/Zend/tests/clone_001.phpt @@ -0,0 +1,10 @@ +--TEST-- +Using clone statement on non-object +--FILE-- + +--EXPECTF-- +Fatal error: __clone method called on non-object in %s on line %d diff --git a/Zend/tests/clone_002.phpt b/Zend/tests/clone_002.phpt new file mode 100644 index 000000000..50156428e --- /dev/null +++ b/Zend/tests/clone_002.phpt @@ -0,0 +1,25 @@ +--TEST-- +Testing multiple clone statements +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) diff --git a/Zend/tests/clone_003.phpt b/Zend/tests/clone_003.phpt new file mode 100644 index 000000000..362e3466e --- /dev/null +++ b/Zend/tests/clone_003.phpt @@ -0,0 +1,12 @@ +--TEST-- +Using clone statement on undefined variable +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: b in %s on line %d + +Fatal error: __clone method called on non-object in %s on line %d diff --git a/Zend/tests/clone_004.phpt b/Zend/tests/clone_004.phpt new file mode 100644 index 000000000..984313ce7 --- /dev/null +++ b/Zend/tests/clone_004.phpt @@ -0,0 +1,20 @@ +--TEST-- +Testing usage of object as array on clone statement +--FILE-- +b[1]; + +?> +--EXPECTF-- +Fatal error: Cannot use object of type foo as array in %s on line %d diff --git a/Zend/tests/clone_uncloneable.phpt b/Zend/tests/clone_uncloneable.phpt deleted file mode 100644 index c991d1060..000000000 --- a/Zend/tests/clone_uncloneable.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -cloning uncloneable object ---SKIPIF-- - ---INI-- -zend.ze1_compatibility_mode=1 ---FILE-- - ---EXPECTF-- -Strict Standards: Assigning the return value of new by reference is deprecated in %s on line %d - -Strict Standards: Implicit cloning object of class 'XSLTProcessor' because of 'zend.ze1_compatibility_mode' in %s on line %d - -Fatal error: Trying to clone uncloneable object of class XSLTProcessor in Unknown on line 0 diff --git a/Zend/tests/closure_001.phpt b/Zend/tests/closure_001.phpt new file mode 100644 index 000000000..ebac729b1 --- /dev/null +++ b/Zend/tests/closure_001.phpt @@ -0,0 +1,30 @@ +--TEST-- +Closure 001: Lambda without lexical variables +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +Hello World! +Hello Universe! +Hello World! +Hello Universe! +Done diff --git a/Zend/tests/closure_002.phpt b/Zend/tests/closure_002.phpt new file mode 100644 index 000000000..023d4ecff --- /dev/null +++ b/Zend/tests/closure_002.phpt @@ -0,0 +1,29 @@ +--TEST-- +Closure 002: Lambda with lexical variables (global scope) +--FILE-- + +--EXPECT-- +4 +4 +4 +5 +Done diff --git a/Zend/tests/closure_003.phpt b/Zend/tests/closure_003.phpt new file mode 100644 index 000000000..6f5cc70bf --- /dev/null +++ b/Zend/tests/closure_003.phpt @@ -0,0 +1,33 @@ +--TEST-- +Closure 003: Lambda with lexical variables (local scope) +--FILE-- + +--EXPECT-- +4 +4 +4 +5 +Done diff --git a/Zend/tests/closure_004.phpt b/Zend/tests/closure_004.phpt new file mode 100644 index 000000000..c1c2efb25 --- /dev/null +++ b/Zend/tests/closure_004.phpt @@ -0,0 +1,35 @@ +--TEST-- +Closure 004: Lambda with lexical variables (scope lifetime) +--FILE-- + +--EXPECT-- +4 +4 +4 +5 +Done diff --git a/Zend/tests/closure_006.phpt b/Zend/tests/closure_006.phpt new file mode 100644 index 000000000..aa0ec1199 --- /dev/null +++ b/Zend/tests/closure_006.phpt @@ -0,0 +1,19 @@ +--TEST-- +Closure 006: Nested lambdas +--FILE-- + +--EXPECT-- +Hello World: 2! +Done diff --git a/Zend/tests/closure_008.phpt b/Zend/tests/closure_008.phpt new file mode 100644 index 000000000..64c7e659e --- /dev/null +++ b/Zend/tests/closure_008.phpt @@ -0,0 +1,22 @@ +--TEST-- +Closure 008: Use in preg_replace_callback() +--FILE-- + +--EXPECT-- +1 2 3 +1  2  3 +1   2   3 +Done diff --git a/Zend/tests/closure_009.phpt b/Zend/tests/closure_009.phpt new file mode 100644 index 000000000..5c576d7e9 --- /dev/null +++ b/Zend/tests/closure_009.phpt @@ -0,0 +1,31 @@ +--TEST-- +Closure 009: Using static vars inside lambda +--FILE-- + +--EXPECT-- +1:1:1 +2:2:1 +3:3:1 +4:1:1 +5:2:1:1 +6:3:2:1:1 diff --git a/Zend/tests/closure_010.phpt b/Zend/tests/closure_010.phpt new file mode 100644 index 000000000..d4787f0a2 --- /dev/null +++ b/Zend/tests/closure_010.phpt @@ -0,0 +1,18 @@ +--TEST-- +Closure 010: Closure calls itself +--FILE-- + +--EXPECT-- +3 +2 +1 +0 diff --git a/Zend/tests/closure_011.phpt b/Zend/tests/closure_011.phpt new file mode 100644 index 000000000..707136463 --- /dev/null +++ b/Zend/tests/closure_011.phpt @@ -0,0 +1,14 @@ +--TEST-- +Closure 011: Lexical copies not static in closure +--FILE-- + +--EXPECT-- +2 diff --git a/Zend/tests/closure_012.phpt b/Zend/tests/closure_012.phpt new file mode 100644 index 000000000..7e1b7a279 --- /dev/null +++ b/Zend/tests/closure_012.phpt @@ -0,0 +1,24 @@ +--TEST-- +Closure 012: Undefined lexical variables +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: i in %sclosure_012.php on line 2 + +Notice: Undefined variable: i in %sclosure_012.php on line 7 +NULL +int(2) + diff --git a/Zend/tests/closure_013.phpt b/Zend/tests/closure_013.phpt new file mode 100644 index 000000000..72d2b3f96 --- /dev/null +++ b/Zend/tests/closure_013.phpt @@ -0,0 +1,25 @@ +--TEST-- +Closure 013: __invoke() on temporary result +--FILE-- +__invoke(); +$test = foo(); +$test->__invoke(); +$test = foo()->__invoke(); +?> +--EXPECT-- +Hello World! +Hello World! +Hello World! diff --git a/Zend/tests/closure_014.phpt b/Zend/tests/closure_014.phpt new file mode 100644 index 000000000..9e4819b9d --- /dev/null +++ b/Zend/tests/closure_014.phpt @@ -0,0 +1,79 @@ +--TEST-- +Closure 014: return by value/reference +--FILE-- +__invoke()); +$x(); +$x->__invoke(); +$x = function() { + return 0; +}; +var_dump($x()); +var_dump($x->__invoke()); +$x(); +$x->__invoke(); + +$x = new C2(); +$a = $b = $c = $d = 1; +$e =& $x($a); +$e = 2; +var_dump($a); +$e =& $x->__invoke($b); +$e = 3; +var_dump($b); +$x($b); +$x->__invoke($b); +$x = function & (&$a) { + return $a; +}; +$e =& $x($c); +$e = 4; +var_dump($c); +$e =& $x->__invoke($d); +$e = 5; +var_dump($d); +$x($d); +$x->__invoke($d); + +$x = new C3(); +var_dump($x()); +var_dump($x->__invoke()); +$x(); +$x->__invoke(); +$x = function() { +}; +var_dump($x()); +var_dump($x->__invoke()); +$x(); +$x->__invoke(); +?> +--EXPECT-- +int(0) +int(0) +int(0) +int(0) +int(2) +int(3) +int(4) +int(5) +NULL +NULL +NULL +NULL diff --git a/Zend/tests/closure_015.phpt b/Zend/tests/closure_015.phpt new file mode 100644 index 000000000..33c732d72 --- /dev/null +++ b/Zend/tests/closure_015.phpt @@ -0,0 +1,19 @@ +--TEST-- +Closure 015: converting to string/unicode +--FILE-- + +--EXPECTF-- +Error: Object of class Closure could not be converted to string at %sclosure_015.php(8) + +Error: Object of class Closure could not be converted to string at %sclosure_015.php(10) diff --git a/Zend/tests/closure_016.phpt b/Zend/tests/closure_016.phpt new file mode 100755 index 000000000..ae0036586 --- /dev/null +++ b/Zend/tests/closure_016.phpt @@ -0,0 +1,51 @@ +--TEST-- +Closure 016: closures and is_callable() +--FILE-- + +--EXPECT-- +bool(true) +Foo::__invoke +bool(true) +Foo::__invoke +bool(true) +Foo::__invoke +bool(true) +Foo::__invoke +bool(true) +Closure::__invoke +bool(true) +Closure::__invoke +bool(true) +Closure::__invoke +bool(true) +Closure::__invoke diff --git a/Zend/tests/closure_017.phpt b/Zend/tests/closure_017.phpt new file mode 100644 index 000000000..45a07f944 --- /dev/null +++ b/Zend/tests/closure_017.phpt @@ -0,0 +1,12 @@ +--TEST-- +Closure 017: Trying to destroy an active lambda function +--FILE-- + +--EXPECTF-- +Fatal error: Cannot destroy active lambda function in %s on line %d diff --git a/Zend/tests/closure_018.phpt b/Zend/tests/closure_018.phpt new file mode 100644 index 000000000..d98c78aea --- /dev/null +++ b/Zend/tests/closure_018.phpt @@ -0,0 +1,28 @@ +--TEST-- +Closure 018: Assigning lambda to static var and returning by ref +--FILE-- +test($y)); +var_dump($x = $test->test($y)); +var_dump($y, $x); + +?> +--EXPECT-- +int(4) +int(16) +int(16) +int(16) diff --git a/Zend/tests/closure_019.phpt b/Zend/tests/closure_019.phpt new file mode 100644 index 000000000..0c4c34e16 --- /dev/null +++ b/Zend/tests/closure_019.phpt @@ -0,0 +1,26 @@ +--TEST-- +Closure 019: Calling lambda using $GLOBALS and global $var +--FILE-- + +--EXPECTF-- +int(9) +int(81) + +Fatal error: Cannot pass parameter 1 by reference in %s on line %d diff --git a/Zend/tests/closure_020.phpt b/Zend/tests/closure_020.phpt new file mode 100644 index 000000000..7b4c60b9b --- /dev/null +++ b/Zend/tests/closure_020.phpt @@ -0,0 +1,52 @@ +--TEST-- +Closure 020: Trying to access private property outside class +--FILE-- +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; + } +} + +$foo = new foo; +$y = $foo->x(); +var_dump($y()->test); + +?> +--EXPECTF-- +object(foo)#%d (%d) { + ["test":"foo":private]=> + int(3) + ["a"]=> + object(Closure)#%d (1) { + ["static"]=> + array(1) { + ["a"]=> + &object(foo)#%d (2) { + ["test":"foo":private]=> + int(3) + ["a"]=> + object(Closure)#%d (1) { + ["static"]=> + array(1) { + ["a"]=> + *RECURSION* + } + } + } + } + } +} +bool(true) +bool(true) + +Fatal error: Cannot access private property foo::$test in %s on line %d diff --git a/Zend/tests/closure_021.phpt b/Zend/tests/closure_021.phpt new file mode 100644 index 000000000..76be762f0 --- /dev/null +++ b/Zend/tests/closure_021.phpt @@ -0,0 +1,22 @@ +--TEST-- +Closure 021: Throwing exception inside lambda +--FILE-- +getMessage()); +} + +?> +--EXPECT-- +string(5) "test!" diff --git a/Zend/tests/closure_022.phpt b/Zend/tests/closure_022.phpt new file mode 100755 index 000000000..8621d2c09 --- /dev/null +++ b/Zend/tests/closure_022.phpt @@ -0,0 +1,12 @@ +--TEST-- +Closure 022: Closure properties +--FILE-- +a = 1; +?> +--EXPECTF-- +Catchable fatal error: Closure object cannot have properties in %sclosure_022.php on line 5 + diff --git a/Zend/tests/closure_023.phpt b/Zend/tests/closure_023.phpt new file mode 100755 index 000000000..634fb6dd5 --- /dev/null +++ b/Zend/tests/closure_023.phpt @@ -0,0 +1,14 @@ +--TEST-- +Closure 023: Closure declared in statically called method +--FILE-- + +--EXPECTF-- +Fatal error: Trying to clone an uncloneable object of class Closure in %s on line %d diff --git a/Zend/tests/closure_025.phpt b/Zend/tests/closure_025.phpt new file mode 100644 index 000000000..8ee187e1c --- /dev/null +++ b/Zend/tests/closure_025.phpt @@ -0,0 +1,12 @@ +--TEST-- +Closure 025: Using closure in create_function() +--FILE-- +__invoke(4)); + +?> +--EXPECT-- +int(8) diff --git a/Zend/tests/closure_026.phpt b/Zend/tests/closure_026.phpt new file mode 100644 index 000000000..f9e6bd5e2 --- /dev/null +++ b/Zend/tests/closure_026.phpt @@ -0,0 +1,47 @@ +--TEST-- +Closure 026: Assigning a closure object to an array in $this +--FILE-- +a[] = function() { + return 1; + }; + + var_dump($this); + + var_dump($this->a[0]()); + } +} + +$x = new foo; + +print "--------------\n"; + +foreach ($x as $b => $c) { + var_dump($b, $c); + var_dump($c[0]()); +} + +?> +--EXPECTF-- +object(foo)#%d (1) { + ["a"]=> + array(1) { + [0]=> + object(Closure)#%d (0) { + } + } +} +int(1) +-------------- +string(1) "a" +array(1) { + [0]=> + object(Closure)#%d (0) { + } +} +int(1) diff --git a/Zend/tests/closure_027.phpt b/Zend/tests/closure_027.phpt new file mode 100644 index 000000000..f26e11404 --- /dev/null +++ b/Zend/tests/closure_027.phpt @@ -0,0 +1,31 @@ +--TEST-- +Closure 027: Testing Closure type-hint +--FILE-- + +--EXPECTF-- +object(stdClass)#%d (0) { +} +NULL + +Notice: Undefined variable: y in %s on line %d + +Warning: Missing argument 1 for {closure}(), called in %s on line %d and defined in %s on line %d +NULL + +Catchable fatal error: 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 on line %d diff --git a/Zend/tests/closure_028.phpt b/Zend/tests/closure_028.phpt new file mode 100644 index 000000000..35840755d --- /dev/null +++ b/Zend/tests/closure_028.phpt @@ -0,0 +1,14 @@ +--TEST-- +Closure 028: Trying to use lambda directly in foreach +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/closure_029.phpt b/Zend/tests/closure_029.phpt new file mode 100644 index 000000000..8d909c025 --- /dev/null +++ b/Zend/tests/closure_029.phpt @@ -0,0 +1,14 @@ +--TEST-- +Closure 029: Testing lambda with instanceof operator +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) diff --git a/Zend/tests/closure_030.phpt b/Zend/tests/closure_030.phpt new file mode 100644 index 000000000..318d2150a --- /dev/null +++ b/Zend/tests/closure_030.phpt @@ -0,0 +1,20 @@ +--TEST-- +Closure 030: Using lambda with variable variables +--FILE-- +__invoke(2)); + +?> +--EXPECT-- +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(2) +} diff --git a/Zend/tests/closure_031.phpt b/Zend/tests/closure_031.phpt new file mode 100644 index 000000000..dace4a4e7 --- /dev/null +++ b/Zend/tests/closure_031.phpt @@ -0,0 +1,16 @@ +--TEST-- +Closure 031: Closure properties with custom error handlers +--FILE-- +a); +?> +--EXPECT-- +Error: Closure object cannot have properties +NULL + diff --git a/Zend/tests/closure_032.phpt b/Zend/tests/closure_032.phpt new file mode 100644 index 000000000..412a923a3 --- /dev/null +++ b/Zend/tests/closure_032.phpt @@ -0,0 +1,70 @@ +--TEST-- +Closure 032: Testing Closure and debug_backtrace +--FILE-- + +--EXPECTF-- +Array +( + [0] => Array + ( + [file] => %s + [line] => %d + [function] => {closure} + [args] => Array + ( + [0] => 23 + ) + + ) + +) +#0 {closure}(23) called at [%s:%d] +Array +( + [0] => Array + ( + [file] => %s + [line] => %d + [function] => {closure} + [args] => Array + ( + [0] => 23 + ) + + ) + + [1] => Array + ( + [file] => %s + [line] => %d + [function] => test + [args] => Array + ( + [0] => Closure Object + ( + [parameter] => Array + ( + [$param] => + ) + + ) + + ) + + ) + +) +#0 {closure}(23) called at [%s:%d] +#1 test(Closure Object ()) called at [%s:%d] + diff --git a/Zend/tests/closure_033.phpt b/Zend/tests/closure_033.phpt new file mode 100755 index 000000000..f6510066b --- /dev/null +++ b/Zend/tests/closure_033.phpt @@ -0,0 +1,28 @@ +--TEST-- +Closure 033: Dynamic closure property and private function +--FILE-- +func = function() { + echo __METHOD__ . "()\n"; + }; + } + private function func() { + echo __METHOD__ . "()\n"; + } +} + +$o = new Test; +$f = $o->func; +$f(); +$o->func(); + +?> +===DONE=== +--EXPECTF-- +Test::{closure}() + +Fatal error: Call to private method Test::func() from context '' in %sclosure_033.php on line %d diff --git a/Zend/tests/constants/dir-constant-eval.phpt b/Zend/tests/constants/dir-constant-eval.phpt new file mode 100755 index 000000000..8fe619d56 --- /dev/null +++ b/Zend/tests/constants/dir-constant-eval.phpt @@ -0,0 +1,8 @@ +--TEST-- +__DIR__ constant used with eval() +--FILE-- + +--EXPECTF-- +%stests%sconstants diff --git a/Zend/tests/constants/dir-constant-includes.phpt b/Zend/tests/constants/dir-constant-includes.phpt new file mode 100755 index 000000000..8ea65292d --- /dev/null +++ b/Zend/tests/constants/dir-constant-includes.phpt @@ -0,0 +1,22 @@ +--TEST-- +__DIR__ constant test with includes +--FILE-- + +--EXPECTF-- +%stests%sconstants +%stests%sconstants +%stests%sconstants%sfixtures%sfolder1 +%stests%sconstants%sfixtures%sfolder1 +%stests%sconstants%sfixtures%sfolder2 +%stests%sconstants%sfixtures%sfolder2 +%stests%sconstants%sfixtures%sfolder3 +%stests%sconstants%sfixtures%sfolder3 +%stests%sconstants%sfixtures%sfolder4 +%stests%sconstants%sfixtures%sfolder4 diff --git a/Zend/tests/constants/dir-constant-nested_includes.phpt b/Zend/tests/constants/dir-constant-nested_includes.phpt new file mode 100755 index 000000000..18bdfa891 --- /dev/null +++ b/Zend/tests/constants/dir-constant-nested_includes.phpt @@ -0,0 +1,70 @@ +--TEST-- +__DIR__ constant test with nested includes +--FILE-- + +--EXPECTF-- +%stests%sconstants +%stests%sconstants +%stests%sconstants%sfixtures%sfolder1 +%stests%sconstants%sfixtures%sfolder1 +%stests%sconstants%sfixtures%sfolder1%ssubfolder1 +%stests%sconstants%sfixtures%sfolder1%ssubfolder1 +%stests%sconstants%sfixtures%sfolder1%ssubfolder2 +%stests%sconstants%sfixtures%sfolder1%ssubfolder2 +%stests%sconstants%sfixtures%sfolder1%ssubfolder3 +%stests%sconstants%sfixtures%sfolder1%ssubfolder3 +%stests%sconstants%sfixtures%sfolder1%ssubfolder4 +%stests%sconstants%sfixtures%sfolder1%ssubfolder4 +%stests%sconstants%sfixtures%sfolder2 +%stests%sconstants%sfixtures%sfolder2 +%stests%sconstants%sfixtures%sfolder2%ssubfolder1 +%stests%sconstants%sfixtures%sfolder2%ssubfolder1 +%stests%sconstants%sfixtures%sfolder2%ssubfolder2 +%stests%sconstants%sfixtures%sfolder2%ssubfolder2 +%stests%sconstants%sfixtures%sfolder2%ssubfolder3 +%stests%sconstants%sfixtures%sfolder2%ssubfolder3 +%stests%sconstants%sfixtures%sfolder2%ssubfolder4 +%stests%sconstants%sfixtures%sfolder2%ssubfolder4 +%stests%sconstants%sfixtures%sfolder3 +%stests%sconstants%sfixtures%sfolder3 +%stests%sconstants%sfixtures%sfolder3%ssubfolder1 +%stests%sconstants%sfixtures%sfolder3%ssubfolder1 +%stests%sconstants%sfixtures%sfolder3%ssubfolder2 +%stests%sconstants%sfixtures%sfolder3%ssubfolder2 +%stests%sconstants%sfixtures%sfolder3%ssubfolder3 +%stests%sconstants%sfixtures%sfolder3%ssubfolder3 +%stests%sconstants%sfixtures%sfolder3%ssubfolder4 +%stests%sconstants%sfixtures%sfolder3%ssubfolder4 +%stests%sconstants%sfixtures%sfolder4 +%stests%sconstants%sfixtures%sfolder4 +%stests%sconstants%sfixtures%sfolder4%ssubfolder1 +%stests%sconstants%sfixtures%sfolder4%ssubfolder1 +%stests%sconstants%sfixtures%sfolder4%ssubfolder2 +%stests%sconstants%sfixtures%sfolder4%ssubfolder2 +%stests%sconstants%sfixtures%sfolder4%ssubfolder3 +%stests%sconstants%sfixtures%sfolder4%ssubfolder3 +%stests%sconstants%sfixtures%sfolder4%ssubfolder4 +%stests%sconstants%sfixtures%sfolder4%ssubfolder4 diff --git a/Zend/tests/constants/dir-constant-normal.phpt b/Zend/tests/constants/dir-constant-normal.phpt new file mode 100755 index 000000000..1a573a205 --- /dev/null +++ b/Zend/tests/constants/dir-constant-normal.phpt @@ -0,0 +1,10 @@ +--TEST-- +Standard behaviour of __DIR__ +--FILE-- + +--EXPECTF-- +%stests%sconstants +%stests%sconstants diff --git a/Zend/tests/constants/fixtures/folder1/fixture.php b/Zend/tests/constants/fixtures/folder1/fixture.php new file mode 100755 index 000000000..3406c998a --- /dev/null +++ b/Zend/tests/constants/fixtures/folder1/fixture.php @@ -0,0 +1,3 @@ + +--EXPECTF-- +Notice: Constant 1 already defined in %s on line %d +int(2) +int(2) +int(2) +int(1) +int(3) diff --git a/Zend/tests/constants_002.phpt b/Zend/tests/constants_002.phpt new file mode 100644 index 000000000..2e769f5db --- /dev/null +++ b/Zend/tests/constants_002.phpt @@ -0,0 +1,24 @@ +--TEST-- +Defining constants with non-scalar values +--FILE-- + +--EXPECTF-- +Warning: Constants may only evaluate to scalar values in %s on line %d + +Notice: Use of undefined constant foo - assumed 'foo' in %s on line %d +string(%d) "foo" +resource(%d) of type (stream) +--UEXPECTF-- +Warning: Constants may only evaluate to scalar values in %s on line %d + +Notice: Use of undefined constant foo - assumed 'foo' in %s on line %d +unicode(%d) "foo" +resource(%d) of type (stream) diff --git a/Zend/tests/constants_003.phpt b/Zend/tests/constants_003.phpt new file mode 100644 index 000000000..205f95f03 --- /dev/null +++ b/Zend/tests/constants_003.phpt @@ -0,0 +1,21 @@ +--TEST-- +Using namespace constants and constants of global scope +--FILE-- + +--EXPECT-- +int(1) +int(1) +int(1) +int(2) +int(2) +int(1) diff --git a/Zend/tests/constants_004.phpt b/Zend/tests/constants_004.phpt new file mode 100644 index 000000000..69369aa3d --- /dev/null +++ b/Zend/tests/constants_004.phpt @@ -0,0 +1,13 @@ +--TEST-- +Trying to redeclare constant inside namespace +--FILE-- + +--EXPECTF-- +Notice: Constant foo\foo already defined in %s on line %d diff --git a/Zend/tests/constants_005.phpt b/Zend/tests/constants_005.phpt new file mode 100755 index 000000000..097be97e1 --- /dev/null +++ b/Zend/tests/constants_005.phpt @@ -0,0 +1,11 @@ +--TEST-- +Persistent case insensetive and user defined constants +--FILE-- + +--EXPECTF-- +bool(%s) +int(123) diff --git a/Zend/tests/constants_006.phpt b/Zend/tests/constants_006.phpt new file mode 100644 index 000000000..6458a0782 --- /dev/null +++ b/Zend/tests/constants_006.phpt @@ -0,0 +1,32 @@ +--TEST-- +Magic constants lowercased +--FILE-- + +--EXPECTF-- +string(%d) "%s" +string(%d) "%s" +int(%d) +string(21) "test\foo::__construct" +string(8) "test\foo" +string(11) "__construct" +string(4) "test" diff --git a/Zend/tests/constants_007.phpt b/Zend/tests/constants_007.phpt new file mode 100644 index 000000000..7d9f3feb7 --- /dev/null +++ b/Zend/tests/constants_007.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing const names +--FILE-- + +--EXPECT-- +string(1) "a" +string(1) "b" +string(1) "c" +string(1) "d" diff --git a/Zend/tests/constants_008.phpt b/Zend/tests/constants_008.phpt new file mode 100644 index 000000000..226e147ff --- /dev/null +++ b/Zend/tests/constants_008.phpt @@ -0,0 +1,17 @@ +--TEST-- +Defining constant twice with two different forms +--FILE-- + +--EXPECTF-- +Notice: Constant a already defined in %s on line %d +2 diff --git a/Zend/tests/constants_009.phpt b/Zend/tests/constants_009.phpt new file mode 100644 index 000000000..ea986dd3c --- /dev/null +++ b/Zend/tests/constants_009.phpt @@ -0,0 +1,25 @@ +--TEST-- +Accessing constants inside namespace +--FILE-- + +--EXPECT-- +int(2) +int(1) +int(1) +bool(true) diff --git a/Zend/tests/constructor_args.phpt b/Zend/tests/constructor_args.phpt new file mode 100644 index 000000000..805687428 --- /dev/null +++ b/Zend/tests/constructor_args.phpt @@ -0,0 +1,20 @@ +--TEST-- +Different numbers of arguments in __construct() +--FILE-- + +--EXPECT-- +ok! diff --git a/Zend/tests/dynamic_call_001.phpt b/Zend/tests/dynamic_call_001.phpt new file mode 100644 index 000000000..94e4203ca --- /dev/null +++ b/Zend/tests/dynamic_call_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +Testing dynamic call to constructor (old-style) +--FILE-- + +--EXPECTF-- +Fatal error: Non-static method foo::foo() cannot be called statically in %s on line %d diff --git a/Zend/tests/dynamic_call_002.phpt b/Zend/tests/dynamic_call_002.phpt new file mode 100644 index 000000000..dcb152969 --- /dev/null +++ b/Zend/tests/dynamic_call_002.phpt @@ -0,0 +1,12 @@ +--TEST-- +Testing dynamic call with invalid value for method name +--FILE-- + +--EXPECTF-- +Fatal error: Function name must be a string in %s on line %d diff --git a/Zend/tests/dynamic_call_003.phpt b/Zend/tests/dynamic_call_003.phpt new file mode 100644 index 000000000..15b830ec6 --- /dev/null +++ b/Zend/tests/dynamic_call_003.phpt @@ -0,0 +1,13 @@ +--TEST-- +Testing dynamic call with invalid method name +--FILE-- + +--EXPECTF-- +Fatal error: Function name must be a string in %s on line %d diff --git a/Zend/tests/dynamic_call_004.phpt b/Zend/tests/dynamic_call_004.phpt new file mode 100644 index 000000000..6e833035a --- /dev/null +++ b/Zend/tests/dynamic_call_004.phpt @@ -0,0 +1,12 @@ +--TEST-- +Testing dynamic call with undefined variables +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: a in %s on line %d + +Fatal error: Class name must be a valid object or a string in %s on line %d diff --git a/Zend/tests/each_001.phpt b/Zend/tests/each_001.phpt new file mode 100644 index 000000000..06ab52a9c --- /dev/null +++ b/Zend/tests/each_001.phpt @@ -0,0 +1,10 @@ +--TEST-- +Testing each() with an undefined variable +--FILE-- + +--EXPECTF-- +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 new file mode 100644 index 000000000..f47ded4b1 --- /dev/null +++ b/Zend/tests/each_002.phpt @@ -0,0 +1,30 @@ +--TEST-- +Testing each() with array and object +--FILE-- + +--EXPECTF-- +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 new file mode 100644 index 000000000..8c0c32a7f --- /dev/null +++ b/Zend/tests/each_003.phpt @@ -0,0 +1,37 @@ +--TEST-- +Testing each() with recursion +--FILE-- + +--EXPECTF-- +array(4) { + [1]=> + array(0) { + } + ["value"]=> + array(0) { + } + [0]=> + int(0) + ["key"]=> + int(0) +} +--UEXPECTF-- +array(4) { + [1]=> + array(0) { + } + [u"value"]=> + array(0) { + } + [0]=> + int(0) + [u"key"]=> + int(0) +} diff --git a/Zend/tests/errmsg_024.phpt b/Zend/tests/errmsg_024.phpt index d8d06cbce..011e6fdea 100644 --- a/Zend/tests/errmsg_024.phpt +++ b/Zend/tests/errmsg_024.phpt @@ -1,5 +1,5 @@ --TEST-- -errmsg: cannot change initial value of property +No more errmsg: can now change initial value of property --FILE-- --EXPECTF-- -Fatal error: Cannot change initial value of property static protected test1::$var in class test in %s on line %d +Done diff --git a/Zend/tests/errmsg_044.phpt b/Zend/tests/errmsg_044.phpt new file mode 100644 index 000000000..e908845ae --- /dev/null +++ b/Zend/tests/errmsg_044.phpt @@ -0,0 +1,11 @@ +--TEST-- +Trying use object of type stdClass as array +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use object of type stdClass as array in %s on line %d diff --git a/Zend/tests/error_reporting01.phpt b/Zend/tests/error_reporting01.phpt index 60be02390..096977065 100644 --- a/Zend/tests/error_reporting01.phpt +++ b/Zend/tests/error_reporting01.phpt @@ -22,5 +22,5 @@ var_dump(error_reporting()); echo "Done\n"; ?> --EXPECT-- -int(6143) +int(30719) Done diff --git a/Zend/tests/error_reporting02.phpt b/Zend/tests/error_reporting02.phpt index 227d8c6f2..f4786639c 100644 --- a/Zend/tests/error_reporting02.phpt +++ b/Zend/tests/error_reporting02.phpt @@ -23,5 +23,5 @@ var_dump(error_reporting()); echo "Done\n"; ?> --EXPECT-- -int(8191) +int(32767) Done diff --git a/Zend/tests/error_reporting03.phpt b/Zend/tests/error_reporting03.phpt index ec916048d..3c6595cea 100644 --- a/Zend/tests/error_reporting03.phpt +++ b/Zend/tests/error_reporting03.phpt @@ -31,5 +31,5 @@ echo "Done\n"; ?> --EXPECTF-- Notice: Undefined variable: undef2 in %s on line %d -int(8191) +int(32767) Done diff --git a/Zend/tests/error_reporting04.phpt b/Zend/tests/error_reporting04.phpt index 1d7d678b2..295a3a4d4 100644 --- a/Zend/tests/error_reporting04.phpt +++ b/Zend/tests/error_reporting04.phpt @@ -19,5 +19,5 @@ echo "Done\n"; ?> --EXPECTF-- Notice: Undefined variable: undef in %s on line %d -int(8191) +int(32767) Done diff --git a/Zend/tests/error_reporting05.phpt b/Zend/tests/error_reporting05.phpt index 71fee17f4..2bf392d7c 100644 --- a/Zend/tests/error_reporting05.phpt +++ b/Zend/tests/error_reporting05.phpt @@ -30,5 +30,5 @@ echo "Done\n"; Notice: Undefined variable: undef_value in %s on line %d Notice: Undefined variable: undef_name in %s on line %d -int(6143) +int(30719) Done diff --git a/Zend/tests/error_reporting06.phpt b/Zend/tests/error_reporting06.phpt index f472d3405..beb91bf09 100644 --- a/Zend/tests/error_reporting06.phpt +++ b/Zend/tests/error_reporting06.phpt @@ -26,5 +26,5 @@ var_dump(error_reporting()); echo "Done\n"; ?> --EXPECTF-- -int(6143) +int(30719) Done diff --git a/Zend/tests/error_reporting07.phpt b/Zend/tests/error_reporting07.phpt index 696a3757e..5da970c15 100644 --- a/Zend/tests/error_reporting07.phpt +++ b/Zend/tests/error_reporting07.phpt @@ -26,5 +26,5 @@ var_dump(error_reporting()); echo "Done\n"; ?> --EXPECTF-- -int(6143) +int(30719) Done diff --git a/Zend/tests/error_reporting08.phpt b/Zend/tests/error_reporting08.phpt index 362aa3765..edf329277 100644 --- a/Zend/tests/error_reporting08.phpt +++ b/Zend/tests/error_reporting08.phpt @@ -28,5 +28,5 @@ echo "Done\n"; ?> --EXPECTF-- Notice: Undefined variable: undef3 in %s on line %d -int(8191) +int(32767) Done diff --git a/Zend/tests/error_reporting09.phpt b/Zend/tests/error_reporting09.phpt index 193758148..8d4e7e1b1 100644 --- a/Zend/tests/error_reporting09.phpt +++ b/Zend/tests/error_reporting09.phpt @@ -27,5 +27,5 @@ echo "Done\n"; Notice: Undefined variable: blah in %s on line %d Notice: Undefined variable: undef2 in %s on line %d -int(8191) +int(32767) Done diff --git a/Zend/tests/error_reporting10.phpt b/Zend/tests/error_reporting10.phpt index 1d0abb10f..7205acda3 100644 --- a/Zend/tests/error_reporting10.phpt +++ b/Zend/tests/error_reporting10.phpt @@ -30,6 +30,6 @@ var_dump(error_reporting()); echo "Done\n"; ?> --EXPECTF-- -int(6143) -int(6135) +int(30719) +int(30711) Done diff --git a/Zend/tests/exception_001.phpt b/Zend/tests/exception_001.phpt new file mode 100644 index 000000000..ab74a920e --- /dev/null +++ b/Zend/tests/exception_001.phpt @@ -0,0 +1,38 @@ +--TEST-- +Testing nested exceptions +--FILE-- +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; +} + +?> +--EXPECTF-- +string(0) "" +string(0) "" +string(0) "" +string(0) "" + +Fatal error: Uncaught exception 'Exception' in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/exception_002.phpt b/Zend/tests/exception_002.phpt new file mode 100644 index 000000000..25f0c61f9 --- /dev/null +++ b/Zend/tests/exception_002.phpt @@ -0,0 +1,19 @@ +--TEST-- +Testing exception and GOTO +--FILE-- + +--EXPECT-- +2 diff --git a/Zend/tests/exception_003.phpt b/Zend/tests/exception_003.phpt new file mode 100644 index 000000000..e060aace0 --- /dev/null +++ b/Zend/tests/exception_003.phpt @@ -0,0 +1,14 @@ +--TEST-- +Throwing exception in global scope +--FILE-- + +--EXPECTF-- + +Fatal error: Uncaught exception 'Exception' with message '1' in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/exception_004.phpt b/Zend/tests/exception_004.phpt new file mode 100644 index 000000000..77d947f47 --- /dev/null +++ b/Zend/tests/exception_004.phpt @@ -0,0 +1,18 @@ +--TEST-- +Throwing exception using a class that isn't derived from the Exception base class +--FILE-- + +--EXPECTF-- +Fatal error: Exceptions must be valid objects derived from the Exception base class in %s on line %d diff --git a/Zend/tests/exception_005.phpt b/Zend/tests/exception_005.phpt new file mode 100644 index 000000000..45a926960 --- /dev/null +++ b/Zend/tests/exception_005.phpt @@ -0,0 +1,12 @@ +--TEST-- +Trying to throw exception of an interface +--FILE-- + +--EXPECTF-- +Fatal error: Cannot instantiate interface a in %s on line %d diff --git a/Zend/tests/exception_006.phpt b/Zend/tests/exception_006.phpt new file mode 100644 index 000000000..5c981fc1b --- /dev/null +++ b/Zend/tests/exception_006.phpt @@ -0,0 +1,10 @@ +--TEST-- +Trying to throw a non-object +--FILE-- + +--EXPECTF-- +Fatal error: Can only throw objects in %s on line %d diff --git a/Zend/tests/exception_007.phpt b/Zend/tests/exception_007.phpt new file mode 100755 index 000000000..953e76513 --- /dev/null +++ b/Zend/tests/exception_007.phpt @@ -0,0 +1,36 @@ +--TEST-- +Setting previous exception +--FILE-- + +===DONE=== +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' with message 'Another' in %sexception_007.php:%d +Stack trace: +#0 {main} + +Next exception 'Exception' with message 'First' in %sexception_007.php:%d +Stack trace: +#0 {main} + +Next exception 'Exception' with message 'Second' in %sexception_007.php:%d +Stack trace: +#0 {main} + +Next exception 'Exception' with message 'Third' in %sexception_007.php:%d +Stack trace: +#0 {main} + thrown in %sexception_007.php on line %d diff --git a/Zend/tests/exception_008.phpt b/Zend/tests/exception_008.phpt new file mode 100755 index 000000000..0d40541ee --- /dev/null +++ b/Zend/tests/exception_008.phpt @@ -0,0 +1,36 @@ +--TEST-- +Exception in __destruct while exception is pending +--FILE-- + +===DONE=== +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' with message 'First' in %sexception_008.php:%d +Stack trace: +#0 %sexception_008.php(%d): TestFirst->__destruct() +#1 {main} + +Next exception 'Exception' with message 'Second' in %sexception_008.php:%d +Stack trace: +#0 %sexception_008.php(%d): TestSecond->__destruct() +#1 {main} + thrown in %sexception_008.php on line %d diff --git a/Zend/tests/exception_handler_004.phpt b/Zend/tests/exception_handler_004.phpt index 2f367817e..bf581bbed 100644 --- a/Zend/tests/exception_handler_004.phpt +++ b/Zend/tests/exception_handler_004.phpt @@ -15,7 +15,7 @@ Warning: set_exception_handler() expects the argument (fo) to be a valid callbac Warning: set_exception_handler() expects the argument (::) to be a valid callback in %s on line %d -Warning: Wrong parameter count for set_exception_handler() in %s on line %d +Warning: set_exception_handler() expects exactly 1 parameter, 0 given in %s on line %d -Warning: Wrong parameter count for set_exception_handler() 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/float_prec_001.phpt b/Zend/tests/float_prec_001.phpt new file mode 100644 index 000000000..ffddab473 --- /dev/null +++ b/Zend/tests/float_prec_001.phpt @@ -0,0 +1,10 @@ +--TEST-- +Double precision is used for floating point calculations +--FILE-- + +--EXPECT-- +bool(true) +string(10) "0.00287699" diff --git a/Zend/tests/foreach_002.phpt b/Zend/tests/foreach_002.phpt new file mode 100644 index 000000000..643e65392 --- /dev/null +++ b/Zend/tests/foreach_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +Creating recursive array on foreach using same variable +--FILE-- + array('a' => &$a))) as $a) { + var_dump($a); +} + +?> +--EXPECT-- +array(1) { + ["a"]=> + &array(1) { + ["a"]=> + &array(1) { + ["a"]=> + *RECURSION* + } + } +} diff --git a/Zend/tests/foreach_unset_globals.phpt b/Zend/tests/foreach_unset_globals.phpt new file mode 100644 index 000000000..188c70ab1 --- /dev/null +++ b/Zend/tests/foreach_unset_globals.phpt @@ -0,0 +1,21 @@ +--TEST-- +traverse an array and use its keys to unset GLOBALS +--FILE-- + 1, "b" => 2); +foreach ($arr as $key => $val) { + unset($GLOBALS[$key]); +} + +var_dump($arr); +echo "Done\n"; +?> +--EXPECTF-- +array(2) { + ["a"]=> + int(1) + ["b"]=> + int(2) +} +Done diff --git a/Zend/tests/gc_001.phpt b/Zend/tests/gc_001.phpt new file mode 100644 index 000000000..0523c7319 --- /dev/null +++ b/Zend/tests/gc_001.phpt @@ -0,0 +1,12 @@ +--TEST-- +GC 001: gc_enable()/gc_diable()/gc_enabled() +--FILE-- + +--EXPECT-- +bool(false) +bool(true) diff --git a/Zend/tests/gc_002.phpt b/Zend/tests/gc_002.phpt new file mode 100644 index 000000000..439520c46 --- /dev/null +++ b/Zend/tests/gc_002.phpt @@ -0,0 +1,16 @@ +--TEST-- +GC 002: gc_enable()/gc_diable() and ini_get() +--FILE-- + +--EXPECT-- +bool(false) +0 +bool(true) +1 diff --git a/Zend/tests/gc_003.phpt b/Zend/tests/gc_003.phpt new file mode 100644 index 000000000..c2df57bd3 --- /dev/null +++ b/Zend/tests/gc_003.phpt @@ -0,0 +1,16 @@ +--TEST-- +GC 003: gc_enabled() and ini_set() +--FILE-- + +--EXPECT-- +bool(false) +0 +bool(true) +1 diff --git a/Zend/tests/gc_004.phpt b/Zend/tests/gc_004.phpt new file mode 100644 index 000000000..ce6a94b79 --- /dev/null +++ b/Zend/tests/gc_004.phpt @@ -0,0 +1,24 @@ +--TEST-- +GC 004: Simple array cycle +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + &array(1) { + [0]=> + &array(1) { + [0]=> + *RECURSION* + } + } +} +int(1) +ok diff --git a/Zend/tests/gc_005.phpt b/Zend/tests/gc_005.phpt new file mode 100644 index 000000000..0660ded2f --- /dev/null +++ b/Zend/tests/gc_005.phpt @@ -0,0 +1,21 @@ +--TEST-- +GC 005: Simple object cycle +--FILE-- +a = $a; +var_dump($a); +unset($a); +var_dump(gc_collect_cycles()); +echo "ok\n" +?> +--EXPECT-- +object(stdClass)#1 (1) { + ["a"]=> + object(stdClass)#1 (1) { + ["a"]=> + *RECURSION* + } +} +int(1) +ok diff --git a/Zend/tests/gc_006.phpt b/Zend/tests/gc_006.phpt new file mode 100644 index 000000000..4ba0d9267 --- /dev/null +++ b/Zend/tests/gc_006.phpt @@ -0,0 +1,28 @@ +--TEST-- +GC 006: Simple array-object cycle +--FILE-- +a = array(); +$a->a[0] =& $a; +var_dump($a); +unset($a); +var_dump(gc_collect_cycles()); +echo "ok\n" +?> +--EXPECT-- +object(stdClass)#1 (1) { + ["a"]=> + array(1) { + [0]=> + &object(stdClass)#1 (1) { + ["a"]=> + array(1) { + [0]=> + *RECURSION* + } + } + } +} +int(2) +ok diff --git a/Zend/tests/gc_007.phpt b/Zend/tests/gc_007.phpt new file mode 100644 index 000000000..4baa5e666 --- /dev/null +++ b/Zend/tests/gc_007.phpt @@ -0,0 +1,26 @@ +--TEST-- +GC 007: Unreferensed array cycle +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + &array(1) { + [0]=> + &array(1) { + [0]=> + *RECURSION* + } + } +} +int(0) +int(1) +ok diff --git a/Zend/tests/gc_008.phpt b/Zend/tests/gc_008.phpt new file mode 100644 index 000000000..b62504bd2 --- /dev/null +++ b/Zend/tests/gc_008.phpt @@ -0,0 +1,24 @@ +--TEST-- +GC 008: Unreferensed object cycle +--FILE-- +a = new stdClass(); +$a->a->a = $a->a; +var_dump($a->a); +var_dump(gc_collect_cycles()); +unset($a); +var_dump(gc_collect_cycles()); +echo "ok\n" +?> +--EXPECT-- +object(stdClass)#2 (1) { + ["a"]=> + object(stdClass)#2 (1) { + ["a"]=> + *RECURSION* + } +} +int(0) +int(1) +ok diff --git a/Zend/tests/gc_009.phpt b/Zend/tests/gc_009.phpt new file mode 100644 index 000000000..02ee1ae03 --- /dev/null +++ b/Zend/tests/gc_009.phpt @@ -0,0 +1,31 @@ +--TEST-- +GC 009: Unreferensed array-object cycle +--FILE-- +a = array(); +$a[0]->a[0] =& $a[0]; +var_dump($a[0]); +var_dump(gc_collect_cycles()); +unset($a); +var_dump(gc_collect_cycles()); +echo "ok\n" +?> +--EXPECT-- +object(stdClass)#1 (1) { + ["a"]=> + array(1) { + [0]=> + &object(stdClass)#1 (1) { + ["a"]=> + array(1) { + [0]=> + *RECURSION* + } + } + } +} +int(0) +int(2) +ok diff --git a/Zend/tests/gc_010.phpt b/Zend/tests/gc_010.phpt new file mode 100644 index 000000000..d39ef8a09 --- /dev/null +++ b/Zend/tests/gc_010.phpt @@ -0,0 +1,25 @@ +--TEST-- +GC 010: Cycle with reference to $GLOBALS +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + &array(1) { + [0]=> + &array(1) { + [0]=> + *RECURSION* + } + } +} +int(1) +ok diff --git a/Zend/tests/gc_011.phpt b/Zend/tests/gc_011.phpt new file mode 100644 index 000000000..97819be23 --- /dev/null +++ b/Zend/tests/gc_011.phpt @@ -0,0 +1,28 @@ +--TEST-- +GC 011: GC and destructors +--FILE-- +a = $a; +var_dump($a); +unset($a); +var_dump(gc_collect_cycles()); +echo "ok\n" +?> +--EXPECT-- +object(Foo)#1 (1) { + ["a"]=> + object(Foo)#1 (1) { + ["a"]=> + *RECURSION* + } +} +__destruct +int(1) +ok diff --git a/Zend/tests/gc_012.phpt b/Zend/tests/gc_012.phpt new file mode 100644 index 000000000..eff76ef31 --- /dev/null +++ b/Zend/tests/gc_012.phpt @@ -0,0 +1,17 @@ +--TEST-- +GC 012: collection of many loops at once +--FILE-- + +--EXPECT-- +int(2) +ok diff --git a/Zend/tests/gc_014.phpt b/Zend/tests/gc_014.phpt new file mode 100644 index 000000000..8167880f9 --- /dev/null +++ b/Zend/tests/gc_014.phpt @@ -0,0 +1,18 @@ +--TEST-- +GC 014: Too many cycles in one object +--FILE-- +{"a".$i} = $a; +} +unset($b); +$a->b = "xxx"; +unset($a); +var_dump(gc_collect_cycles()); +echo "ok\n"; +?> +--EXPECT-- +int(10002) +ok diff --git a/Zend/tests/gc_015.phpt b/Zend/tests/gc_015.phpt new file mode 100644 index 000000000..be3c5eb9d --- /dev/null +++ b/Zend/tests/gc_015.phpt @@ -0,0 +1,18 @@ +--TEST-- +GC 015: Object as root of cycle +--FILE-- +a = $a; +$a->b = "xxx"; +unset($c); +unset($a); +unset($b); +var_dump(gc_collect_cycles()); +echo "ok\n"; +?> +--EXPECT-- +int(2) +ok diff --git a/Zend/tests/gc_016.phpt b/Zend/tests/gc_016.phpt new file mode 100644 index 000000000..6d6a36307 --- /dev/null +++ b/Zend/tests/gc_016.phpt @@ -0,0 +1,24 @@ +--TEST-- +GC 016: nested GC calls +--FILE-- + "; + $a = array(); + $a[] =& $a; + unset($a); + var_dump(gc_collect_cycles()); + } +} +$a = new Foo(); +$a->a = $a; +unset($a); +var_dump(gc_collect_cycles()); +echo "ok\n" +?> +--EXPECT-- +-> int(1) +int(1) +ok diff --git a/Zend/tests/gc_017.phpt b/Zend/tests/gc_017.phpt new file mode 100644 index 000000000..9df04e280 --- /dev/null +++ b/Zend/tests/gc_017.phpt @@ -0,0 +1,41 @@ +--TEST-- +GC 017: GC and destructors with unset +--FILE-- +name = $name; + $this->children = array(); + $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'); +$c = new Node('C'); +$a->insert($b); +$a->insert($c); +unset($a); +unset($b); +unset($c); +var_dump(gc_collect_cycles()); +echo "ok\n" +?> +--EXPECTF-- +string(1) "%s" +string(1) "%s" +string(1) "%s" +int(10) +ok diff --git a/Zend/tests/gc_018.phpt b/Zend/tests/gc_018.phpt new file mode 100644 index 000000000..c202d8cdc --- /dev/null +++ b/Zend/tests/gc_018.phpt @@ -0,0 +1,13 @@ +--TEST-- +GC 018: GC detach with assign +--FILE-- + +--EXPECT-- +int(1) +ok diff --git a/Zend/tests/gc_019.phpt b/Zend/tests/gc_019.phpt new file mode 100644 index 000000000..12400d2f0 --- /dev/null +++ b/Zend/tests/gc_019.phpt @@ -0,0 +1,14 @@ +--TEST-- +GC 019: GC detach with assign by reference +--FILE-- + +--EXPECT-- +int(1) +ok diff --git a/Zend/tests/gc_020.phpt b/Zend/tests/gc_020.phpt new file mode 100644 index 000000000..76e8aff9a --- /dev/null +++ b/Zend/tests/gc_020.phpt @@ -0,0 +1,15 @@ +--TEST-- +GC 020: GC detach reference with assign +--FILE-- + +--EXPECT-- +int(1) +ok diff --git a/Zend/tests/gc_021.phpt b/Zend/tests/gc_021.phpt new file mode 100644 index 000000000..4e6c75094 --- /dev/null +++ b/Zend/tests/gc_021.phpt @@ -0,0 +1,16 @@ +--TEST-- +GC 021: GC detach reference with assign by reference +--FILE-- + +--EXPECT-- +int(2) +ok diff --git a/Zend/tests/gc_022.phpt b/Zend/tests/gc_022.phpt new file mode 100644 index 000000000..0418bf9a0 --- /dev/null +++ b/Zend/tests/gc_022.phpt @@ -0,0 +1,15 @@ +--TEST-- +GC 022: GC detach reference in executor's PZVAL_UNLOCK() +--INI-- +error_reporting=0 +--FILE-- + +--EXPECT-- +int(1) +ok diff --git a/Zend/tests/gc_023.phpt b/Zend/tests/gc_023.phpt new file mode 100644 index 000000000..3c0580129 --- /dev/null +++ b/Zend/tests/gc_023.phpt @@ -0,0 +1,27 @@ +--TEST-- +GC 023: Root buffer overflow (automatic collection) +--FILE-- + +--FILE-- + +--EXPECT-- +int(1) +ok diff --git a/Zend/tests/gc_025.phpt b/Zend/tests/gc_025.phpt new file mode 100644 index 000000000..5ae652725 --- /dev/null +++ b/Zend/tests/gc_025.phpt @@ -0,0 +1,11 @@ +--TEST-- +GC 025: Automatic GC on request shutdown +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/gc_026.phpt b/Zend/tests/gc_026.phpt new file mode 100644 index 000000000..330c4fa48 --- /dev/null +++ b/Zend/tests/gc_026.phpt @@ -0,0 +1,14 @@ +--TEST-- +GC 026: Automatic GC on request shutdown (GC enabled at run-time) +--INI-- +zend.enable_gc=0 +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/gc_027.phpt b/Zend/tests/gc_027.phpt new file mode 100644 index 000000000..9d2418eb4 --- /dev/null +++ b/Zend/tests/gc_027.phpt @@ -0,0 +1,12 @@ +--TEST-- +GC 027: GC and properties of internal classes +--FILE-- +bar !== null) { + unset($this->bar); + } + } +} +class Bar { + public $foo; + function __destruct() { + if ($this->foo !== null) { + unset($this->foo); + } + } + +} +$foo = new Foo(); +$bar = new Bar(); +$foo->bar = $bar; +$bar->foo = $foo; +unset($foo); +unset($bar); +var_dump(gc_collect_cycles()); +?> +--EXPECT-- +int(2) diff --git a/Zend/tests/gc_029.phpt b/Zend/tests/gc_029.phpt new file mode 100644 index 000000000..ea0660eca --- /dev/null +++ b/Zend/tests/gc_029.phpt @@ -0,0 +1,33 @@ +--TEST-- +GC 029: GC and destructors +--FILE-- +bar !== null) { + $this->x = null; + unset($this->bar); + } + } +} +class Bar { + public $foo; + function __destruct() { + if ($this->foo !== null) { + unset($this->foo); + } + } + +} +$foo = new Foo(); +$bar = new Bar(); +$foo->bar = $bar; +$bar->foo = $foo; +unset($foo); +unset($bar); +var_dump(gc_collect_cycles()); +?> +--EXPECT-- +int(2) diff --git a/Zend/tests/gc_030.phpt b/Zend/tests/gc_030.phpt new file mode 100644 index 000000000..27db29d98 --- /dev/null +++ b/Zend/tests/gc_030.phpt @@ -0,0 +1,31 @@ +--TEST-- +GC 030: GC and exceptions in destructors +--FILE-- +foo = $f2; +$f2->foo = $f1; +unset($f1, $f2); +gc_collect_cycles(); +?> +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' with message 'foobar' in %sgc_030.php:%d +Stack trace: +#0 [internal function]: foo->__destruct() +#1 %sgc_030.php(%d): gc_collect_cycles() +#2 {main} + +Next exception 'Exception' with message 'foobar' in %sgc_030.php:%d +Stack trace: +#0 %sgc_030.php(%d): foo->__destruct() +#1 {main} + thrown in %sgc_030.php on line %d \ No newline at end of file diff --git a/Zend/tests/gc_031.phpt b/Zend/tests/gc_031.phpt new file mode 100644 index 000000000..58c4b15e3 --- /dev/null +++ b/Zend/tests/gc_031.phpt @@ -0,0 +1,11 @@ +--TEST-- +GC 031: gc_collect_roots() with GC turned off. +--INI-- +zend.enable_gc=0 +--FILE-- + +--EXPECTF-- +DONE diff --git a/Zend/tests/get_called_class_001.phpt b/Zend/tests/get_called_class_001.phpt new file mode 100644 index 000000000..7012ae812 --- /dev/null +++ b/Zend/tests/get_called_class_001.phpt @@ -0,0 +1,11 @@ +--TEST-- +Calling get_called_class() outside a class +--FILE-- + +--EXPECTF-- +Warning: get_called_class() called from outside a class in %s on line %d +bool(false) diff --git a/Zend/tests/get_parent_class_001.phpt b/Zend/tests/get_parent_class_001.phpt new file mode 100644 index 000000000..5115fe16d --- /dev/null +++ b/Zend/tests/get_parent_class_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +Testing get_parent_class() +--FILE-- +foo(); + +?> +--EXPECT-- +string(3) "bar" +bool(false) +--UEXPECT-- +unicode(3) "bar" +bool(false) diff --git a/Zend/tests/globals_001.phpt b/Zend/tests/globals_001.phpt index b678c5310..0f77104ac 100644 --- a/Zend/tests/globals_001.phpt +++ b/Zend/tests/globals_001.phpt @@ -26,7 +26,7 @@ string(5) "array" int(%d) string(%d) "%s" -Notice: Undefined index: PHP_SELF in %s on line %d +Notice: Undefined index: PHP_SELF in %s on line %d NULL Notice: Undefined variable: _SERVER in %s on line %d diff --git a/Zend/tests/globals_002.phpt b/Zend/tests/globals_002.phpt index 3bc3dae2d..8074eb1db 100644 --- a/Zend/tests/globals_002.phpt +++ b/Zend/tests/globals_002.phpt @@ -29,7 +29,7 @@ string(5) "array" int(%d) string(%d) "%s" -Notice: Undefined index: PHP_SELF in %s on line %d +Notice: Undefined index: PHP_SELF in %s on line %d NULL Notice: Undefined variable: _SERVER in %s on line %d diff --git a/Zend/tests/globals_003.phpt b/Zend/tests/globals_003.phpt index dcc7935a9..9ddae33a1 100644 --- a/Zend/tests/globals_003.phpt +++ b/Zend/tests/globals_003.phpt @@ -35,7 +35,7 @@ string(5) "array" int(%d) string(%d) "%s" -Notice: Undefined index: PHP_SELF in %s on line %d +Notice: Undefined index: PHP_SELF in %s on line %d NULL Notice: Undefined variable: _SERVER in %s on line %d diff --git a/Zend/tests/globals_004.phpt b/Zend/tests/globals_004.phpt index e06791e61..f5da018f7 100644 --- a/Zend/tests/globals_004.phpt +++ b/Zend/tests/globals_004.phpt @@ -20,7 +20,7 @@ string(5) "array" int(%d) string(%d) "%s" -Notice: Undefined index: PHP_SELF in %s on line %d +Notice: Undefined index: PHP_SELF in %s on line %d NULL Notice: Undefined variable: _SERVER in %s on line %d diff --git a/Zend/tests/halt01.phpt b/Zend/tests/halt01.phpt index 7233bdcb1..3af80d07a 100644 --- a/Zend/tests/halt01.phpt +++ b/Zend/tests/halt01.phpt @@ -1,12 +1,12 @@ ---TEST-- -__HALT_COMPILER() basic test ---FILE-- - +--EXPECT-- +This is a heredoc test. +This is another heredoc test. diff --git a/Zend/tests/heredoc_002.phpt b/Zend/tests/heredoc_002.phpt new file mode 100644 index 000000000..481ada996 --- /dev/null +++ b/Zend/tests/heredoc_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +basic binary heredoc syntax +--FILE-- + +--EXPECT-- +This is a heredoc test. +This is another heredoc test. diff --git a/Zend/tests/heredoc_003.phpt b/Zend/tests/heredoc_003.phpt new file mode 100644 index 000000000..fb34f515c --- /dev/null +++ b/Zend/tests/heredoc_003.phpt @@ -0,0 +1,23 @@ +--TEST-- +simple variable replacement test (heredoc) +--FILE-- + +--EXPECT-- +This is heredoc test #1. +This is heredoc test #2. diff --git a/Zend/tests/heredoc_004.phpt b/Zend/tests/heredoc_004.phpt new file mode 100644 index 000000000..29334b8da --- /dev/null +++ b/Zend/tests/heredoc_004.phpt @@ -0,0 +1,23 @@ +--TEST-- +braces variable replacement test (heredoc) +--FILE-- + +--EXPECT-- +This is heredoc test #1. +This is heredoc test #2. diff --git a/Zend/tests/heredoc_005.phpt b/Zend/tests/heredoc_005.phpt new file mode 100644 index 000000000..01a046fd9 --- /dev/null +++ b/Zend/tests/heredoc_005.phpt @@ -0,0 +1,22 @@ +--TEST-- +unbraced complex variable replacement test (heredoc) +--FILE-- +d. + +ENDOFHEREDOC; + +$x = <<d. + +ENDOFHEREDOC; + +print "{$x}"; + +?> +--EXPECTF-- +Parse error: %s in %sheredoc_005.php on line 6 diff --git a/Zend/tests/heredoc_006.phpt b/Zend/tests/heredoc_006.phpt new file mode 100644 index 000000000..d40ae1e02 --- /dev/null +++ b/Zend/tests/heredoc_006.phpt @@ -0,0 +1,23 @@ +--TEST-- +braced complex variable replacement test (heredoc) +--FILE-- +d}. + +ENDOFHEREDOC; + +$x = <<d}. + +ENDOFHEREDOC; + +print "{$x}"; + +?> +--EXPECT-- +This is heredoc test #s 1, 2, 3, and 4. +This is heredoc test #s 1, 2, 3, and 4. diff --git a/Zend/tests/heredoc_007.phpt b/Zend/tests/heredoc_007.phpt new file mode 100644 index 000000000..b823b556f --- /dev/null +++ b/Zend/tests/heredoc_007.phpt @@ -0,0 +1,23 @@ +--TEST-- +braced and unbraced complex variable replacement test (heredoc) +--FILE-- +d}. + +ENDOFHEREDOC; + +$x = <<d}. + +ENDOFHEREDOC; + +print "{$x}"; + +?> +--EXPECT-- +This is heredoc test #s 1, 2, 3, and 4. +This is heredoc test #s 1, 2, 3, and 4. diff --git a/Zend/tests/heredoc_008.phpt b/Zend/tests/heredoc_008.phpt new file mode 100644 index 000000000..8feda035a --- /dev/null +++ b/Zend/tests/heredoc_008.phpt @@ -0,0 +1,17 @@ +--TEST-- +empty doc test (heredoc) +--FILE-- + +--EXPECT-- diff --git a/Zend/tests/heredoc_009.phpt b/Zend/tests/heredoc_009.phpt new file mode 100644 index 000000000..38f5d282f --- /dev/null +++ b/Zend/tests/heredoc_009.phpt @@ -0,0 +1,42 @@ +--TEST-- +Torture the T_END_HEREDOC rules (heredoc) +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: ENDOFHEREDOC in %s on line %d +ENDOFHEREDOC ; + ENDOFHEREDOC; +ENDOFHEREDOC + ENDOFHEREDOC +; + +Notice: Undefined variable: ENDOFHEREDOC in %s on line %d +ENDOFHEREDOC ; + ENDOFHEREDOC; +ENDOFHEREDOC + ENDOFHEREDOC +; diff --git a/Zend/tests/heredoc_010.phpt b/Zend/tests/heredoc_010.phpt new file mode 100644 index 000000000..5aa0433bc --- /dev/null +++ b/Zend/tests/heredoc_010.phpt @@ -0,0 +1,32 @@ +--TEST-- +Torture the T_END_HEREDOC rules with variable expansions (heredoc) +--FILE-- + +--EXPECT-- +ENDOFHEREDOC +ENDOFHEREDOC +ENDOFHEREDOC +ENDOFHEREDOC +ENDOFHEREDOC +ENDOFHEREDOC diff --git a/Zend/tests/heredoc_011.phpt b/Zend/tests/heredoc_011.phpt new file mode 100644 index 000000000..d3b152ae6 --- /dev/null +++ b/Zend/tests/heredoc_011.phpt @@ -0,0 +1,20 @@ +--TEST-- +STATIC heredocs CAN be used as static scalars. +--FILE-- + +--EXPECT-- +If you DON'T see this, something's wrong. diff --git a/Zend/tests/heredoc_012.phpt b/Zend/tests/heredoc_012.phpt new file mode 100644 index 000000000..73f7483bf --- /dev/null +++ b/Zend/tests/heredoc_012.phpt @@ -0,0 +1,12 @@ +--TEST-- +Heredoc with double quotes +--FILE-- + +--EXPECT-- +test: foo diff --git a/Zend/tests/heredoc_013.phpt b/Zend/tests/heredoc_013.phpt new file mode 100644 index 000000000..1ffcf7383 --- /dev/null +++ b/Zend/tests/heredoc_013.phpt @@ -0,0 +1,12 @@ +--TEST-- +Heredoc with double quotes and wrong prefix +--FILE-- + +--EXPECTF-- +Parse error: %s in %sheredoc_013.php on line %d diff --git a/Zend/tests/heredoc_014.phpt b/Zend/tests/heredoc_014.phpt new file mode 100644 index 000000000..8999aa37e --- /dev/null +++ b/Zend/tests/heredoc_014.phpt @@ -0,0 +1,12 @@ +--TEST-- +Heredoc with double quotes syntax but missing second quote +--FILE-- + +--EXPECTF-- +Parse error: %s in %sheredoc_014.php on line %d diff --git a/Zend/tests/heredoc_015.phpt b/Zend/tests/heredoc_015.phpt new file mode 100644 index 000000000..21658cf8a --- /dev/null +++ b/Zend/tests/heredoc_015.phpt @@ -0,0 +1,41 @@ +--TEST-- +Testing heredoc with escape sequences +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/Zend/tests/heredoc_016.phpt b/Zend/tests/heredoc_016.phpt new file mode 100644 index 000000000..de00036cc --- /dev/null +++ b/Zend/tests/heredoc_016.phpt @@ -0,0 +1,42 @@ +--TEST-- +Testing heredoc (double quotes) with escape sequences +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/Zend/tests/heredoc_017.phpt b/Zend/tests/heredoc_017.phpt new file mode 100644 index 000000000..e0ffddf05 --- /dev/null +++ b/Zend/tests/heredoc_017.phpt @@ -0,0 +1,17 @@ +--TEST-- +Testinh heredoc syntax +--FILE-- + +--EXPECT-- +bool(true) diff --git a/Zend/tests/heredoc_018.phpt b/Zend/tests/heredoc_018.phpt new file mode 100644 index 000000000..c10e9c1c4 --- /dev/null +++ b/Zend/tests/heredoc_018.phpt @@ -0,0 +1,17 @@ +--TEST-- +Testing heredoc with tabs before identifier +--FILE-- + +--EXPECT-- +bool(true) diff --git a/Zend/tests/instanceof.phpt b/Zend/tests/instanceof.phpt index edb5923c5..8bcbede99 100755 --- a/Zend/tests/instanceof.phpt +++ b/Zend/tests/instanceof.phpt @@ -1,18 +1,18 @@ ---TEST-- -instanceof shouldn't call __autoload ---FILE-- - ---EXPECT-- -bool(false) -bool(true) +--TEST-- +instanceof shouldn't call __autoload +--FILE-- + +--EXPECT-- +bool(false) +bool(true) diff --git a/Zend/tests/instanceof_001.phpt b/Zend/tests/instanceof_001.phpt new file mode 100644 index 000000000..b88e174c1 --- /dev/null +++ b/Zend/tests/instanceof_001.phpt @@ -0,0 +1,29 @@ +--TEST-- +Testing instanceof operator with several operators +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) + +Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d diff --git a/Zend/tests/instanceof_002.phpt b/Zend/tests/instanceof_002.phpt new file mode 100644 index 000000000..d3f4a3535 --- /dev/null +++ b/Zend/tests/instanceof_002.phpt @@ -0,0 +1,33 @@ +--TEST-- +Testing instanceof operator with class and interface inheriteds +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(false) +bool(true) +bool(true) +bool(true) diff --git a/Zend/tests/int_overflow_64bit.phpt b/Zend/tests/int_overflow_64bit.phpt index 306fbae60..769b17926 100644 --- a/Zend/tests/int_overflow_64bit.phpt +++ b/Zend/tests/int_overflow_64bit.phpt @@ -6,11 +6,13 @@ testing integer overflow (64bit) --EXPECTF-- -int(-9223372036854775808) -int(-9223372036854775808) +int(9223372036854775807) +int(9223372036854775807) +int(9223372036854775807) +int(9223372036854775807) int(-9223372036854775808) int(-9223372036854775808) int(-9223372036854775808) diff --git a/Zend/tests/inter_007.phpt b/Zend/tests/inter_007.phpt new file mode 100644 index 000000000..ee62063da --- /dev/null +++ b/Zend/tests/inter_007.phpt @@ -0,0 +1,20 @@ +--TEST-- +Trying inherit abstract function twice +--FILE-- + +--EXPECTF-- +Fatal error: Can't inherit abstract function c::B() (previously declared abstract in d) in %s on line %d diff --git a/Zend/tests/inter_01.phpt b/Zend/tests/inter_01.phpt new file mode 100644 index 000000000..db2e86d20 --- /dev/null +++ b/Zend/tests/inter_01.phpt @@ -0,0 +1,18 @@ +--TEST-- +Inherited constant from interface +--FILE-- + +--EXPECTF-- +Fatal error: Cannot inherit previously-inherited constant foo from interface foo in %s on line %d diff --git a/Zend/tests/inter_02.phpt b/Zend/tests/inter_02.phpt new file mode 100644 index 000000000..34e8baa5d --- /dev/null +++ b/Zend/tests/inter_02.phpt @@ -0,0 +1,21 @@ +--TEST-- +Namespace constant as value default +--FILE-- + +--EXPECT-- +int(2) diff --git a/Zend/tests/inter_03.phpt b/Zend/tests/inter_03.phpt new file mode 100644 index 000000000..c91f4aa14 --- /dev/null +++ b/Zend/tests/inter_03.phpt @@ -0,0 +1,19 @@ +--TEST-- +Testing interface constants with inheritance +--FILE-- + +--EXPECT-- +int(2) +int(2) diff --git a/Zend/tests/inter_04.phpt b/Zend/tests/inter_04.phpt new file mode 100644 index 000000000..0703e3d9b --- /dev/null +++ b/Zend/tests/inter_04.phpt @@ -0,0 +1,19 @@ +--TEST-- +Trying declare interface with repeated name of inherited method +--FILE-- + +--EXPECTF-- +Fatal error: Can't inherit abstract function b::b() (previously declared abstract in a) in %s on line %d diff --git a/Zend/tests/inter_05.phpt b/Zend/tests/inter_05.phpt new file mode 100644 index 000000000..7d5d13ea3 --- /dev/null +++ b/Zend/tests/inter_05.phpt @@ -0,0 +1,10 @@ +--TEST-- +Trying to inherit a class in an interface +--FILE-- + +--EXPECTF-- +Fatal error: a cannot implement Exception - it is not an interface in %s on line %d diff --git a/Zend/tests/inter_06.phpt b/Zend/tests/inter_06.phpt new file mode 100644 index 000000000..1987c24a8 --- /dev/null +++ b/Zend/tests/inter_06.phpt @@ -0,0 +1,10 @@ +--TEST-- +Trying use name of an internal class as interface name +--FILE-- + +--EXPECTF-- +Fatal error: Cannot redeclare class stdClass in %s on line %d diff --git a/Zend/tests/interface_exists_001.phpt b/Zend/tests/interface_exists_001.phpt new file mode 100644 index 000000000..ab20dd20e --- /dev/null +++ b/Zend/tests/interface_exists_001.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing interface_exists() +--FILE-- + +--EXPECTF-- +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_exists_002.phpt b/Zend/tests/interface_exists_002.phpt new file mode 100644 index 000000000..be78784d5 --- /dev/null +++ b/Zend/tests/interface_exists_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +Testing interface_exists() inside a namespace +--FILE-- + +--EXPECT-- +bool(false) +bool(true) +bool(true) diff --git a/Zend/tests/is_a.phpt b/Zend/tests/is_a.phpt index 03bb033a9..a074194c4 100755 --- a/Zend/tests/is_a.phpt +++ b/Zend/tests/is_a.phpt @@ -1,50 +1,43 @@ ---TEST-- -is_a() and is_subclass_of() shouldn't call __autoload ---INI-- -error_reporting=4095 ---FILE-- - ---EXPECTF-- -Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 17 -bool(false) - -Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 18 -bool(true) - -Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 19 -bool(true) - -Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 20 -bool(true) -bool(false) -bool(false) -bool(true) -bool(false) -AUTOLOAD 'X1' -bool(false) +--TEST-- +is_a() and is_subclass_of() shouldn't call __autoload +--INI-- +error_reporting=14335 +--FILE-- + +--EXPECT-- +bool(false) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) +bool(false) +AUTOLOAD 'X1' +bool(false) diff --git a/Zend/tests/jump01.phpt b/Zend/tests/jump01.phpt new file mode 100755 index 000000000..87dba88ba --- /dev/null +++ b/Zend/tests/jump01.phpt @@ -0,0 +1,14 @@ +--TEST-- +jump 01: goto backward +--FILE-- + +--EXPECT-- +1: ok +2: ok +3: ok diff --git a/Zend/tests/jump02.phpt b/Zend/tests/jump02.phpt new file mode 100755 index 000000000..ff83bc4b9 --- /dev/null +++ b/Zend/tests/jump02.phpt @@ -0,0 +1,16 @@ +--TEST-- +jump 02: goto forward +--FILE-- + 3) goto L2; +echo "$n: ok\n"; +$n++; +goto L1; +L2: +?> +--EXPECT-- +1: ok +2: ok +3: ok diff --git a/Zend/tests/jump03.phpt b/Zend/tests/jump03.phpt new file mode 100755 index 000000000..2399f30ad --- /dev/null +++ b/Zend/tests/jump03.phpt @@ -0,0 +1,18 @@ +--TEST-- +jump 03: goto inside control structures +--FILE-- + +--EXPECT-- +1: ok +2: ok diff --git a/Zend/tests/jump04.phpt b/Zend/tests/jump04.phpt new file mode 100755 index 000000000..2bbf1f5c0 --- /dev/null +++ b/Zend/tests/jump04.phpt @@ -0,0 +1,24 @@ +--TEST-- +jump 04: goto from loop (backward) +--FILE-- + +--EXPECT-- +1: ok +2: ok +3: ok +4: ok diff --git a/Zend/tests/jump05.phpt b/Zend/tests/jump05.phpt new file mode 100755 index 000000000..2e5e50c06 --- /dev/null +++ b/Zend/tests/jump05.phpt @@ -0,0 +1,26 @@ +--TEST-- +jump 05: goto from loop (forward) +--FILE-- + +--EXPECT-- +1: ok +2: ok +3: ok diff --git a/Zend/tests/jump06.phpt b/Zend/tests/jump06.phpt new file mode 100755 index 000000000..ef01b0e5b --- /dev/null +++ b/Zend/tests/jump06.phpt @@ -0,0 +1,8 @@ +--TEST-- +jump 06: goto to undefined label +--FILE-- + +--EXPECTF-- +Fatal error: 'goto' to undefined label 'L1' in %sjump06.php on line 2 diff --git a/Zend/tests/jump07.phpt b/Zend/tests/jump07.phpt new file mode 100755 index 000000000..c0cb112a7 --- /dev/null +++ b/Zend/tests/jump07.phpt @@ -0,0 +1,11 @@ +--TEST-- +jump 07: goto into loop (backward) +--FILE-- + +--EXPECTF-- +Fatal error: 'goto' into loop or switch statement is disallowed in %sjump07.php on line 5 diff --git a/Zend/tests/jump08.phpt b/Zend/tests/jump08.phpt new file mode 100755 index 000000000..25a211c8c --- /dev/null +++ b/Zend/tests/jump08.phpt @@ -0,0 +1,11 @@ +--TEST-- +jump 08: goto into loop (forward) +--FILE-- + +--EXPECTF-- +Fatal error: 'goto' into loop or switch statement is disallowed in %sjump08.php on line 2 diff --git a/Zend/tests/jump09.phpt b/Zend/tests/jump09.phpt new file mode 100755 index 000000000..52a14b7d5 --- /dev/null +++ b/Zend/tests/jump09.phpt @@ -0,0 +1,13 @@ +--TEST-- +jump 09: goto into switch (backward) +--FILE-- + +--EXPECTF-- +Fatal error: 'goto' into loop or switch statement is disallowed in %sjump09.php on line 7 diff --git a/Zend/tests/jump10.phpt b/Zend/tests/jump10.phpt new file mode 100755 index 000000000..67206a29a --- /dev/null +++ b/Zend/tests/jump10.phpt @@ -0,0 +1,13 @@ +--TEST-- +jump 10: goto into switch (forward) +--FILE-- + +--EXPECTF-- +Fatal error: 'goto' into loop or switch statement is disallowed in %sjump10.php on line 2 diff --git a/Zend/tests/jump11.phpt b/Zend/tests/jump11.phpt new file mode 100644 index 000000000..bd1107c4a --- /dev/null +++ b/Zend/tests/jump11.phpt @@ -0,0 +1,26 @@ +--TEST-- +jump 08: goto inside switch in constructor +--FILE-- + +--EXPECT-- +ok! +ok! +ok! diff --git a/Zend/tests/jump12.phpt b/Zend/tests/jump12.phpt new file mode 100644 index 000000000..a7fa590f0 --- /dev/null +++ b/Zend/tests/jump12.phpt @@ -0,0 +1,20 @@ +--TEST-- +jump 09: goto in declare statement +--FILE-- + +--EXPECTF-- +Deprecated: Ticks is deprecated and will be removed in PHP 6 in %s on line %d +ok! +ok! +ok! diff --git a/Zend/tests/jump13.phpt b/Zend/tests/jump13.phpt new file mode 100644 index 000000000..2d57f4aab --- /dev/null +++ b/Zend/tests/jump13.phpt @@ -0,0 +1,25 @@ +--TEST-- +jump 10: goto with try blocks +--FILE-- + +--EXPECT-- +1234 diff --git a/Zend/tests/jump14.phpt b/Zend/tests/jump14.phpt new file mode 100644 index 000000000..2cc6391ce --- /dev/null +++ b/Zend/tests/jump14.phpt @@ -0,0 +1,28 @@ +--TEST-- +Testing GOTO inside blocks +--FILE-- + +--EXPECT-- +Done! diff --git a/Zend/tests/list_001.phpt b/Zend/tests/list_001.phpt new file mode 100644 index 000000000..a9fff5500 --- /dev/null +++ b/Zend/tests/list_001.phpt @@ -0,0 +1,14 @@ +--TEST-- +"Nested" list() +--FILE-- + +--EXPECT-- +object(stdClass)#1 (0) { +} +object(stdClass)#2 (0) { +} diff --git a/Zend/tests/list_002.phpt b/Zend/tests/list_002.phpt new file mode 100644 index 000000000..ac0d8974b --- /dev/null +++ b/Zend/tests/list_002.phpt @@ -0,0 +1,20 @@ +--TEST-- +Testing full-reference on list() +--FILE-- + +--EXPECT-- +object(stdClass)#1 (0) { +} +object(stdClass)#1 (0) { +} +bool(true) diff --git a/Zend/tests/list_003.phpt b/Zend/tests/list_003.phpt new file mode 100644 index 000000000..4a509f6a8 --- /dev/null +++ b/Zend/tests/list_003.phpt @@ -0,0 +1,24 @@ +--TEST-- +list() with non-array +--FILE-- + +--EXPECT-- +NULL +NULL +NULL +NULL +NULL diff --git a/Zend/tests/list_004.phpt b/Zend/tests/list_004.phpt new file mode 100644 index 000000000..862a4e431 --- /dev/null +++ b/Zend/tests/list_004.phpt @@ -0,0 +1,21 @@ +--TEST-- +list() with array reference +--FILE-- + +--EXPECT-- +int(1) +array(2) { + [0]=> + int(2) + [1]=> + int(1) +} diff --git a/Zend/tests/list_005.phpt b/Zend/tests/list_005.phpt new file mode 100644 index 000000000..4afc353b2 --- /dev/null +++ b/Zend/tests/list_005.phpt @@ -0,0 +1,47 @@ +--TEST-- +Testing list() with several variables +--FILE-- + +--EXPECTF-- +string(1) "f" +string(1) "o" +string(1) "o" +---- +NULL +NULL +NULL +---- + +Fatal error: Cannot use object of type stdClass as array in %s on line %d diff --git a/Zend/tests/list_006.phpt b/Zend/tests/list_006.phpt new file mode 100644 index 000000000..f5f5970be --- /dev/null +++ b/Zend/tests/list_006.phpt @@ -0,0 +1,14 @@ +--TEST-- +Testing nested list() with empty array +--FILE-- + +--EXPECTF-- +Notice: Undefined offset: 1 in %s on line %d + +Notice: Undefined offset: 1 in %s on line %d + +Notice: Undefined offset: 0 in %s on line %d diff --git a/Zend/tests/list_007.phpt b/Zend/tests/list_007.phpt new file mode 100644 index 000000000..35a25bce6 --- /dev/null +++ b/Zend/tests/list_007.phpt @@ -0,0 +1,13 @@ +--TEST-- +Using lambda with list() +--FILE-- + +--EXPECT-- +NULL +NULL diff --git a/Zend/tests/lsb_001.phpt b/Zend/tests/lsb_001.phpt new file mode 100644 index 000000000..20a2fd83b --- /dev/null +++ b/Zend/tests/lsb_001.phpt @@ -0,0 +1,61 @@ +--TEST-- +ZE2 Late Static Binding in a static function +--FILE-- + +==DONE== +--EXPECTF-- +TestClassStatic +TestClassConst +TestClassFunction +ChildClassStatic +ChildClassConst +ChildClassFunction +TestClassStatic +TestClassConst +TestClassFunction +==DONE== diff --git a/Zend/tests/lsb_002.phpt b/Zend/tests/lsb_002.phpt new file mode 100644 index 000000000..4fca6ddd7 --- /dev/null +++ b/Zend/tests/lsb_002.phpt @@ -0,0 +1,66 @@ +--TEST-- +ZE2 Late Static Binding in an instance function +--FILE-- +testStaticVar() . "\n"; +echo $testClass->testClassConst() . "\n"; +echo $testClass->testStaticFunction() . "\n"; + +echo $childClass1->testStaticVar() . "\n"; +echo $childClass1->testClassConst() . "\n"; +echo $childClass1->testStaticFunction() . "\n"; + +echo $childClass2->testStaticVar() . "\n"; +echo $childClass2->testClassConst() . "\n"; +echo $childClass2->testStaticFunction() . "\n"; +?> +==DONE== +--EXPECTF-- +TestClassStatic +TestClassConst +TestClassFunction +ChildClassStatic +ChildClassConst +ChildClassFunction +TestClassStatic +TestClassConst +TestClassFunction +==DONE== diff --git a/Zend/tests/lsb_003.phpt b/Zend/tests/lsb_003.phpt new file mode 100644 index 000000000..4e9fe1f7c --- /dev/null +++ b/Zend/tests/lsb_003.phpt @@ -0,0 +1,24 @@ +--TEST-- +ZE2 Late Static Binding creating a new class with 'static' +--FILE-- + +==DONE== +--EXPECTF-- +TestClass +ChildClass +==DONE== diff --git a/Zend/tests/lsb_004.phpt b/Zend/tests/lsb_004.phpt new file mode 100644 index 000000000..6baeba00b --- /dev/null +++ b/Zend/tests/lsb_004.phpt @@ -0,0 +1,21 @@ +--TEST-- +ZE2 Late Static Binding testing get_called_class() +--FILE-- + +==DONE== +--EXPECTF-- +TestClass +ChildClass +==DONE== diff --git a/Zend/tests/lsb_005.phpt b/Zend/tests/lsb_005.phpt new file mode 100644 index 000000000..00647a5c7 --- /dev/null +++ b/Zend/tests/lsb_005.phpt @@ -0,0 +1,51 @@ +--TEST-- +ZE2 Late Static Binding stacking static calleds +--FILE-- + +==DONE== +--EXPECTF-- +TestA +TestB +TestC +TestB +TestA +TestC +TestA +TestBB +TestC +TestBB +TestA +==DONE== diff --git a/Zend/tests/lsb_006.phpt b/Zend/tests/lsb_006.phpt new file mode 100644 index 000000000..84cd22a99 --- /dev/null +++ b/Zend/tests/lsb_006.phpt @@ -0,0 +1,13 @@ +--TEST-- +ZE2 Late Static Binding ensuring extending 'static' is not allowed +--FILE-- + +==DONE== +--EXPECTF-- +Parse error: %s error,%sexpecting %s in %s on line %d + diff --git a/Zend/tests/lsb_007.phpt b/Zend/tests/lsb_007.phpt new file mode 100644 index 000000000..607f8efeb --- /dev/null +++ b/Zend/tests/lsb_007.phpt @@ -0,0 +1,13 @@ +--TEST-- +ZE2 Late Static Binding ensuring implementing 'static' is not allowed +--FILE-- + +==DONE== +--EXPECTF-- +Parse error: %s error,%sexpecting %s in %s on line %d + diff --git a/Zend/tests/lsb_008.phpt b/Zend/tests/lsb_008.phpt new file mode 100644 index 000000000..b700e2df9 --- /dev/null +++ b/Zend/tests/lsb_008.phpt @@ -0,0 +1,9 @@ +--TEST-- +ZE2 Late Static Binding class name "static" +--FILE-- + +--EXPECTF-- +Foo::__construct +FooChild::__construct +Foo::__destruct +FooChild::__destruct +Foo::bar +FooChild::bar diff --git a/Zend/tests/lsb_011.phpt b/Zend/tests/lsb_011.phpt new file mode 100644 index 000000000..3c5bbbeb6 --- /dev/null +++ b/Zend/tests/lsb_011.phpt @@ -0,0 +1,23 @@ +--TEST-- +ZE2 Late Static Binding call to static::method() from internal function (array) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/lsb_012.phpt b/Zend/tests/lsb_012.phpt new file mode 100644 index 000000000..3ac8d3884 --- /dev/null +++ b/Zend/tests/lsb_012.phpt @@ -0,0 +1,23 @@ +--TEST-- +ZE2 Late Static Binding call to static::method() from internal function (string) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/lsb_013.phpt b/Zend/tests/lsb_013.phpt new file mode 100644 index 000000000..3f32dc3a6 --- /dev/null +++ b/Zend/tests/lsb_013.phpt @@ -0,0 +1,24 @@ +--TEST-- +ZE2 Late Static Binding is_callable() and static::method() +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +bool(true) +bool(true) diff --git a/Zend/tests/lsb_014.phpt b/Zend/tests/lsb_014.phpt new file mode 100644 index 000000000..19cf91371 --- /dev/null +++ b/Zend/tests/lsb_014.phpt @@ -0,0 +1,24 @@ +--TEST-- +ZE2 Late Static Binding access to static::const through defined() and get_constant() +--FILE-- + +--EXPECT-- +bool(false) +bool(true) +ok diff --git a/Zend/tests/lsb_015.phpt b/Zend/tests/lsb_015.phpt new file mode 100644 index 000000000..ba293a246 --- /dev/null +++ b/Zend/tests/lsb_015.phpt @@ -0,0 +1,92 @@ +--TEST-- +ZE2 Late Static Binding with exceptions +--FILE-- + +==DONE== +--EXPECTF-- +via A: +A +A +A +A +B +A +A +A +A +via B: +B +B +A +B +B +B +B +B +B +==DONE== diff --git a/Zend/tests/lsb_016.phpt b/Zend/tests/lsb_016.phpt new file mode 100644 index 000000000..f19c6aada --- /dev/null +++ b/Zend/tests/lsb_016.phpt @@ -0,0 +1,41 @@ +--TEST-- +ZE2 Late Static Binding within hooks/magic methods +--FILE-- +test(); +$o->a = "b"; +echo $o->a; +?> +==DONE== +--EXPECTF-- +TestChild +TestChild +TestChild +==DONE== diff --git a/Zend/tests/lsb_017.phpt b/Zend/tests/lsb_017.phpt new file mode 100644 index 000000000..5f5ca4351 --- /dev/null +++ b/Zend/tests/lsb_017.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 Late Static Binding nested calls +--FILE-- + +==DONE== +--EXPECT-- +D +C +B +A +==DONE== diff --git a/Zend/tests/lsb_018.phpt b/Zend/tests/lsb_018.phpt new file mode 100755 index 000000000..c7877cddf --- /dev/null +++ b/Zend/tests/lsb_018.phpt @@ -0,0 +1,95 @@ +--TEST-- +ZE2 Late Static Binding and Singleton +--FILE-- +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 { +} + +class Bar extends Singleton { +} + +class Baz extends Bar { +} + +$u = Foo::getInstance(); +$v = Bar::getInstance(); +$w = Baz::getInstance(); + +$u->identify(); +$v->identify(); +$w->identify(); + +$x = Foo::getInstance(); +$y = Bar::getInstance(); +$z = Baz::getInstance(); + +$u->identify(); +$v->identify(); +$w->identify(); +$x->identify(); +$y->identify(); +$z->identify(); +?> +===DONE=== +--EXPECTF-- +object(Foo)#%d (1) { + ["instanceId":"Singleton":private]=> + int(0) +} +object(Bar)#%d (1) { + ["instanceId":"Singleton":private]=> + int(1) +} +object(Baz)#%d (1) { + ["instanceId":"Singleton":private]=> + int(2) +} +object(Foo)#%d (1) { + ["instanceId":"Singleton":private]=> + int(0) +} +object(Bar)#%d (1) { + ["instanceId":"Singleton":private]=> + int(1) +} +object(Baz)#%d (1) { + ["instanceId":"Singleton":private]=> + int(2) +} +object(Foo)#%d (1) { + ["instanceId":"Singleton":private]=> + int(0) +} +object(Bar)#%d (1) { + ["instanceId":"Singleton":private]=> + int(1) +} +object(Baz)#%d (1) { + ["instanceId":"Singleton":private]=> + int(2) +} +===DONE=== diff --git a/Zend/tests/lsb_019.phpt b/Zend/tests/lsb_019.phpt new file mode 100644 index 000000000..1683ffe63 --- /dev/null +++ b/Zend/tests/lsb_019.phpt @@ -0,0 +1,48 @@ +--TEST-- +ZE2 Late Static Binding properties and methods declared as protected and overridden as public. +--FILE-- + +--EXPECTF-- +TestClassStatic +TestClassFunction +ChildClassStatic +ChildClassFunction +TestClassStatic +TestClassFunction diff --git a/Zend/tests/lsb_020.phpt b/Zend/tests/lsb_020.phpt new file mode 100644 index 000000000..65ef97ab4 --- /dev/null +++ b/Zend/tests/lsb_020.phpt @@ -0,0 +1,48 @@ +--TEST-- +ZE2 Late Static Binding properties and methods declared as public and overridden as public. +--FILE-- + +--EXPECTF-- +TestClassStatic +TestClassFunction +ChildClassStatic +ChildClassFunction +TestClassStatic +TestClassFunction diff --git a/Zend/tests/lsb_021.phpt b/Zend/tests/lsb_021.phpt new file mode 100644 index 000000000..c591cfa23 --- /dev/null +++ b/Zend/tests/lsb_021.phpt @@ -0,0 +1,50 @@ +--TEST-- +ZE2 Late Static Binding parent::/self:: forwarding while classname doesn't +--FILE-- + +--EXPECTF-- +C +C +C +C +C +C +A +A +A +B +B +B diff --git a/Zend/tests/lsb_022.phpt b/Zend/tests/lsb_022.phpt new file mode 100755 index 000000000..016fde83c --- /dev/null +++ b/Zend/tests/lsb_022.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 Late Static Binding parent::/self:: forwarding and __callStatic +--FILE-- +sdfdsa(); + +$a::test(); + +clone $a; + +var_dump((string)$a); + +unset($a->a); + +?> +--EXPECT-- +call +string(6) "sdfdsa" +callstatic +clone +string(3) "foo" +unset +string(1) "a" diff --git a/Zend/tests/magic_methods_002.phpt b/Zend/tests/magic_methods_002.phpt new file mode 100644 index 000000000..1e8305e23 --- /dev/null +++ b/Zend/tests/magic_methods_002.phpt @@ -0,0 +1,14 @@ +--TEST-- +Testing __unset with private visibility +--FILE-- + +--EXPECTF-- +Warning: The magic method __unset() must have public visibility and can not be static in %s on line %d diff --git a/Zend/tests/magic_methods_003.phpt b/Zend/tests/magic_methods_003.phpt new file mode 100644 index 000000000..1118a23ba --- /dev/null +++ b/Zend/tests/magic_methods_003.phpt @@ -0,0 +1,14 @@ +--TEST-- +Testing __unset declaring as static +--FILE-- + +--EXPECTF-- +Warning: The magic method __unset() must have public visibility and can not be static in %s on line %d diff --git a/Zend/tests/magic_methods_004.phpt b/Zend/tests/magic_methods_004.phpt new file mode 100644 index 000000000..0ac332cb3 --- /dev/null +++ b/Zend/tests/magic_methods_004.phpt @@ -0,0 +1,14 @@ +--TEST-- +Testing __unset() with protected visibility +--FILE-- + +--EXPECTF-- +Warning: The magic method __unset() must have public visibility and can not be static in %s on line %d diff --git a/Zend/tests/magic_methods_005.phpt b/Zend/tests/magic_methods_005.phpt new file mode 100644 index 000000000..8e8bb4e8a --- /dev/null +++ b/Zend/tests/magic_methods_005.phpt @@ -0,0 +1,12 @@ +--TEST-- +Testing __call() declaration in interface with wrong modifier +--FILE-- + +--EXPECTF-- +Warning: The magic method __call() must have public visibility and can not be static in %s on line %d diff --git a/Zend/tests/magic_methods_006.phpt b/Zend/tests/magic_methods_006.phpt new file mode 100644 index 000000000..2e84a41c5 --- /dev/null +++ b/Zend/tests/magic_methods_006.phpt @@ -0,0 +1,12 @@ +--TEST-- +Testing __callstatic declaration in interface with missing the 'static' modifier +--FILE-- + +--EXPECTF-- +Warning: The magic method __callStatic() must have public visibility and be static in %s on line %d diff --git a/Zend/tests/magic_methods_007.phpt b/Zend/tests/magic_methods_007.phpt new file mode 100644 index 000000000..d949c95ae --- /dev/null +++ b/Zend/tests/magic_methods_007.phpt @@ -0,0 +1,14 @@ +--TEST-- +Testing __set() declaration in abstract class with wrong modifier +--FILE-- + +--EXPECTF-- +Warning: The magic method __set() must have public visibility and can not be static in %s on line %d + +Fatal error: Method b::__set() must take exactly 2 arguments in %s on line %d diff --git a/Zend/tests/magic_methods_008.phpt b/Zend/tests/magic_methods_008.phpt new file mode 100644 index 000000000..3d9b69728 --- /dev/null +++ b/Zend/tests/magic_methods_008.phpt @@ -0,0 +1,19 @@ +--TEST-- +Testing __set implementation with wrong declaration +--FILE-- + +--EXPECTF-- +Warning: The magic method __set() must have public visibility and can not be static in %s on line %d + +Fatal error: Access level to a::__set() must be public (as in class b) in %s on line %d diff --git a/Zend/tests/magic_methods_009.phpt b/Zend/tests/magic_methods_009.phpt new file mode 100644 index 000000000..2b514c3bf --- /dev/null +++ b/Zend/tests/magic_methods_009.phpt @@ -0,0 +1,13 @@ +--TEST-- +Testing __callstatic declaration with wrong modifier +--FILE-- + +--EXPECTF-- +Warning: The magic method __callStatic() must have public visibility and be static in %s on line %d diff --git a/Zend/tests/magic_methods_010.phpt b/Zend/tests/magic_methods_010.phpt new file mode 100644 index 000000000..d50b35724 --- /dev/null +++ b/Zend/tests/magic_methods_010.phpt @@ -0,0 +1,15 @@ +--TEST-- +Testing __toString() declaration with wrong modifier +--FILE-- + +--EXPECTF-- +Warning: The magic method __toString() must have public visibility and can not be static in %s on line %d + +Fatal error: Method a::__tostring() cannot take arguments in %s on line %d diff --git a/Zend/tests/multibyte/multibyte_encoding_004.phpt b/Zend/tests/multibyte/multibyte_encoding_004.phpt new file mode 100644 index 000000000..5a26b7c21 --- /dev/null +++ b/Zend/tests/multibyte/multibyte_encoding_004.phpt @@ -0,0 +1,25 @@ +--TEST-- +test for mbstring script_encoding for flex unsafe encoding (Shift_JIS) +--SKIPIF-- + +--INI-- +mbstring.script_encoding=Shift_JIS +mbstring.internal_encoding=Shift_JIS +--FILE-- + +--EXPECT-- +ƒhƒŒƒ~ƒtƒ@ƒ\ diff --git a/Zend/tests/multibyte/multibyte_encoding_005.phpt b/Zend/tests/multibyte/multibyte_encoding_005.phpt new file mode 100644 index 000000000..3946238e5 --- /dev/null +++ b/Zend/tests/multibyte/multibyte_encoding_005.phpt @@ -0,0 +1,26 @@ +--TEST-- +encoding conversion from script encoding into internal encoding +--SKIPIF-- + +--INI-- +mbstring.encoding_translation = On +mbstring.script_encoding=Shift_JIS +mbstring.internal_encoding=UTF-8 +--FILE-- + +--EXPECT-- +ドレミファソ diff --git a/Zend/tests/nowdoc.inc b/Zend/tests/nowdoc.inc new file mode 100644 index 000000000..98f9fbaac --- /dev/null +++ b/Zend/tests/nowdoc.inc @@ -0,0 +1,11 @@ + 3, ); +class d { public function __construct() { $this->d = 4; } }; +$d = new d; + +?> + diff --git a/Zend/tests/nowdoc_001.phpt b/Zend/tests/nowdoc_001.phpt new file mode 100644 index 000000000..3b9e3ef54 --- /dev/null +++ b/Zend/tests/nowdoc_001.phpt @@ -0,0 +1,24 @@ +--TEST-- +basic nowdoc syntax +--FILE-- + +--EXPECT-- +This is a nowdoc test. +This is another nowdoc test. +With another line in it. diff --git a/Zend/tests/nowdoc_002.phpt b/Zend/tests/nowdoc_002.phpt new file mode 100644 index 000000000..3b17da814 --- /dev/null +++ b/Zend/tests/nowdoc_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +basic binary nowdoc syntax +--FILE-- + +--EXPECT-- +This is a nowdoc test. +This is another nowdoc test. diff --git a/Zend/tests/nowdoc_003.phpt b/Zend/tests/nowdoc_003.phpt new file mode 100644 index 000000000..4282ab912 --- /dev/null +++ b/Zend/tests/nowdoc_003.phpt @@ -0,0 +1,23 @@ +--TEST-- +simple variable replacement test (nowdoc) +--FILE-- + +--EXPECT-- +This is nowdoc test #$a. +This is nowdoc test #$b. diff --git a/Zend/tests/nowdoc_004.phpt b/Zend/tests/nowdoc_004.phpt new file mode 100644 index 000000000..0e5b92778 --- /dev/null +++ b/Zend/tests/nowdoc_004.phpt @@ -0,0 +1,23 @@ +--TEST-- +braces variable replacement test (nowdoc) +--FILE-- + +--EXPECT-- +This is nowdoc test #{$a}. +This is nowdoc test #{$b}. diff --git a/Zend/tests/nowdoc_005.phpt b/Zend/tests/nowdoc_005.phpt new file mode 100644 index 000000000..65e33d744 --- /dev/null +++ b/Zend/tests/nowdoc_005.phpt @@ -0,0 +1,23 @@ +--TEST-- +unbraced complex variable replacement test (nowdoc) +--FILE-- +d. + +ENDOFNOWDOC; + +$x = <<<'ENDOFNOWDOC' +This is nowdoc test #s $a, $b, $c['c'], and $d->d. + +ENDOFNOWDOC; + +print "{$x}"; + +?> +--EXPECT-- +This is nowdoc test #s $a, $b, $c['c'], and $d->d. +This is nowdoc test #s $a, $b, $c['c'], and $d->d. diff --git a/Zend/tests/nowdoc_006.phpt b/Zend/tests/nowdoc_006.phpt new file mode 100644 index 000000000..9d99973a1 --- /dev/null +++ b/Zend/tests/nowdoc_006.phpt @@ -0,0 +1,23 @@ +--TEST-- +braced complex variable replacement test (nowdoc) +--FILE-- +d}. + +ENDOFNOWDOC; + +$x = <<<'ENDOFNOWDOC' +This is nowdoc test #s {$a}, {$b}, {$c['c']}, and {$d->d}. + +ENDOFNOWDOC; + +print "{$x}"; + +?> +--EXPECT-- +This is nowdoc test #s {$a}, {$b}, {$c['c']}, and {$d->d}. +This is nowdoc test #s {$a}, {$b}, {$c['c']}, and {$d->d}. diff --git a/Zend/tests/nowdoc_007.phpt b/Zend/tests/nowdoc_007.phpt new file mode 100644 index 000000000..d9e941106 --- /dev/null +++ b/Zend/tests/nowdoc_007.phpt @@ -0,0 +1,23 @@ +--TEST-- +braced and unbraced complex variable replacement test (nowdoc) +--FILE-- +d}. + +ENDOFNOWDOC; + +$x = <<<'ENDOFNOWDOC' +This is nowdoc test #s $a, {$b}, {$c['c']}, and {$d->d}. + +ENDOFNOWDOC; + +print "{$x}"; + +?> +--EXPECT-- +This is nowdoc test #s $a, {$b}, {$c['c']}, and {$d->d}. +This is nowdoc test #s $a, {$b}, {$c['c']}, and {$d->d}. diff --git a/Zend/tests/nowdoc_008.phpt b/Zend/tests/nowdoc_008.phpt new file mode 100644 index 000000000..486f0022f --- /dev/null +++ b/Zend/tests/nowdoc_008.phpt @@ -0,0 +1,17 @@ +--TEST-- +empty doc test (nowdoc) +--FILE-- + +--EXPECT-- diff --git a/Zend/tests/nowdoc_009.phpt b/Zend/tests/nowdoc_009.phpt new file mode 100644 index 000000000..ec8b78f01 --- /dev/null +++ b/Zend/tests/nowdoc_009.phpt @@ -0,0 +1,40 @@ +--TEST-- +Torture the T_END_NOWDOC rules (nowdoc) +--FILE-- + +--EXPECT-- +ENDOFNOWDOC ; + ENDOFNOWDOC; +ENDOFNOWDOC + ENDOFNOWDOC +$ENDOFNOWDOC; +ENDOFNOWDOC ; + ENDOFNOWDOC; +ENDOFNOWDOC + ENDOFNOWDOC +$ENDOFNOWDOC; + diff --git a/Zend/tests/nowdoc_010.phpt b/Zend/tests/nowdoc_010.phpt new file mode 100644 index 000000000..6f288151c --- /dev/null +++ b/Zend/tests/nowdoc_010.phpt @@ -0,0 +1,33 @@ +--TEST-- +Torture the T_END_NOWDOC rules with variable expansions (nowdoc) +--FILE-- + +--EXPECT-- +{$fooledYou}ENDOFNOWDOC{$fooledYou} +ENDOFNOWDOC{$fooledYou} +{$fooledYou}ENDOFNOWDOC +{$fooledYou}ENDOFNOWDOC{$fooledYou} +ENDOFNOWDOC{$fooledYou} +{$fooledYou}ENDOFNOWDOC + diff --git a/Zend/tests/nowdoc_011.phpt b/Zend/tests/nowdoc_011.phpt new file mode 100644 index 000000000..84bcdb691 --- /dev/null +++ b/Zend/tests/nowdoc_011.phpt @@ -0,0 +1,20 @@ +--TEST-- +Nowdocs CAN be used as static scalars. +--FILE-- + +--EXPECTF-- +If you DON'T see this, something's wrong. diff --git a/Zend/tests/nowdoc_012.phpt b/Zend/tests/nowdoc_012.phpt new file mode 100644 index 000000000..0bcb92e4b --- /dev/null +++ b/Zend/tests/nowdoc_012.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test false labels +--FILE-- + +--EXPECT-- +This is a nowdoc test. +NOTREALLYEND; +Another line +NOTENDEITHER; +ENDOFNOWDOCWILLBESOON +Now let's finish it diff --git a/Zend/tests/nowdoc_013.phpt b/Zend/tests/nowdoc_013.phpt new file mode 100644 index 000000000..f4ee25174 --- /dev/null +++ b/Zend/tests/nowdoc_013.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test whitespace following end of nowdoc +--INI-- +highlight.string = #DD0000 +highlight.comment = #FF8000 +highlight.keyword = #007700 +highlight.bg = #FFFFFF +highlight.default = #0000BB +highlight.html = #000000 +--FILE-- + +EOF; +highlight_string($code); +?> +--EXPECT-- + +<?php
  $x 
= <<<'EOT'
some string    
EOT
  
$y 2;
?> +
+
diff --git a/Zend/tests/nowdoc_014.phpt b/Zend/tests/nowdoc_014.phpt new file mode 100644 index 000000000..b8948699f --- /dev/null +++ b/Zend/tests/nowdoc_014.phpt @@ -0,0 +1,25 @@ +--TEST-- +Highlighting empty nowdoc +--INI-- +highlight.string = #DD0000 +highlight.comment = #FF8000 +highlight.keyword = #007700 +highlight.bg = #FFFFFF +highlight.default = #0000BB +highlight.html = #000000 +--FILE-- + +EOF; +highlight_string($code); +?> +--EXPECT-- + +<?php
  $x 
= <<<'EOT'
EOT
  
$y 2;
?> +
+
diff --git a/Zend/tests/nowdoc_015.phpt b/Zend/tests/nowdoc_015.phpt new file mode 100644 index 000000000..9eb83bd06 --- /dev/null +++ b/Zend/tests/nowdoc_015.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test nowdoc and line numbering +--FILE-- + +--EXPECT-- +6 +string(0) "" +10 +string(0) "" +14 +string(4) "test" +19 +string(4) "test" +24 +string(20) "test1 +test2 + +test3 + +" +34 +string(20) "test1 +test2 + +test3 + +" +44 +ok diff --git a/Zend/tests/nowdoc_016.phpt b/Zend/tests/nowdoc_016.phpt new file mode 100644 index 000000000..01eea4e75 --- /dev/null +++ b/Zend/tests/nowdoc_016.phpt @@ -0,0 +1,41 @@ +--TEST-- +Testing nowdocs with escape sequences +--FILE-- + +--EXPECT-- +int(0) +int(1) +int(2) +int(2) +int(3) diff --git a/Zend/tests/nowdoc_017.phpt b/Zend/tests/nowdoc_017.phpt new file mode 100644 index 000000000..5d29a86ba --- /dev/null +++ b/Zend/tests/nowdoc_017.phpt @@ -0,0 +1,16 @@ +--TEST-- +Testing nowdoc in default value for property +--FILE-- + +--EXPECT-- +ok! diff --git a/Zend/tests/ns_001.phpt b/Zend/tests/ns_001.phpt new file mode 100755 index 000000000..67715947a --- /dev/null +++ b/Zend/tests/ns_001.phpt @@ -0,0 +1,34 @@ +--TEST-- +001: Class in namespace +--FILE-- +bar(); +Foo::baz(); +$y = new \test\ns1\Foo; +$y->bar(); +\test\ns1\Foo::baz(); +--EXPECT-- +test\ns1\Foo +test\ns1\Foo +test\ns1\Foo +test\ns1\Foo +test\ns1\Foo +test\ns1\Foo diff --git a/Zend/tests/ns_002.phpt b/Zend/tests/ns_002.phpt new file mode 100755 index 000000000..3d9e09869 --- /dev/null +++ b/Zend/tests/ns_002.phpt @@ -0,0 +1,27 @@ +--TEST-- +002: Import in namespace +--FILE-- + +--FILE-- + +--EXPECT-- +int(1) +int(1) +int(1) +int(1) diff --git a/Zend/tests/ns_036.phpt b/Zend/tests/ns_036.phpt new file mode 100755 index 000000000..245cf7d5b --- /dev/null +++ b/Zend/tests/ns_036.phpt @@ -0,0 +1,41 @@ +--TEST-- +036: Name ambiguity in compile-time constant reference (ns name) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(2) +int(1) +int(2) +int(2) +int(2) +int(1) +int(2) +int(2) diff --git a/Zend/tests/ns_037.phpt b/Zend/tests/ns_037.phpt new file mode 100755 index 000000000..db0a76e94 --- /dev/null +++ b/Zend/tests/ns_037.phpt @@ -0,0 +1,41 @@ +--TEST-- +037: Name ambiguity (namespace name or namespace's class name) +--FILE-- + B)) { + foreach ($a as $key => $val) { + echo "$key\n"; + echo "$val\n"; + } +} +const A = "ok"; +const B = A; +echo A . "\n"; +echo B . "\n"; +foo(); +bar(); +--EXPECT-- +ok +ok +ok +ok +ok diff --git a/Zend/tests/ns_040.phpt b/Zend/tests/ns_040.phpt new file mode 100644 index 000000000..42a3ac07e --- /dev/null +++ b/Zend/tests/ns_040.phpt @@ -0,0 +1,59 @@ +--TEST-- +040: Constant declaration and usage in namespace +--FILE-- +A)) { + echo $x["aaa"]; +} +function f8($x=array(A=>"aaa\n")) { + echo $x["ok\n"]; +} +echo A; +echo \X\A; +echo Y\A; +echo \X\A; +f1(); +f2(); +f3(); +f4(); +echo B; +f5(); +f6(); +f7(); +f8(); +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +aaa diff --git a/Zend/tests/ns_041.phpt b/Zend/tests/ns_041.phpt new file mode 100644 index 000000000..0632fc981 --- /dev/null +++ b/Zend/tests/ns_041.phpt @@ -0,0 +1,22 @@ +--TEST-- +041: Constants in namespace +--FILE-- + +--FILE-- +attach($foo); +$foo->update($bar); +?> +--EXPECT-- +ok +ok diff --git a/Zend/tests/ns_055.phpt b/Zend/tests/ns_055.phpt new file mode 100755 index 000000000..a692e4760 --- /dev/null +++ b/Zend/tests/ns_055.phpt @@ -0,0 +1,28 @@ +--TEST-- +055: typehints in namespaces +--FILE-- +test1($foo); +$foo->test2($foo); +$foo->test3($ex); +?> +--EXPECT-- +ok +ok +ok diff --git a/Zend/tests/ns_056.phpt b/Zend/tests/ns_056.phpt new file mode 100755 index 000000000..2390608d4 --- /dev/null +++ b/Zend/tests/ns_056.phpt @@ -0,0 +1,32 @@ +--TEST-- +056: type-hint compatibility in namespaces +--SKIPIF-- + +--FILE-- +attach($foo); +$foo->update($bar); +?> +--EXPECT-- +ok +ok diff --git a/Zend/tests/ns_057.phpt b/Zend/tests/ns_057.phpt new file mode 100755 index 000000000..13bf3054c --- /dev/null +++ b/Zend/tests/ns_057.phpt @@ -0,0 +1,59 @@ +--TEST-- +057: Usage of 'namespace' in compound names (inside namespace) +--FILE-- + +--EXPECTF-- +const ok +func ok +const ok +const ok +var ok +method ok +const ok +const ok +class ok +ok + +Fatal error: Undefined constant 'Test\ns1\unknown' in %sns_057.php on line %d \ No newline at end of file diff --git a/Zend/tests/ns_058.phpt b/Zend/tests/ns_058.phpt new file mode 100755 index 000000000..7a0cd97d9 --- /dev/null +++ b/Zend/tests/ns_058.phpt @@ -0,0 +1,57 @@ +--TEST-- +058: Usage of 'namespace' in compound names (out of namespase) +--FILE-- + +--EXPECTF-- +const ok +func ok +const ok +const ok +var ok +method ok +const ok +const ok +class ok +ok + +Fatal error: Undefined constant 'unknown' in %sns_058.php on line %d diff --git a/Zend/tests/ns_059.phpt b/Zend/tests/ns_059.phpt new file mode 100755 index 000000000..ea66037b4 --- /dev/null +++ b/Zend/tests/ns_059.phpt @@ -0,0 +1,8 @@ +--TEST-- +059: Constant arrays +--FILE-- +e[] = $this; + } + + public function __set($a, $b) { + var_dump($a, $b); + } + public function __get($a) { + var_dump($a); + return $this; + } +} + +use test\foo as stdClass; + +$x = new stdClass; +$x->a = 1; +$x->b->c = 1; +$x->d->e[0]->f = 2; + +?> +--EXPECT-- +string(1) "a" +int(1) +string(1) "b" +string(1) "c" +int(1) +string(1) "d" +string(1) "f" +int(2) diff --git a/Zend/tests/ns_065.inc b/Zend/tests/ns_065.inc new file mode 100755 index 000000000..963a74e14 --- /dev/null +++ b/Zend/tests/ns_065.inc @@ -0,0 +1,9 @@ + +===DONE=== +--EXPECTF-- + +Fatal error: Namespace declaration statement has to be the very first statement in the script in %sns_068.php on line %d diff --git a/Zend/tests/ns_069.inc b/Zend/tests/ns_069.inc new file mode 100644 index 000000000..4f186390a --- /dev/null +++ b/Zend/tests/ns_069.inc @@ -0,0 +1,3 @@ + +===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 new file mode 100644 index 000000000..37cb6a006 --- /dev/null +++ b/Zend/tests/ns_070.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing parameter type-hinted with default value inside namespace +--FILE-- + +--EXPECTF-- +object(stdClass)#%d (0) { +} +NULL diff --git a/Zend/tests/ns_071.phpt b/Zend/tests/ns_071.phpt new file mode 100644 index 000000000..1fdaec9db --- /dev/null +++ b/Zend/tests/ns_071.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing parameter type-hinted (array) with default value inside namespace +--FILE-- + +--EXPECTF-- +NULL + +Catchable fatal error: Argument 1 passed to foo\bar::__construct() must be an array, object given, called in %s on line %d and defined in %s on line %d diff --git a/Zend/tests/ns_072.phpt b/Zend/tests/ns_072.phpt new file mode 100644 index 000000000..c500bfddb --- /dev/null +++ b/Zend/tests/ns_072.phpt @@ -0,0 +1,33 @@ +--TEST-- +Testing parameter type-hinted with interface +--FILE-- + +--EXPECTF-- +object(foo\test)#%d (0) { +} +NULL + +Catchable fatal error: Argument 1 passed to foo\bar::__construct() must implement interface foo\foo, instance of stdClass given, called in %s on line %d and defined in %s on line %d diff --git a/Zend/tests/ns_073.phpt b/Zend/tests/ns_073.phpt new file mode 100644 index 000000000..bb03308d7 --- /dev/null +++ b/Zend/tests/ns_073.phpt @@ -0,0 +1,19 @@ +--TEST-- +Testing type-hinted lambda parameter inside namespace +--FILE-- + +--EXPECTF-- +NULL +object(stdClass)#%d (0) { +} diff --git a/Zend/tests/ns_074.phpt b/Zend/tests/ns_074.phpt new file mode 100644 index 000000000..28d8bf96b --- /dev/null +++ b/Zend/tests/ns_074.phpt @@ -0,0 +1,24 @@ +--TEST-- +Testing type-hinted lambda parameter inside namespace +--FILE-- + +--EXPECTF-- +NULL +object(foo\stdclass)#%d (0) { +} +object(stdClass)#%d (0) { +} diff --git a/Zend/tests/ns_075.phpt b/Zend/tests/ns_075.phpt new file mode 100755 index 000000000..0156e99eb --- /dev/null +++ b/Zend/tests/ns_075.phpt @@ -0,0 +1,10 @@ +--TEST-- +075: Redefining compile-time constants +--FILE-- + unknown); + +echo unknown; +echo "\n"; +var_dump($a); +echo \unknown; +--EXPECTF-- +Notice: Use of undefined constant unknown - assumed 'unknown' in %sns_076.php on line %d + +Notice: Use of undefined constant unknown - assumed 'unknown' in %sns_076.php on line %d + +Notice: Use of undefined constant unknown - assumed 'unknown' in %sns_076.php on line %d +unknown +array(1) { + ["unknown"]=> + %s(7) "unknown" +} + +Fatal error: Undefined constant 'unknown' in %sns_076.php on line %d diff --git a/Zend/tests/ns_077_1.phpt b/Zend/tests/ns_077_1.phpt new file mode 100755 index 000000000..5a9c4b153 --- /dev/null +++ b/Zend/tests/ns_077_1.phpt @@ -0,0 +1,13 @@ +--TEST-- +077: Unknown compile-time constants in namespace +--FILE-- + \unknown)) +{ +} + +foo(); +--EXPECTF-- +Fatal error: Undefined constant 'unknown' in %sns_077_%d.php on line %d diff --git a/Zend/tests/ns_077_2.phpt b/Zend/tests/ns_077_2.phpt new file mode 100755 index 000000000..8c2672185 --- /dev/null +++ b/Zend/tests/ns_077_2.phpt @@ -0,0 +1,13 @@ +--TEST-- +077: Unknown compile-time constants in namespace +--FILE-- + unknown)) +{ +} + +foo(); +--EXPECTF-- +Fatal error: Undefined constant 'unknown' in %sns_077_%d.php on line %d diff --git a/Zend/tests/ns_077_3.phpt b/Zend/tests/ns_077_3.phpt new file mode 100755 index 000000000..bdeb7924e --- /dev/null +++ b/Zend/tests/ns_077_3.phpt @@ -0,0 +1,13 @@ +--TEST-- +077: Unknown compile-time constants in namespace +--FILE-- + unknown)) +{ +} + +foo(); +--EXPECTF-- +Fatal error: Undefined constant 'foo\unknown' in %sns_077_%d.php on line %d diff --git a/Zend/tests/ns_077_4.phpt b/Zend/tests/ns_077_4.phpt new file mode 100755 index 000000000..aef91fd3e --- /dev/null +++ b/Zend/tests/ns_077_4.phpt @@ -0,0 +1,13 @@ +--TEST-- +077: Unknown compile-time constants in namespace +--FILE-- + namespace\unknown)) +{ +} + +foo(); +--EXPECTF-- +Fatal error: Undefined constant 'foo\unknown' in %sns_077_%d.php on line %d diff --git a/Zend/tests/ns_077_5.phpt b/Zend/tests/ns_077_5.phpt new file mode 100755 index 000000000..17afe03f4 --- /dev/null +++ b/Zend/tests/ns_077_5.phpt @@ -0,0 +1,12 @@ +--TEST-- +077: Unknown compile-time constants in namespace +--FILE-- + \unknown)) +{ +} + +foo(); +--EXPECTF-- +Fatal error: Undefined constant 'unknown' in %sns_077_%d.php on line %d diff --git a/Zend/tests/ns_077_6.phpt b/Zend/tests/ns_077_6.phpt new file mode 100755 index 000000000..17afe03f4 --- /dev/null +++ b/Zend/tests/ns_077_6.phpt @@ -0,0 +1,12 @@ +--TEST-- +077: Unknown compile-time constants in namespace +--FILE-- + \unknown)) +{ +} + +foo(); +--EXPECTF-- +Fatal error: Undefined constant 'unknown' in %sns_077_%d.php on line %d diff --git a/Zend/tests/ns_077_7.phpt b/Zend/tests/ns_077_7.phpt new file mode 100755 index 000000000..9bf5baf05 --- /dev/null +++ b/Zend/tests/ns_077_7.phpt @@ -0,0 +1,12 @@ +--TEST-- +077: Unknown compile-time constants in namespace +--FILE-- + namespace\unknown)) +{ +} + +foo(); +--EXPECTF-- +Fatal error: Undefined constant 'unknown' in %sns_077_%d.php on line %d diff --git a/Zend/tests/ns_077_8.phpt b/Zend/tests/ns_077_8.phpt new file mode 100755 index 000000000..9f9240db0 --- /dev/null +++ b/Zend/tests/ns_077_8.phpt @@ -0,0 +1,12 @@ +--TEST-- +077: Unknown compile-time constants in namespace +--FILE-- + unknown)) +{ +} + +foo(); +--EXPECTF-- +Fatal error: Undefined constant 'unknown' in %sns_077_%d.php on line %d diff --git a/Zend/tests/ns_078.phpt b/Zend/tests/ns_078.phpt new file mode 100755 index 000000000..ed6770ff4 --- /dev/null +++ b/Zend/tests/ns_078.phpt @@ -0,0 +1,33 @@ +--TEST-- +002: Import - different syntaxes +--FILE-- + +===DONE=== +--EXPECTF-- +Fatal error: Namespace declarations cannot be nested in %s on line %d diff --git a/Zend/tests/ns_080.phpt b/Zend/tests/ns_080.phpt new file mode 100644 index 000000000..9c81c0d4c --- /dev/null +++ b/Zend/tests/ns_080.phpt @@ -0,0 +1,15 @@ +--TEST-- +080: bracketed namespaces and __HALT_COMPILER(); +--FILE-- + +===DONE=== +--EXPECT-- +hi \ No newline at end of file diff --git a/Zend/tests/ns_081.phpt b/Zend/tests/ns_081.phpt new file mode 100644 index 000000000..e08a8088e --- /dev/null +++ b/Zend/tests/ns_081.phpt @@ -0,0 +1,23 @@ +--TEST-- +081: bracketed namespace with nested unbracketed namespace +--FILE-- + +===DONE=== +--EXPECTF-- +Fatal error: Cannot mix bracketed namespace declarations with unbracketed namespace declarations in %sns_081.php on line 9 diff --git a/Zend/tests/ns_082.phpt b/Zend/tests/ns_082.phpt new file mode 100644 index 000000000..322097404 --- /dev/null +++ b/Zend/tests/ns_082.phpt @@ -0,0 +1,12 @@ +--TEST-- +082: bracketed namespace with closing tag +--FILE-- + +--EXPECT-- +ok \ No newline at end of file diff --git a/Zend/tests/ns_083.phpt b/Zend/tests/ns_083.phpt new file mode 100644 index 000000000..4b821dbf0 --- /dev/null +++ b/Zend/tests/ns_083.phpt @@ -0,0 +1,14 @@ +--TEST-- +083: bracketed namespace with junk before the ns declaration +--FILE-- + +--EXPECTF-- +Fatal error: Namespace declaration statement has to be the very first statement in the script in %s on line %d diff --git a/Zend/tests/ns_084.phpt b/Zend/tests/ns_084.phpt new file mode 100644 index 000000000..cb1ae55e2 --- /dev/null +++ b/Zend/tests/ns_084.phpt @@ -0,0 +1,23 @@ +--TEST-- +084: unbracketed namespace with nested bracketed namespace +--FILE-- + +===DONE=== +--EXPECTF-- +Fatal error: Cannot mix bracketed namespace declarations with unbracketed namespace declarations in %sns_084.php on line 9 diff --git a/Zend/tests/ns_085.phpt b/Zend/tests/ns_085.phpt new file mode 100644 index 000000000..377da6a8d --- /dev/null +++ b/Zend/tests/ns_085.phpt @@ -0,0 +1,27 @@ +--TEST-- +085: bracketed namespace +--FILE-- +const_get; -echo $y,"\n"; -$x->const_set = 1; -echo $y,"\n"; -$x->const_call(); -echo $y,"\n"; -$z = $x["const_dim_get"]; -echo $y,"\n"; -$x["const_dim_set"] = 1; -echo $y,"\n"; -isset($x["const_dim_isset"]); -echo $y,"\n"; -unset($x["const_dim_unset"]); -echo $y,"\n"; - -// IS_CONST + conversion -$z = $x->{1}; -echo $y,"\n"; -$x->{2} = 1; -echo $y,"\n"; - -// IS_TMP_VAR -$c = "tmp"; -$z = $x->{$c."_get"}; -echo $y,"\n"; -$x->{$c."_set"} = 1; -echo $y,"\n"; -$x->{$c."_call"}(); -echo $y,"\n"; -$z = $x[$c."_dim_get"]; -echo $y,"\n"; -$x[$c."_dim_set"] = 1; -echo $y,"\n"; -isset($x[$c."_dim_isset"]); -echo $y,"\n"; -unset($x[$c."_dim_unset"]); -echo $y,"\n"; - -// IS_TMP_VAR + conversion -$c = 0; -$z = $x->{$c+3}; -echo $y,"\n"; -$x->{$c+4} = 1; -echo $y,"\n"; - -// IS_CV -$c = "cv_get"; -$z = $x->{$c}; -echo $y,"\n"; -$c = "cv_set"; -$x->{$c} = 1; -echo $y,"\n"; -$c = "cv_call"; -$x->{$c}(); -echo $y,"\n"; -$c = "cv_dim_get"; -$z = $x[$c]; -echo $y,"\n"; -$c = "cv_dim_set"; -$x[$c] = 1; -echo $y,"\n"; -$c = "cv_dim_isset"; -isset($x[$c]); -echo $y,"\n"; -$c = "cv_dim_unset"; -unset($x[$c]); -echo $y,"\n"; - -// IS_CV + conversion -$c = 5; -$z = $x->{$c}; -echo $y,"\n"; -$c = 6; -$x->{$c} = 1; -echo $y,"\n"; - -// IS_VAR -$z = $x->{f("var_get")}; -echo $y,"\n"; -$x->{f("var_set")} = 1; -echo $y,"\n"; -$x->{f("var_call")}(); -echo $y,"\n"; -$z = $x[f("var_dim_get")]; -echo $y,"\n"; -$x[f("var_dim_set")] = 1; -echo $y,"\n"; -isset($x[f("var_dim_isset")]); -echo $y,"\n"; -unset($x[f("var_dim_unset")]); -echo $y,"\n"; - -// IS_VAR + conversion -$z = $x->{f(7)}; -echo $y,"\n"; -$x->{f(8)} = 1; -echo $y,"\n"; -?> ---EXPECT-- -const_get -const_set -const_call -const_dim_get -const_dim_set -const_dim_isset -const_dim_unset -1 -2 -tmp_get -tmp_set -tmp_call -tmp_dim_get -tmp_dim_set -tmp_dim_isset -tmp_dim_unset -3 -4 -cv_get -cv_set -cv_call -cv_dim_get -cv_dim_set -cv_dim_isset -cv_dim_unset -5 -6 -var_get -var_set -var_call -var_dim_get -var_dim_set -var_dim_isset -var_dim_unset -7 -8 +--TEST-- +Magic object handlers segfaults and memory errors +--FILE-- +const_get; +echo $y,"\n"; +$x->const_set = 1; +echo $y,"\n"; +$x->const_call(); +echo $y,"\n"; +foo::const_callstatic(); +echo $y,"\n"; +$z = $x["const_dim_get"]; +echo $y,"\n"; +$x["const_dim_set"] = 1; +echo $y,"\n"; +isset($x["const_dim_isset"]); +echo $y,"\n"; +unset($x["const_dim_unset"]); +echo $y,"\n"; + +// IS_CONST + conversion +$z = $x->{1}; +echo $y,"\n"; +$x->{2} = 1; +echo $y,"\n"; + +// IS_TMP_VAR +$c = "tmp"; +$z = $x->{$c."_get"}; +echo $y,"\n"; +$x->{$c."_set"} = 1; +echo $y,"\n"; +$x->{$c."_call"}(); +echo $y,"\n"; +$z = $x[$c."_dim_get"]; +echo $y,"\n"; +$x[$c."_dim_set"] = 1; +echo $y,"\n"; +isset($x[$c."_dim_isset"]); +echo $y,"\n"; +unset($x[$c."_dim_unset"]); +echo $y,"\n"; + +// IS_TMP_VAR + conversion +$c = 0; +$z = $x->{$c+3}; +echo $y,"\n"; +$x->{$c+4} = 1; +echo $y,"\n"; + +// IS_CV +$c = "cv_get"; +$z = $x->{$c}; +echo $y,"\n"; +$c = "cv_set"; +$x->{$c} = 1; +echo $y,"\n"; +$c = "cv_call"; +$x->{$c}(); +echo $y,"\n"; +$c = "cv_dim_get"; +$z = $x[$c]; +echo $y,"\n"; +$c = "cv_dim_set"; +$x[$c] = 1; +echo $y,"\n"; +$c = "cv_dim_isset"; +isset($x[$c]); +echo $y,"\n"; +$c = "cv_dim_unset"; +unset($x[$c]); +echo $y,"\n"; + +// IS_CV + conversion +$c = 5; +$z = $x->{$c}; +echo $y,"\n"; +$c = 6; +$x->{$c} = 1; +echo $y,"\n"; + +// IS_VAR +$z = $x->{f("var_get")}; +echo $y,"\n"; +$x->{f("var_set")} = 1; +echo $y,"\n"; +$x->{f("var_call")}(); +echo $y,"\n"; +$z = $x[f("var_dim_get")]; +echo $y,"\n"; +$x[f("var_dim_set")] = 1; +echo $y,"\n"; +isset($x[f("var_dim_isset")]); +echo $y,"\n"; +unset($x[f("var_dim_unset")]); +echo $y,"\n"; + +// IS_VAR + conversion +$z = $x->{f(7)}; +echo $y,"\n"; +$x->{f(8)} = 1; +echo $y,"\n"; +?> +--EXPECT-- +const_get +const_set +const_call +const_callstatic +const_dim_get +const_dim_set +const_dim_isset +const_dim_unset +1 +2 +tmp_get +tmp_set +tmp_call +tmp_dim_get +tmp_dim_set +tmp_dim_isset +tmp_dim_unset +3 +4 +cv_get +cv_set +cv_call +cv_dim_get +cv_dim_set +cv_dim_isset +cv_dim_unset +5 +6 +var_get +var_set +var_call +var_dim_get +var_dim_set +var_dim_isset +var_dim_unset +7 +8 diff --git a/Zend/tests/objects_017.phpt b/Zend/tests/objects_017.phpt new file mode 100644 index 000000000..63030304f --- /dev/null +++ b/Zend/tests/objects_017.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing visibility of object returned by function +--FILE-- +test = 2; + +?> +--EXPECTF-- +Fatal error: Cannot access private property foo::$test in %s on line %d diff --git a/Zend/tests/objects_018.phpt b/Zend/tests/objects_018.phpt new file mode 100644 index 000000000..5a24f4d42 --- /dev/null +++ b/Zend/tests/objects_018.phpt @@ -0,0 +1,19 @@ +--TEST-- +Using the same function name on interface with inheritance +--FILE-- + +--EXPECTF-- +Fatal error: Can't inherit abstract function Itest2::a() (previously declared abstract in Itest) in %s on line %d diff --git a/Zend/tests/objects_019.phpt b/Zend/tests/objects_019.phpt new file mode 100644 index 000000000..53889edfa --- /dev/null +++ b/Zend/tests/objects_019.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing references of dynamic properties +--FILE-- +a = &$foo[0]->a; +$foo[0]->a = 2; + +$x = $foo[1]->a; +$x = 'foo'; + +var_dump($foo, $x); + +?> +--EXPECT-- +array(2) { + [0]=> + object(stdClass)#1 (1) { + ["a"]=> + &int(2) + } + [1]=> + object(stdClass)#2 (1) { + ["a"]=> + &int(2) + } +} +string(3) "foo" diff --git a/Zend/tests/objects_020.phpt b/Zend/tests/objects_020.phpt new file mode 100644 index 000000000..b7c709f32 --- /dev/null +++ b/Zend/tests/objects_020.phpt @@ -0,0 +1,33 @@ +--TEST-- +Accessing members of standard object through of variable variable +--FILE-- +a =& $$test; +$$test->a->b[] = 2; + +var_dump($$test); + +?> +--EXPECT-- +object(stdClass)#1 (2) { + ["a"]=> + &object(stdClass)#1 (2) { + ["a"]=> + *RECURSION* + ["b"]=> + array(1) { + [0]=> + int(2) + } + } + ["b"]=> + array(1) { + [0]=> + int(2) + } +} diff --git a/Zend/tests/objects_021.phpt b/Zend/tests/objects_021.phpt new file mode 100644 index 000000000..70dcbfbe7 --- /dev/null +++ b/Zend/tests/objects_021.phpt @@ -0,0 +1,39 @@ +--TEST-- +Testing magic methods __set, __get and __call in cascade +--FILE-- +a + ->b() + ->c = 1; + +var_dump(test::$i); + +?> +--EXPECT-- +int(4) diff --git a/Zend/tests/objects_022.phpt b/Zend/tests/objects_022.phpt new file mode 100644 index 000000000..5a80e0a41 --- /dev/null +++ b/Zend/tests/objects_022.phpt @@ -0,0 +1,39 @@ +--TEST-- +Testing 'self', 'parent' as type-hint +--FILE-- +testFoo(new foo); +$foo->testBar(new bar); +$foo->testBaz(new baz); +$foo->testFoo(new stdClass); // Catchable fatal error + +?> +--EXPECTF-- +object(foo)#%d (0) { +} +object(bar)#%d (0) { +} +object(baz)#%d (0) { +} + +Catchable fatal error: Argument 1 passed to foo::testFoo() must be an instance of foo, instance of stdClass given, called in %s on line %d and defined in %s on line %d diff --git a/Zend/tests/objects_023.phpt b/Zend/tests/objects_023.phpt new file mode 100644 index 000000000..042a20e9d --- /dev/null +++ b/Zend/tests/objects_023.phpt @@ -0,0 +1,15 @@ +--TEST-- +Creating instances dynamically +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/tests/objects_024.phpt b/Zend/tests/objects_024.phpt new file mode 100644 index 000000000..af3f879db --- /dev/null +++ b/Zend/tests/objects_024.phpt @@ -0,0 +1,53 @@ +--TEST-- +Testing direct assigning for property of object returned by function +--FILE-- +bar = 1; +var_dump($a, count(foo::$bar), test()->whatever); + +print "\n"; + +$a = test()->bar = NULL; +var_dump($a, count(foo::$bar), test()->whatever); + +print "\n"; + +$a = test()->bar = test(); +var_dump($a, count(foo::$bar), test()->whatever); + +print "\n"; + +?> +--EXPECTF-- +int(1) +int(1) +int(1) + +NULL +int(2) +NULL + +object(foo)#%d (0) { +} +int(3) +object(foo)#%d (0) { +} + diff --git a/Zend/tests/objects_025.phpt b/Zend/tests/objects_025.phpt new file mode 100644 index 000000000..110ffc69b --- /dev/null +++ b/Zend/tests/objects_025.phpt @@ -0,0 +1,46 @@ +--TEST-- +Testing invalid method names with __call and __callstatic +--FILE-- +foooo(); +$a::foooo(); + +$b = 'aaaaa1'; +$a->$b(); +$a::$b(); + +$b = ' '; +$a->$b(); +$a::$b(); + +$b = str_repeat('a', 10000); +$a->$b(); +$a::$b(); + +$b = NULL; +$a->$b(); + +?> +--EXPECTF-- +non-static - ok +static - ok +non-static - ok +static - ok +non-static - ok +static - ok +non-static - ok +static - ok + +Fatal error: Method name must be a string in %s on line %d diff --git a/Zend/tests/objects_026.phpt b/Zend/tests/objects_026.phpt new file mode 100644 index 000000000..eb3a89f67 --- /dev/null +++ b/Zend/tests/objects_026.phpt @@ -0,0 +1,13 @@ +--TEST-- +Using $this when out of context +--FILE-- +a = 1; +} catch (Exception $e) { +} + +?> +--EXPECTF-- +Fatal error: Using $this when not in object context in %s on line %d diff --git a/Zend/tests/objects_027.phpt b/Zend/tests/objects_027.phpt new file mode 100644 index 000000000..184b471cb --- /dev/null +++ b/Zend/tests/objects_027.phpt @@ -0,0 +1,44 @@ +--TEST-- +Testing 'new static;' calling parent method +--FILE-- +test(); +$foo::test(); + +call_user_func(array($foo, 'test')); +call_user_func(array('foo', 'test')); + +?> +--EXPECTF-- +object(foo)#%d (0) { +} + +Strict Standards: Non-static method foo::test() should not be called statically in %s on line %d + +Strict Standards: Non-static method bar::show() should not be called statically in %s on line %d +object(foo)#%d (0) { +} +object(foo)#%d (0) { +} + +Strict Standards: call_user_func() expects parameter 1 to be a valid callback, non-static method foo::test() should not be called statically in %s on line %d + +Strict Standards: 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 new file mode 100644 index 000000000..5c7661293 --- /dev/null +++ b/Zend/tests/objects_028.phpt @@ -0,0 +1,25 @@ +--TEST-- +Testing 'static::' and 'parent::' in calls +--FILE-- + +--EXPECT-- +hello +hello diff --git a/Zend/tests/objects_029.phpt b/Zend/tests/objects_029.phpt new file mode 100644 index 000000000..5e8de185f --- /dev/null +++ b/Zend/tests/objects_029.phpt @@ -0,0 +1,26 @@ +--TEST-- +Trying to access undeclared static property +--FILE-- + +--EXPECTF-- +Fatal error: Access to undeclared static property: foo::$f in %s on line %d diff --git a/Zend/tests/objects_030.phpt b/Zend/tests/objects_030.phpt new file mode 100644 index 000000000..8b7cfe39a --- /dev/null +++ b/Zend/tests/objects_030.phpt @@ -0,0 +1,26 @@ +--TEST-- +Trying to access undeclared parent property +--FILE-- + +--EXPECTF-- +Fatal error: Access to undeclared static property: bar::$f in %s on line %d diff --git a/Zend/tests/objects_031.phpt b/Zend/tests/objects_031.phpt new file mode 100644 index 000000000..0bf218209 --- /dev/null +++ b/Zend/tests/objects_031.phpt @@ -0,0 +1,28 @@ +--TEST-- +Cloning stdClass +--FILE-- +a = 1; + +var_dump($x); + +?> +--EXPECTF-- +array(3) { + [0]=> + object(stdClass)#%d (1) { + ["a"]=> + int(1) + } + [1]=> + object(stdClass)#%d (0) { + } + [2]=> + object(stdClass)#%d (0) { + } +} diff --git a/Zend/tests/offset_array.phpt b/Zend/tests/offset_array.phpt index a7e2f21b1..eba6611e6 100644 --- a/Zend/tests/offset_array.phpt +++ b/Zend/tests/offset_array.phpt @@ -28,10 +28,10 @@ echo "Done\n"; int(2) int(1) -Notice: Undefined index: in %s on line %d +Notice: Undefined index: in %s on line %d NULL -Notice: Undefined index: run away in %s on line %d +Notice: Undefined index: run away in %s on line %d NULL int(2) int(1) diff --git a/Zend/tests/property_exists.phpt b/Zend/tests/property_exists.phpt new file mode 100644 index 000000000..f6d9a4a4e --- /dev/null +++ b/Zend/tests/property_exists.phpt @@ -0,0 +1,57 @@ +--TEST-- +Testing property_exists() +--FILE-- +nonstaticTest(); + +?> +--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) diff --git a/Zend/tests/selfParent_001.phpt b/Zend/tests/selfParent_001.phpt index d2796996d..9d8cd6e22 100755 --- a/Zend/tests/selfParent_001.phpt +++ b/Zend/tests/selfParent_001.phpt @@ -1,27 +1,27 @@ ---TEST-- -Test when constants are initialised. See also selfParent_002.phpt. ---FILE-- - ---EXPECT-- -string(10) "const in A" -string(10) "const in A" +--TEST-- +Test when constants are initialised. See also selfParent_002.phpt. +--FILE-- + +--EXPECT-- +string(10) "const in A" +string(10) "const in A" diff --git a/Zend/tests/selfParent_002.phpt b/Zend/tests/selfParent_002.phpt index 45120177a..18a8f09ea 100755 --- a/Zend/tests/selfParent_002.phpt +++ b/Zend/tests/selfParent_002.phpt @@ -1,27 +1,27 @@ ---TEST-- -Test when constants are initialised. See also selfParent_001.phpt. ---FILE-- - ---EXPECT-- +--TEST-- +Test when constants are initialised. See also selfParent_001.phpt. +--FILE-- + +--EXPECT-- +string(10) "const in A" string(10) "const in A" -string(10) "const in A" diff --git a/Zend/tests/unset_cv01.phpt b/Zend/tests/unset_cv01.phpt index 05270c18e..99af118d1 100644 --- a/Zend/tests/unset_cv01.phpt +++ b/Zend/tests/unset_cv01.phpt @@ -1,13 +1,13 @@ ---TEST-- -unset() CV 1 (unset() global variable) ---FILE-- - ---EXPECTF-- -ok - -Notice: Undefined variable: x in %sunset_cv01.php on line %d +--TEST-- +unset() CV 1 (unset() global variable) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv01.php on line %d diff --git a/Zend/tests/unset_cv02.phpt b/Zend/tests/unset_cv02.phpt index f42d08da0..cb2475350 100644 --- a/Zend/tests/unset_cv02.phpt +++ b/Zend/tests/unset_cv02.phpt @@ -1,13 +1,13 @@ ---TEST-- -unset() CV 2 (unset() global variable in $GLOBALS) ---FILE-- - ---EXPECTF-- -ok - -Notice: Undefined variable: x in %sunset_cv02.php on line %d +--TEST-- +unset() CV 2 (unset() global variable in $GLOBALS) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv02.php on line %d diff --git a/Zend/tests/unset_cv03.phpt b/Zend/tests/unset_cv03.phpt index 15c7b89fe..221abe2d8 100644 --- a/Zend/tests/unset_cv03.phpt +++ b/Zend/tests/unset_cv03.phpt @@ -1,13 +1,13 @@ ---TEST-- -unset() CV 3 (unset() global variable in included file) ---FILE-- - ---EXPECTF-- -ok - -Notice: Undefined variable: x in %sunset_cv03.php on line %d +--TEST-- +unset() CV 3 (unset() global variable in included file) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv03.php on line %d diff --git a/Zend/tests/unset_cv04.phpt b/Zend/tests/unset_cv04.phpt index f0634c391..5044cb1c8 100644 --- a/Zend/tests/unset_cv04.phpt +++ b/Zend/tests/unset_cv04.phpt @@ -1,16 +1,16 @@ ---TEST-- -unset() CV 4 (unset() local variable in included file) ---FILE-- - ---EXPECTF-- -ok - -Notice: Undefined variable: x in %sunset_cv04.php on line %d +--TEST-- +unset() CV 4 (unset() local variable in included file) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv04.php on line %d diff --git a/Zend/tests/unset_cv05.phpt b/Zend/tests/unset_cv05.phpt index 5d26535de..bc023c4e2 100644 --- a/Zend/tests/unset_cv05.phpt +++ b/Zend/tests/unset_cv05.phpt @@ -1,28 +1,28 @@ ---TEST-- -unset() CV 5 (indirect unset() of global variable in session_start()) ---INI-- -register_long_arrays=1 -session.auto_start=0 -session.save_handler=files ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -ok - -Warning: session_start(): Cannot send session cookie - headers already sent by (output started at %sunset_cv05.php on line %d - -Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at %sunset_cv05.php:%d) in %sunset_cv05.php on line %d -Array -ok +--TEST-- +unset() CV 5 (indirect unset() of global variable in session_start()) +--INI-- +register_long_arrays=1 +session.auto_start=0 +session.save_handler=files +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +ok + +Warning: session_start(): Cannot send session cookie - headers already sent by (output started at %sunset_cv05.php on line %d + +Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at %sunset_cv05.php:%d) in %sunset_cv05.php on line %d +Array +ok diff --git a/Zend/tests/unset_cv06.phpt b/Zend/tests/unset_cv06.phpt index fa414b20b..3a70ad770 100644 --- a/Zend/tests/unset_cv06.phpt +++ b/Zend/tests/unset_cv06.phpt @@ -1,26 +1,28 @@ ---TEST-- -unset() CV 6 (indirect unset() of global variable in session_unset()) ---SKIPIF-- - ---INI-- -register_globals=1 -session.auto_start=0 -session.save_handler=files ---FILE-- - ---EXPECTF-- -1 -2 - -Notice: Undefined variable: x in %sunset_cv06.php on line %d -ok +--TEST-- +unset() CV 6 (indirect unset() of global variable in session_unset()) +--SKIPIF-- + +--INI-- +register_globals=1 +session.auto_start=0 +session.save_handler=files +--FILE-- + +--EXPECTF-- +1 + +Deprecated: Function session_register() is deprecated in %s on line %d +2 + +Notice: Undefined variable: x in %sunset_cv06.php on line %d +ok diff --git a/Zend/tests/unset_cv08.phpt b/Zend/tests/unset_cv08.phpt index d5d52efdb..1c4015ab3 100644 --- a/Zend/tests/unset_cv08.phpt +++ b/Zend/tests/unset_cv08.phpt @@ -1,15 +1,15 @@ ---TEST-- -unset() CV 8 (unset() of global variable in array_unique($GLOBALS)) ---FILE-- - ---EXPECTF-- -ok -ok -ok +--TEST-- +unset() CV 8 (unset() of global variable in array_unique($GLOBALS)) +--FILE-- + +--EXPECTF-- +ok +ok +ok diff --git a/Zend/tests/unset_cv09.phpt b/Zend/tests/unset_cv09.phpt index 7b0f9bf50..a5407ad64 100644 --- a/Zend/tests/unset_cv09.phpt +++ b/Zend/tests/unset_cv09.phpt @@ -1,14 +1,14 @@ ---TEST-- -unset() CV 9 (unset() of global variable in array_pop($GLOBALS)) ---FILE-- - ---EXPECTF-- -ok - -Notice: Undefined variable: x in %sunset_cv09.php on line %d -ok +--TEST-- +unset() CV 9 (unset() of global variable in array_pop($GLOBALS)) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv09.php on line %d +ok diff --git a/Zend/tests/unset_cv10.phpt b/Zend/tests/unset_cv10.phpt index 57e76fb8e..0eb41922c 100644 --- a/Zend/tests/unset_cv10.phpt +++ b/Zend/tests/unset_cv10.phpt @@ -1,18 +1,18 @@ ---TEST-- -unset() CV 10 (unset() of global variable in ArrayObject::offsetUnset($GLOBALS)) ---SKIPIF-- - ---FILE-- -offsetUnset('x'); -echo $x; -echo "ok\n"; -?> ---EXPECTF-- -ok - -Notice: Undefined variable: x in %sunset_cv10.php on line %d -ok +--TEST-- +unset() CV 10 (unset() of global variable in ArrayObject::offsetUnset($GLOBALS)) +--SKIPIF-- + +--FILE-- +offsetUnset('x'); +echo $x; +echo "ok\n"; +?> +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv10.php on line %d +ok diff --git a/Zend/tests/unset_cv11.phpt b/Zend/tests/unset_cv11.phpt index 9ebc3fadb..152ea0229 100644 --- a/Zend/tests/unset_cv11.phpt +++ b/Zend/tests/unset_cv11.phpt @@ -1,21 +1,21 @@ ---TEST-- -unset() CV 11 (unset() of copy destoies original value) ---FILE-- -"ok"); -var_dump($x); -$cf = $x; -unset($cf['default']); -var_dump($x); -echo "ok\n"; -?> ---EXPECT-- -array(1) { - ["default"]=> - string(2) "ok" -} -array(1) { - ["default"]=> - string(2) "ok" -} -ok +--TEST-- +unset() CV 11 (unset() of copy destoies original value) +--FILE-- +"ok"); +var_dump($x); +$cf = $x; +unset($cf['default']); +var_dump($x); +echo "ok\n"; +?> +--EXPECT-- +array(1) { + ["default"]=> + string(2) "ok" +} +array(1) { + ["default"]=> + string(2) "ok" +} +ok diff --git a/Zend/tests/unset_cv12.phpt b/Zend/tests/unset_cv12.phpt index dd4544726..a22b13dea 100755 --- a/Zend/tests/unset_cv12.phpt +++ b/Zend/tests/unset_cv12.phpt @@ -1,11 +1,11 @@ ---TEST-- -unset() CV 12 (unset() in indirect called function) ---FILE-- - ---EXPECT-- -ok +--TEST-- +unset() CV 12 (unset() in indirect called function) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/zend.c b/Zend/zend.c index 6a171ba97..a27eb3d75 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.308.2.12.2.37 2008/12/31 11:17:32 sebastian Exp $ */ +/* $Id: zend.c,v 1.308.2.12.2.35.2.30 2009/03/18 10:18:09 dmitry Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -28,17 +28,18 @@ #include "zend_exceptions.h" #include "zend_builtin_functions.h" #include "zend_ini.h" +#include "zend_vm.h" #ifdef ZTS -# define GLOBAL_FUNCTION_TABLE global_function_table -# define GLOBAL_CLASS_TABLE global_class_table -# define GLOBAL_CONSTANTS_TABLE global_constants_table -# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table +# define GLOBAL_FUNCTION_TABLE global_function_table +# define GLOBAL_CLASS_TABLE global_class_table +# define GLOBAL_CONSTANTS_TABLE global_constants_table +# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table #else -# define GLOBAL_FUNCTION_TABLE CG(function_table) -# define GLOBAL_CLASS_TABLE CG(class_table) -# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals) -# define GLOBAL_CONSTANTS_TABLE EG(zend_constants) +# define GLOBAL_FUNCTION_TABLE CG(function_table) +# define GLOBAL_CLASS_TABLE CG(class_table) +# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals) +# define GLOBAL_CONSTANTS_TABLE EG(zend_constants) #endif #if defined(ZEND_WIN32) && ZEND_DEBUG @@ -49,7 +50,7 @@ BOOL WINAPI IsDebuggerPresent(VOID); ZEND_API zend_class_entry *zend_standard_class_def = NULL; ZEND_API int (*zend_printf)(const char *format, ...); ZEND_API zend_write_func_t zend_write; -ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path); +ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC); ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); ZEND_API void (*zend_block_interruptions)(void); ZEND_API void (*zend_unblock_interruptions)(void); @@ -57,29 +58,41 @@ ZEND_API void (*zend_ticks_function)(int ticks); ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap); ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC); +ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); void (*zend_on_timeout)(int seconds TSRMLS_DC); -static void (*zend_message_dispatcher_p)(long message, void *data); -static int (*zend_get_configuration_directive_p)(char *name, uint name_length, zval *contents); +static void (*zend_message_dispatcher_p)(long message, void *data TSRMLS_DC); +static int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents); - -static ZEND_INI_MH(OnUpdateErrorReporting) +static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ { if (!new_value) { - EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT; + EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED; } else { EG(error_reporting) = atoi(new_value); } return SUCCESS; } +/* }}} */ + +static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */ +{ + OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + + if (GC_G(gc_enabled)) { + gc_init(TSRMLS_C); + } + return SUCCESS; +} +/* }}} */ ZEND_INI_BEGIN() ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting) - STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode", "0", ZEND_INI_ALL, OnUpdateBool, ze1_compatibility_mode, zend_executor_globals, executor_globals) + STD_ZEND_INI_BOOLEAN("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, gc_enabled, zend_gc_globals, gc_globals) #ifdef ZEND_MULTIBYTE - STD_ZEND_INI_BOOLEAN("detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals) + STD_ZEND_INI_BOOLEAN("detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals) #endif ZEND_INI_END() @@ -87,10 +100,10 @@ ZEND_INI_END() #ifdef ZTS ZEND_API int compiler_globals_id; ZEND_API int executor_globals_id; -HashTable *global_function_table; -HashTable *global_class_table; -HashTable *global_constants_table; -HashTable *global_auto_globals_table; +static HashTable *global_function_table = NULL; +static HashTable *global_class_table = NULL; +static HashTable *global_constants_table = NULL; +static HashTable *global_auto_globals_table = NULL; static HashTable *global_persistent_list = NULL; #endif @@ -102,11 +115,9 @@ ZEND_API zval zval_used_for_init; /* True global variable */ static char *zend_version_info; static uint zend_version_info_length; #define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2009 Zend Technologies\n" - - #define PRINT_ZVAL_INDENT 4 -static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) +static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) /* {{{ */ { zval **tmp; char *string_key; @@ -115,14 +126,14 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, uint str_len; int i; - for (i=0; i 0) { - ZEND_PUTS(","); - } - ZEND_PUTS("["); - switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) { - case HASH_KEY_IS_STRING: - ZEND_PUTS(string_key); - break; - case HASH_KEY_IS_LONG: - zend_printf("%ld", num_key); - break; + zval **tmp; + char *string_key; + HashPosition iterator; + ulong num_key; + uint str_len; + int i = 0; + + zend_hash_internal_pointer_reset_ex(ht, &iterator); + while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) { + if (i++ > 0) { + ZEND_PUTS(","); + } + ZEND_PUTS("["); + switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) { + case HASH_KEY_IS_STRING: + ZEND_PUTS(string_key); + break; + case HASH_KEY_IS_LONG: + zend_printf("%ld", num_key); + break; + } + ZEND_PUTS("] => "); + zend_print_flat_zval_r(*tmp TSRMLS_CC); + zend_hash_move_forward_ex(ht, &iterator); } - ZEND_PUTS("] => "); - zend_print_flat_zval_r(*tmp TSRMLS_CC); - zend_hash_move_forward_ex(ht, &iterator); - } } +/* }}} */ -ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy) +ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy) /* {{{ */ { - if (expr->type==IS_STRING) { + if (Z_TYPE_P(expr)==IS_STRING) { *use_copy = 0; return; } - switch (expr->type) { + switch (Z_TYPE_P(expr)) { case IS_NULL: - expr_copy->value.str.len = 0; - expr_copy->value.str.val = STR_EMPTY_ALLOC(); + Z_STRLEN_P(expr_copy) = 0; + Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC(); break; case IS_BOOL: - if (expr->value.lval) { - expr_copy->value.str.len = 1; - expr_copy->value.str.val = estrndup("1", 1); + if (Z_LVAL_P(expr)) { + Z_STRLEN_P(expr_copy) = 1; + Z_STRVAL_P(expr_copy) = estrndup("1", 1); } else { - expr_copy->value.str.len = 0; - expr_copy->value.str.val = STR_EMPTY_ALLOC(); + Z_STRLEN_P(expr_copy) = 0; + Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC(); } break; case IS_RESOURCE: - expr_copy->value.str.len = zend_spprintf(&expr_copy->value.str.val, 0, "Resource id #%ld", expr->value.lval); + Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG); + Z_STRLEN_P(expr_copy) = sprintf(Z_STRVAL_P(expr_copy), "Resource id #%ld", Z_LVAL_P(expr)); break; case IS_ARRAY: - expr_copy->value.str.len = sizeof("Array")-1; - expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len); + Z_STRLEN_P(expr_copy) = sizeof("Array") - 1; + Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRLEN_P(expr_copy)); break; case IS_OBJECT: { TSRMLS_FETCH(); - if(Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { + if (Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { break; } /* Standard PHP objects */ @@ -236,8 +252,8 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop if (!Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, get)) { zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC); - z->refcount++; - if(Z_TYPE_P(z) != IS_OBJECT) { + Z_ADDREF_P(z); + if (Z_TYPE_P(z) != IS_OBJECT) { zend_make_printable_zval(z, expr_copy, use_copy); if (*use_copy) { zval_ptr_dtor(&z); @@ -250,8 +266,8 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop zval_ptr_dtor(&z); } zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name); - expr_copy->value.str.len = 0; - expr_copy->value.str.val = STR_EMPTY_ALLOC(); + Z_STRLEN_P(expr_copy) = 0; + Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC(); } break; case IS_DOUBLE: @@ -265,18 +281,18 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop convert_to_string(expr_copy); break; } - expr_copy->type = IS_STRING; + Z_TYPE_P(expr_copy) = IS_STRING; *use_copy = 1; } +/* }}} */ - -ZEND_API int zend_print_zval(zval *expr, int indent) +ZEND_API int zend_print_zval(zval *expr, int indent) /* {{{ */ { return zend_print_zval_ex(zend_write, expr, indent); } +/* }}} */ - -ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) +ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */ { zval expr_copy; int use_copy; @@ -285,43 +301,48 @@ ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int in if (use_copy) { expr = &expr_copy; } - if (expr->value.str.len==0) { /* optimize away empty strings */ + if (Z_STRLEN_P(expr) == 0) { /* optimize away empty strings */ if (use_copy) { zval_dtor(expr); } return 0; } - write_func(expr->value.str.val, expr->value.str.len); + write_func(Z_STRVAL_P(expr), Z_STRLEN_P(expr)); if (use_copy) { zval_dtor(expr); } - return expr->value.str.len; + return Z_STRLEN_P(expr); } +/* }}} */ -ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) +ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */ { - switch (expr->type) { - case IS_ARRAY: - ZEND_PUTS("Array ("); - if (++expr->value.ht->nApplyCount>1) { - ZEND_PUTS(" *RECURSION*"); - expr->value.ht->nApplyCount--; - return; - } - print_flat_hash(expr->value.ht TSRMLS_CC); - ZEND_PUTS(")"); - expr->value.ht->nApplyCount--; - break; - case IS_OBJECT: - { + switch (Z_TYPE_P(expr)) { + case IS_ARRAY: + ZEND_PUTS("Array ("); + if (++Z_ARRVAL_P(expr)->nApplyCount>1) { + ZEND_PUTS(" *RECURSION*"); + Z_ARRVAL_P(expr)->nApplyCount--; + return; + } + print_flat_hash(Z_ARRVAL_P(expr) TSRMLS_CC); + ZEND_PUTS(")"); + Z_ARRVAL_P(expr)->nApplyCount--; + break; + case IS_OBJECT: + { HashTable *properties = NULL; char *class_name = NULL; zend_uint clen; - + if (Z_OBJ_HANDLER_P(expr, get_class_name)) { Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC); } - zend_printf("%s Object (", class_name?class_name:"Unknown Class"); + if (class_name) { + zend_printf("%s Object (", class_name); + } else { + zend_printf("%s Object (", "Unknown Class"); + } if (class_name) { efree(class_name); } @@ -339,38 +360,40 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) } ZEND_PUTS(")"); break; - } - default: - zend_print_variable(expr); - break; - } + } + default: + zend_print_variable(expr); + break; + } } +/* }}} */ -ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC) +ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC) /* {{{ */ { zend_print_zval_r_ex(zend_write, expr, indent TSRMLS_CC); } +/* }}} */ - -ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) +ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) /* {{{ */ { - switch (expr->type) { + switch (Z_TYPE_P(expr)) { case IS_ARRAY: ZEND_PUTS_EX("Array\n"); - if (++expr->value.ht->nApplyCount>1) { + if (++Z_ARRVAL_P(expr)->nApplyCount>1) { ZEND_PUTS_EX(" *RECURSION*"); - expr->value.ht->nApplyCount--; + Z_ARRVAL_P(expr)->nApplyCount--; return; } - print_hash(write_func, expr->value.ht, indent, 0 TSRMLS_CC); - expr->value.ht->nApplyCount--; + print_hash(write_func, Z_ARRVAL_P(expr), indent, 0 TSRMLS_CC); + Z_ARRVAL_P(expr)->nApplyCount--; break; case IS_OBJECT: { - HashTable *properties = NULL; + HashTable *properties; char *class_name = NULL; zend_uint clen; - + int is_temp; + if (Z_OBJ_HANDLER_P(expr, get_class_name)) { Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC); } @@ -383,17 +406,19 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int if (class_name) { efree(class_name); } - if (Z_OBJ_HANDLER_P(expr, get_properties)) { - properties = Z_OBJPROP_P(expr); + if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) { + break; } - if (properties) { - if (++properties->nApplyCount>1) { - ZEND_PUTS_EX(" *RECURSION*"); - properties->nApplyCount--; - return; - } - print_hash(write_func, properties, indent, 1 TSRMLS_CC); + if (++properties->nApplyCount>1) { + ZEND_PUTS_EX(" *RECURSION*"); properties->nApplyCount--; + return; + } + print_hash(write_func, properties, indent, 1 TSRMLS_CC); + properties->nApplyCount--; + if (is_temp) { + zend_hash_destroy(properties); + efree(properties); } break; } @@ -402,53 +427,62 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int break; } } +/* }}} */ - -static FILE *zend_fopen_wrapper(const char *filename, char **opened_path) +static FILE *zend_fopen_wrapper(const char *filename, char **opened_path TSRMLS_DC) /* {{{ */ { if (opened_path) { *opened_path = estrdup(filename); } return fopen(filename, "rb"); } - - -static void register_standard_class(TSRMLS_D) -{ - zend_standard_class_def = calloc(1, sizeof(zend_class_entry)); - - zend_standard_class_def->type = ZEND_INTERNAL_CLASS; - zend_standard_class_def->name_length = sizeof("stdClass") - 1; - zend_standard_class_def->name = zend_strndup("stdClass", zend_standard_class_def->name_length); - zend_initialize_class_data(zend_standard_class_def, 1 TSRMLS_CC); - - zend_hash_add(CG(class_table), "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry *), NULL); -} +/* }}} */ #ifdef ZTS -static zend_bool asp_tags_default = 0; -static zend_bool short_tags_default = 1; -static zend_bool ct_pass_ref_default = 1; -static zend_bool extended_info_default = 0; +static zend_bool asp_tags_default = 0; +static zend_bool short_tags_default = 1; +static zend_bool ct_pass_ref_default = 1; +static zend_uint compiler_options_default = ZEND_COMPILE_DEFAULT; #else -# define asp_tags_default 0 -# define short_tags_default 1 -# define ct_pass_ref_default 1 -# define extended_info_default 0 +# define asp_tags_default 0 +# define short_tags_default 1 +# define ct_pass_ref_default 1 +# define compiler_options_default ZEND_COMPILE_DEFAULT #endif -static void zend_set_default_compile_time_values(TSRMLS_D) +static void zend_set_default_compile_time_values(TSRMLS_D) /* {{{ */ { /* default compile-time values */ CG(asp_tags) = asp_tags_default; CG(short_tags) = short_tags_default; CG(allow_call_time_pass_reference) = ct_pass_ref_default; - CG(extended_info) = extended_info_default; + CG(compiler_options) = compiler_options_default; } +/* }}} */ +static void zend_init_exception_op(TSRMLS_D) /* {{{ */ +{ + memset(EG(exception_op), 0, sizeof(EG(exception_op))); + EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION; + EG(exception_op)[0].op1.op_type = IS_UNUSED; + EG(exception_op)[0].op2.op_type = IS_UNUSED; + EG(exception_op)[0].result.op_type = IS_UNUSED; + ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)); + EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION; + EG(exception_op)[1].op1.op_type = IS_UNUSED; + EG(exception_op)[1].op2.op_type = IS_UNUSED; + EG(exception_op)[1].result.op_type = IS_UNUSED; + ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1); + EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION; + EG(exception_op)[2].op1.op_type = IS_UNUSED; + EG(exception_op)[2].op2.op_type = IS_UNUSED; + EG(exception_op)[2].result.op_type = IS_UNUSED; + ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2); +} +/* }}} */ #ifdef ZTS -static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC) +static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC) /* {{{ */ { zend_function tmp_func; zend_class_entry *tmp_class; @@ -456,12 +490,12 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS compiler_globals->compiled_filename = NULL; compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); - zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function)); + zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); + zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function)); - compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0); - zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *)); + compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable)); + zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0); + zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *)); zend_set_default_compile_time_values(TSRMLS_C); @@ -478,9 +512,9 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS compiler_globals->static_members = NULL; } } +/* }}} */ - -static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC) +static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC) /* {{{ */ { if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) { zend_hash_destroy(compiler_globals->function_table); @@ -499,14 +533,15 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS } compiler_globals->last_static_member = 0; } +/* }}} */ - -static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC) +static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC) /* {{{ */ { zend_startup_constants(TSRMLS_C); zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE); zend_init_rsrc_plist(TSRMLS_C); - EG(lambda_count)=0; + zend_init_exception_op(TSRMLS_C); + EG(lambda_count) = 0; EG(user_error_handler) = NULL; EG(user_exception_handler) = NULL; EG(in_execution) = 0; @@ -514,11 +549,12 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS EG(current_execute_data) = NULL; EG(current_module) = NULL; EG(exit_status) = 0; + EG(saved_fpu_cw) = NULL; EG(active) = 0; } +/* }}} */ - -static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC) +static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC) /* {{{ */ { zend_ini_shutdown(TSRMLS_C); if (&executor_globals->persistent_list != global_persistent_list) { @@ -529,14 +565,15 @@ static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS free(executor_globals->zend_constants); } } +/* }}} */ - -static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC) +static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC) /* {{{ */ { if (zend_copy_ini_directives(TSRMLS_C) == SUCCESS) { zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC); } } +/* }}} */ #endif #if defined(__FreeBSD__) || defined(__DragonFly__) @@ -544,25 +581,21 @@ static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC) #include #endif +static void ini_scanner_globals_ctor(zend_ini_scanner_globals *scanner_globals_p TSRMLS_DC) /* {{{ */ +{ + memset(scanner_globals_p, 0, sizeof(*scanner_globals_p)); +} +/* }}} */ -static void scanner_globals_ctor(zend_scanner_globals *scanner_globals_p TSRMLS_DC) +static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p TSRMLS_DC) /* {{{ */ { - scanner_globals_p->c_buf_p = (char *) 0; - scanner_globals_p->init = 1; - scanner_globals_p->start = 0; - scanner_globals_p->current_buffer = NULL; - scanner_globals_p->yy_in = NULL; - scanner_globals_p->yy_out = NULL; - scanner_globals_p->_yy_more_flag = 0; - scanner_globals_p->_yy_more_len = 0; - scanner_globals_p->yy_start_stack_ptr = 0; - scanner_globals_p->yy_start_stack_depth = 0; - scanner_globals_p->yy_start_stack = 0; + memset(scanner_globals_p, 0, sizeof(*scanner_globals_p)); } +/* }}} */ void zend_init_opcodes_handlers(void); -int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions) +int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC) /* {{{ */ { #ifdef ZTS zend_compiler_globals *compiler_globals; @@ -570,10 +603,9 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i extern ZEND_API ts_rsrc_id ini_scanner_globals_id; extern ZEND_API ts_rsrc_id language_scanner_globals_id; #else - extern zend_scanner_globals ini_scanner_globals; - extern zend_scanner_globals language_scanner_globals; + extern zend_ini_scanner_globals ini_scanner_globals; + extern zend_php_scanner_globals language_scanner_globals; #endif - TSRMLS_FETCH(); start_memory_manager(TSRMLS_C); @@ -602,6 +634,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i zend_on_timeout = utility_functions->on_timeout; zend_vspprintf = utility_functions->vspprintf_function; zend_getenv = utility_functions->getenv_function; + zend_resolve_path = utility_functions->resolve_path_function; zend_compile_file = compile_file; zend_compile_string = compile_string; @@ -613,36 +646,33 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i /* set up version */ zend_version_info = strdup(ZEND_CORE_VERSION_INFO); - zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1; + zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO) - 1; + + GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable)); + GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable)); + GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable)); + GLOBAL_CONSTANTS_TABLE = (HashTable *) malloc(sizeof(HashTable)); - GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable)); - GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable)); - GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable)); -#ifdef ZTS - GLOBAL_CONSTANTS_TABLE = (HashTable *) malloc(sizeof(HashTable)); -#endif zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0); + zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0); + zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0); zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0); zend_init_rsrc_list_dtors(); - /* This zval can be used to initialize allocate zval's to an uninit'ed value */ - zval_used_for_init.is_ref = 0; - zval_used_for_init.refcount = 1; - zval_used_for_init.type = IS_NULL; + Z_UNSET_ISREF(zval_used_for_init); + Z_SET_REFCOUNT(zval_used_for_init, 1); + Z_TYPE(zval_used_for_init) = IS_NULL; #ifdef ZTS - zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0); - zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0); ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor); ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor); - ts_allocate_id(&language_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL); - ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL); + ts_allocate_id(&language_scanner_globals_id, sizeof(zend_php_scanner_globals), (ts_allocate_ctor) php_scanner_globals_ctor, NULL); + ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_ini_scanner_globals), (ts_allocate_ctor) ini_scanner_globals_ctor, NULL); compiler_globals = ts_resource(compiler_globals_id); executor_globals = ts_resource(executor_globals_id); - tsrm_ls = ts_resource_ex(0, NULL); compiler_globals_dtor(compiler_globals TSRMLS_CC); compiler_globals->in_compilation = 0; @@ -656,26 +686,22 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i zend_hash_destroy(executor_globals->zend_constants); *executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE; #else - zend_hash_init_ex(CG(auto_globals), 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0); - scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC); - scanner_globals_ctor(&language_scanner_globals TSRMLS_CC); - zend_startup_constants(); + ini_scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC); + php_scanner_globals_ctor(&language_scanner_globals TSRMLS_CC); zend_set_default_compile_time_values(TSRMLS_C); EG(user_error_handler) = NULL; EG(user_exception_handler) = NULL; #endif - register_standard_class(TSRMLS_C); + + zend_startup_builtin_functions(TSRMLS_C); zend_register_standard_constants(TSRMLS_C); - zend_register_auto_global("GLOBALS", sizeof("GLOBALS")-1, NULL TSRMLS_CC); + zend_register_auto_global("GLOBALS", sizeof("GLOBALS") - 1, NULL TSRMLS_CC); #ifndef ZTS zend_init_rsrc_plist(TSRMLS_C); + zend_init_exception_op(TSRMLS_C); #endif - if (start_builtin_functions) { - zend_startup_builtin_functions(TSRMLS_C); - } - zend_ini_startup(TSRMLS_C); #ifdef ZTS @@ -684,22 +710,22 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i return SUCCESS; } +/* }}} */ - -void zend_register_standard_ini_entries(TSRMLS_D) +void zend_register_standard_ini_entries(TSRMLS_D) /* {{{ */ { int module_number = 0; REGISTER_INI_ENTRIES(); } +/* }}} */ - -#ifdef ZTS /* Unlink the global (r/o) copies of the class, function and constant tables, * and use a fresh r/w copy for the startup thread */ -void zend_post_startup(TSRMLS_D) +void zend_post_startup(TSRMLS_D) /* {{{ */ { +#ifdef ZTS zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id); zend_executor_globals *executor_globals = ts_resource(executor_globals_id); @@ -710,8 +736,8 @@ void zend_post_startup(TSRMLS_D) asp_tags_default = CG(asp_tags); short_tags_default = CG(short_tags); ct_pass_ref_default = CG(allow_call_time_pass_reference); - extended_info_default = CG(extended_info); - + compiler_options_default = CG(compiler_options); + zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); free(compiler_globals->function_table); free(compiler_globals->class_table); @@ -720,11 +746,11 @@ void zend_post_startup(TSRMLS_D) executor_globals_ctor(executor_globals, tsrm_ls); global_persistent_list = &EG(persistent_list); zend_copy_ini_directives(TSRMLS_C); -} #endif +} +/* }}} */ - -void zend_shutdown(TSRMLS_D) +void zend_shutdown(TSRMLS_D) /* {{{ */ { #ifdef ZEND_WIN32 zend_shutdown_timeout_thread(); @@ -746,8 +772,8 @@ void zend_shutdown(TSRMLS_D) zend_hash_destroy(GLOBAL_CONSTANTS_TABLE); free(GLOBAL_CONSTANTS_TABLE); - zend_shutdown_strtod(); + #ifdef ZTS GLOBAL_FUNCTION_TABLE = NULL; GLOBAL_CLASS_TABLE = NULL; @@ -756,24 +782,24 @@ void zend_shutdown(TSRMLS_D) #endif zend_destroy_rsrc_list_dtors(); } +/* }}} */ - -void zend_set_utility_values(zend_utility_values *utility_values) +void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */ { zend_uv = *utility_values; zend_uv.import_use_extension_length = strlen(zend_uv.import_use_extension); } - +/* }}} */ /* this should be compatible with the standard zenderror */ -void zenderror(char *error) +void zenderror(const char *error) /* {{{ */ { zend_error(E_PARSE, "%s", error); } - +/* }}} */ BEGIN_EXTERN_C() -ZEND_API void _zend_bailout(char *filename, uint lineno) +ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */ { TSRMLS_FETCH(); @@ -784,12 +810,12 @@ ZEND_API void _zend_bailout(char *filename, uint lineno) CG(unclean_shutdown) = 1; CG(in_compilation) = EG(in_execution) = 0; EG(current_execute_data) = NULL; - longjmp(*EG(bailout), FAILURE); + LONGJMP(*EG(bailout), FAILURE); } +/* }}} */ END_EXTERN_C() - -void zend_append_version_info(zend_extension *extension) +void zend_append_version_info(const zend_extension *extension) /* {{{ */ { char *new_info; uint new_info_length; @@ -800,37 +826,39 @@ void zend_append_version_info(zend_extension *extension) + strlen(extension->copyright) + strlen(extension->author); - new_info = (char *) malloc(new_info_length+1); + new_info = (char *) malloc(new_info_length + 1); sprintf(new_info, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author); - zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length+1); + zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length + 1); strcat(zend_version_info, new_info); zend_version_info_length += new_info_length; free(new_info); } +/* }}} */ - -ZEND_API char *get_zend_version(void) +ZEND_API char *get_zend_version(void) /* {{{ */ { return zend_version_info; } +/* }}} */ - -void zend_activate(TSRMLS_D) +void zend_activate(TSRMLS_D) /* {{{ */ { + gc_reset(TSRMLS_C); init_compiler(TSRMLS_C); init_executor(TSRMLS_C); startup_scanner(TSRMLS_C); } +/* }}} */ - -void zend_activate_modules(TSRMLS_D) +void zend_activate_modules(TSRMLS_D) /* {{{ */ { zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup TSRMLS_CC); } +/* }}} */ -void zend_deactivate_modules(TSRMLS_D) +void zend_deactivate_modules(TSRMLS_D) /* {{{ */ { EG(opline_ptr) = NULL; /* we're no longer executing anything */ @@ -838,15 +866,17 @@ void zend_deactivate_modules(TSRMLS_D) zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC); } zend_end_try(); } +/* }}} */ -void zend_call_destructors(TSRMLS_D) +void zend_call_destructors(TSRMLS_D) /* {{{ */ { zend_try { shutdown_destructors(TSRMLS_C); } zend_end_try(); } +/* }}} */ -void zend_deactivate(TSRMLS_D) +void zend_deactivate(TSRMLS_D) /* {{{ */ { /* we're no longer executing anything */ EG(opline_ptr) = NULL; @@ -865,39 +895,59 @@ void zend_deactivate(TSRMLS_D) zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC); +#ifdef ZEND_DEBUG + if (GC_G(gc_enabled) && !CG(unclean_shutdown)) { + gc_collect_cycles(TSRMLS_C); + } +#endif + +#if GC_BENCH + fprintf(stderr, "GC Statistics\n"); + fprintf(stderr, "-------------\n"); + fprintf(stderr, "Runs: %d\n", GC_G(gc_runs)); + fprintf(stderr, "Collected: %d\n", GC_G(collected)); + fprintf(stderr, "Root buffer length: %d\n", GC_G(root_buf_length)); + fprintf(stderr, "Root buffer peak: %d\n\n", GC_G(root_buf_peak)); + fprintf(stderr, " Possible Remove from Marked\n"); + fprintf(stderr, " Root Buffered buffer grey\n"); + fprintf(stderr, " -------- -------- ----------- ------\n"); + fprintf(stderr, "ZVAL %8d %8d %9d %8d\n", GC_G(zval_possible_root), GC_G(zval_buffered), GC_G(zval_remove_from_buffer), GC_G(zval_marked_grey)); + fprintf(stderr, "ZOBJ %8d %8d %9d %8d\n", GC_G(zobj_possible_root), GC_G(zobj_buffered), GC_G(zobj_remove_from_buffer), GC_G(zobj_marked_grey)); +#endif + zend_try { zend_ini_deactivate(TSRMLS_C); } zend_end_try(); } +/* }}} */ - -static int exec_done_cb(zend_module_entry *module TSRMLS_DC) +static int exec_done_cb(zend_module_entry *module TSRMLS_DC) /* {{{ */ { if (module->post_deactivate_func) { module->post_deactivate_func(); } return 0; } +/* }}} */ - -void zend_post_deactivate_modules(TSRMLS_D) +void zend_post_deactivate_modules(TSRMLS_D) /* {{{ */ { zend_hash_apply(&module_registry, (apply_func_t) exec_done_cb TSRMLS_CC); zend_hash_reverse_apply(&module_registry, (apply_func_t) module_registry_unload_temp TSRMLS_CC); } - +/* }}} */ BEGIN_EXTERN_C() -ZEND_API void zend_message_dispatcher(long message, void *data) +ZEND_API void zend_message_dispatcher(long message, void *data TSRMLS_DC) /* {{{ */ { if (zend_message_dispatcher_p) { - zend_message_dispatcher_p(message, data); + zend_message_dispatcher_p(message, data TSRMLS_CC); } } +/* }}} */ END_EXTERN_C() - -ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents) +ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents) /* {{{ */ { if (zend_get_configuration_directive_p) { return zend_get_configuration_directive_p(name, name_length, contents); @@ -905,9 +955,9 @@ ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval return FAILURE; } } +/* }}} */ - -ZEND_API void zend_error(int type, const char *format, ...) +ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ { va_list args; va_list usr_copy; @@ -934,10 +984,12 @@ ZEND_API void zend_error(int type, const char *format, ...) case E_ERROR: case E_NOTICE: case E_STRICT: + case E_DEPRECATED: case E_WARNING: case E_USER_ERROR: case E_USER_WARNING: case E_USER_NOTICE: + case E_USER_DEPRECATED: case E_RECOVERABLE_ERROR: if (zend_is_compiling(TSRMLS_C)) { error_filename = zend_get_compiled_filename(TSRMLS_C); @@ -963,7 +1015,8 @@ ZEND_API void zend_error(int type, const char *format, ...) /* if we don't have a user defined error handler */ if (!EG(user_error_handler) - || !(EG(user_error_handler_error_reporting) & type)) { + || !(EG(user_error_handler_error_reporting) & type) + || EG(error_handling) != EH_NORMAL) { zend_error_cb(type, error_filename, error_lineno, format, args); } else switch (type) { case E_ERROR: @@ -995,26 +1048,27 @@ ZEND_API void zend_error(int type, const char *format, ...) # endif #endif va_copy(usr_copy, args); - z_error_message->value.str.len = zend_vspprintf(&z_error_message->value.str.val, 0, format, usr_copy); + Z_STRLEN_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy); #ifdef va_copy va_end(usr_copy); #endif - z_error_message->type = IS_STRING; + Z_TYPE_P(z_error_message) = IS_STRING; - z_error_type->value.lval = type; - z_error_type->type = IS_LONG; + Z_LVAL_P(z_error_type) = type; + Z_TYPE_P(z_error_type) = IS_LONG; if (error_filename) { - z_error_filename->value.str.len = strlen(error_filename); - z_error_filename->value.str.val = estrndup(error_filename, z_error_filename->value.str.len); - z_error_filename->type = IS_STRING; + ZVAL_STRING(z_error_filename, error_filename, 1); } - z_error_lineno->value.lval = error_lineno; - z_error_lineno->type = IS_LONG; + Z_LVAL_P(z_error_lineno) = error_lineno; + Z_TYPE_P(z_error_lineno) = IS_LONG; - z_context->value.ht = EG(active_symbol_table); - z_context->type = IS_ARRAY; + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + Z_ARRVAL_P(z_context) = EG(active_symbol_table); + Z_TYPE_P(z_context) = IS_ARRAY; zval_copy_ctor(z_context); params = (zval ***) emalloc(sizeof(zval **)*5); @@ -1026,11 +1080,11 @@ ZEND_API void zend_error(int type, const char *format, ...) orig_user_error_handler = EG(user_error_handler); EG(user_error_handler) = NULL; - + /* User error handler may include() additinal PHP files. * If an error was generated during comilation PHP will compile - * such scripts recursivly, but some CG() variables may be - * inconsistent. */ + * such scripts recursivly, but some CG() variables may be + * inconsistent. */ in_compilation = zend_is_compiling(TSRMLS_C); if (in_compilation) { @@ -1038,7 +1092,7 @@ ZEND_API void zend_error(int type, const char *format, ...) CG(active_class_entry) = NULL; } - if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC)==SUCCESS) { + if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) { if (retval) { if (Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval) == 0) { zend_error_cb(type, error_filename, error_lineno, format, args); @@ -1056,7 +1110,7 @@ ZEND_API void zend_error(int type, const char *format, ...) if (!EG(user_error_handler)) { EG(user_error_handler) = orig_user_error_handler; - } + } else { zval_ptr_dtor(&orig_user_error_handler); } @@ -1077,12 +1131,13 @@ ZEND_API void zend_error(int type, const char *format, ...) zend_init_compiler_data_structures(TSRMLS_C); } } +/* }}} */ #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__) void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn)); #endif -ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...) +ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */ { #if ZEND_DEBUG va_list args; @@ -1106,67 +1161,56 @@ ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, .. va_end(args); #endif } +/* }}} */ - -ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...) +ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...) /* {{{ */ { va_list files; int i; zend_file_handle *file_handle; zend_op_array *orig_op_array = EG(active_op_array); zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr); - zval *local_retval=NULL; va_start(files, file_count); - for (i=0; iopened_path) { - int dummy=1; - zend_hash_add(&EG(included_files), file_handle->opened_path, strlen(file_handle->opened_path)+1, (void *)&dummy, sizeof(int), NULL); + if (file_handle->opened_path) { + int dummy = 1; + zend_hash_add(&EG(included_files), file_handle->opened_path, strlen(file_handle->opened_path) + 1, (void *)&dummy, sizeof(int), NULL); } zend_destroy_file_handle(file_handle TSRMLS_CC); if (EG(active_op_array)) { - EG(return_value_ptr_ptr) = retval ? retval : &local_retval; + EG(return_value_ptr_ptr) = retval ? retval : NULL; zend_execute(EG(active_op_array) TSRMLS_CC); + zend_exception_restore(TSRMLS_C); if (EG(exception)) { if (EG(user_exception_handler)) { zval *orig_user_exception_handler; - zval ***params, *retval2, *old_exception; - params = (zval ***)emalloc(sizeof(zval **)); + zval **params[1], *retval2, *old_exception; old_exception = EG(exception); - EG(exception) = NULL; + zend_exception_save(TSRMLS_C); params[0] = &old_exception; orig_user_exception_handler = EG(user_exception_handler); if (call_user_function_ex(CG(function_table), NULL, orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) { if (retval2 != NULL) { zval_ptr_dtor(&retval2); } - } else { - if (!EG(exception)) { - EG(exception) = old_exception; + zend_exception_restore(TSRMLS_C); + if (EG(exception)) { + zval_ptr_dtor(&EG(exception)); + EG(exception) = NULL; } - zend_exception_error(EG(exception) TSRMLS_CC); - } - efree(params); - zval_ptr_dtor(&old_exception); - if (EG(exception)) { - zval_ptr_dtor(&EG(exception)); - EG(exception) = NULL; + } else { + zend_exception_restore(TSRMLS_C); + zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); } } else { - zend_exception_error(EG(exception) TSRMLS_CC); + zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); } - if (retval == NULL && *EG(return_value_ptr_ptr) != NULL) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - local_retval = NULL; - } - } else if (!retval && *EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - local_retval = NULL; } destroy_op_array(EG(active_op_array) TSRMLS_CC); efree(EG(active_op_array)); @@ -1183,10 +1227,11 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co return SUCCESS; } +/* }}} */ #define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s" -ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC) +ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC) /* {{{ */ { char *cur_filename; int cur_lineno; @@ -1206,13 +1251,13 @@ ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC) zend_spprintf(&compiled_string_description, 0, COMPILED_STRING_DESCRIPTION_FORMAT, cur_filename, cur_lineno, name); return compiled_string_description; } +/* }}} */ - -void free_estring(char **str_p) +void free_estring(char **str_p) /* {{{ */ { efree(*str_p); } - +/* }}} */ /* * Local variables: diff --git a/Zend/zend.h b/Zend/zend.h index 45bb90cb9..b36195a6d 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -17,12 +17,12 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.h,v 1.293.2.11.2.12 2008/12/31 11:17:32 sebastian Exp $ */ +/* $Id: zend.h,v 1.293.2.11.2.9.2.33 2009/03/18 01:08:12 mattwil Exp $ */ #ifndef ZEND_H #define ZEND_H -#define ZEND_VERSION "2.2.0" +#define ZEND_VERSION "2.3.0" #define ZEND_ENGINE_2 @@ -54,7 +54,6 @@ # define ZEND_PATHS_SEPARATOR ':' #endif - #ifdef ZEND_WIN32 /* Only use this macro if you know for sure that all of the switches values are covered by its case statements */ @@ -177,25 +176,39 @@ char *alloca (); # define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first) #endif +#if ZEND_GCC_VERSION >= 3001 +# define ZEND_ATTRIBUTE_DEPRECATED __attribute__((deprecated)) +#elif defined(ZEND_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1300 +# define ZEND_ATTRIBUTE_DEPRECATED __declspec(deprecated) +#else +# define ZEND_ATTRIBUTE_DEPRECATED +#endif + +#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3400 && defined(__i386__) +# define ZEND_FASTCALL __attribute__((fastcall)) +#elif defined(_MSC_VER) && defined(_M_IX86) +# define ZEND_FASTCALL __fastcall +#else +# define ZEND_FASTCALL +#endif #if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN) -# define do_alloca(p) alloca(p) -# define free_alloca(p) # define ZEND_ALLOCA_MAX_SIZE (32 * 1024) # define ALLOCA_FLAG(name) \ zend_bool name; -# define do_alloca_with_limit_ex(size, limit, use_heap) \ - ((use_heap = ((size) > (limit))) ? emalloc(size) : alloca(size)) -# define do_alloca_with_limit(size, use_heap) \ - do_alloca_with_limit_ex(size, ZEND_ALLOCA_MAX_SIZE, use_heap) -# define free_alloca_with_limit(p, use_heap) \ - do { if (use_heap) efree(p); } while (0) +# define SET_ALLOCA_FLAG(name) \ + name = 1 +# define do_alloca_ex(size, limit, use_heap) \ + ((use_heap = (UNEXPECTED((size) > (limit)))) ? emalloc(size) : alloca(size)) +# define do_alloca(size, use_heap) \ + do_alloca_ex(size, ZEND_ALLOCA_MAX_SIZE, use_heap) +# define free_alloca(p, use_heap) \ + do { if (UNEXPECTED(use_heap)) efree(p); } while (0) #else -# define do_alloca(p) emalloc(p) -# define free_alloca(p) efree(p) # define ALLOCA_FLAG(name) -# define do_alloca_with_limit(p, use_heap) emalloc(p) -# define free_alloca_with_limit(p, use_heap) efree(p) +# define SET_ALLOCA_FLAG(name) +# define do_alloca(p, use_heap) emalloc(p) +# define free_alloca(p, use_heap) efree(p) #endif #if ZEND_DEBUG @@ -249,12 +262,23 @@ char *alloca (); #define LONG_MIN (- LONG_MAX - 1) #endif +#if SIZEOF_LONG == 4 +#define MAX_LENGTH_OF_LONG 11 +static const char long_min_digits[] = "2147483648"; +#elif SIZEOF_LONG == 8 +#define MAX_LENGTH_OF_LONG 20 +static const char long_min_digits[] = "9223372036854775808"; +#else +#error "Unknown SIZEOF_LONG" +#endif + +#define MAX_LENGTH_OF_DOUBLE 32 + #undef SUCCESS #undef FAILURE #define SUCCESS 0 #define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */ - #include "zend_hash.h" #include "zend_ts_hash.h" #include "zend_llist.h" @@ -263,10 +287,8 @@ char *alloca (); #define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, return_value_ptr, this_ptr, return_value_used TSRMLS_CC #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__) -# define ZEND_VM_ALWAYS_INLINE __attribute__ ((always_inline)) void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn)); #else -# define ZEND_VM_ALWAYS_INLINE # define zend_error_noreturn zend_error #endif @@ -303,15 +325,88 @@ typedef union _zvalue_value { zend_object_value obj; } zvalue_value; - struct _zval_struct { /* Variable information */ zvalue_value value; /* value */ - zend_uint refcount; + zend_uint refcount__gc; zend_uchar type; /* active type */ - zend_uchar is_ref; + zend_uchar is_ref__gc; }; +#define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz)) +#define Z_SET_REFCOUNT_PP(ppz, rc) Z_SET_REFCOUNT_P(*(ppz), rc) +#define Z_ADDREF_PP(ppz) Z_ADDREF_P(*(ppz)) +#define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz)) +#define Z_ISREF_PP(ppz) Z_ISREF_P(*(ppz)) +#define Z_SET_ISREF_PP(ppz) Z_SET_ISREF_P(*(ppz)) +#define Z_UNSET_ISREF_PP(ppz) Z_UNSET_ISREF_P(*(ppz)) +#define Z_SET_ISREF_TO_PP(ppz, isref) Z_SET_ISREF_TO_P(*(ppz), isref) + +#define Z_REFCOUNT_P(pz) zval_refcount_p(pz) +#define Z_SET_REFCOUNT_P(pz, rc) zval_set_refcount_p(pz, rc) +#define Z_ADDREF_P(pz) zval_addref_p(pz) +#define Z_DELREF_P(pz) zval_delref_p(pz) +#define Z_ISREF_P(pz) zval_isref_p(pz) +#define Z_SET_ISREF_P(pz) zval_set_isref_p(pz) +#define Z_UNSET_ISREF_P(pz) zval_unset_isref_p(pz) +#define Z_SET_ISREF_TO_P(pz, isref) zval_set_isref_to_p(pz, isref) + +#define Z_REFCOUNT(z) Z_REFCOUNT_P(&(z)) +#define Z_SET_REFCOUNT(z, rc) Z_SET_REFCOUNT_P(&(z), rc) +#define Z_ADDREF(z) Z_ADDREF_P(&(z)) +#define Z_DELREF(z) Z_DELREF_P(&(z)) +#define Z_ISREF(z) Z_ISREF_P(&(z)) +#define Z_SET_ISREF(z) Z_SET_ISREF_P(&(z)) +#define Z_UNSET_ISREF(z) Z_UNSET_ISREF_P(&(z)) +#define Z_SET_ISREF_TO(z, isref) Z_SET_ISREF_TO_P(&(z), isref) + +#if defined(__GNUC__) +#define zend_always_inline inline __attribute__((always_inline)) +#elif defined(_MSC_VER) +#define zend_always_inline __forceinline +#else +#define zend_always_inline inline +#endif + +#if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) +# define EXPECTED(condition) __builtin_expect(condition, 1) +# define UNEXPECTED(condition) __builtin_expect(condition, 0) +#else +# define EXPECTED(condition) (condition) +# define UNEXPECTED(condition) (condition) +#endif + +static zend_always_inline zend_uint zval_refcount_p(zval* pz) { + return pz->refcount__gc; +} + +static zend_always_inline zend_uint zval_set_refcount_p(zval* pz, zend_uint rc) { + return pz->refcount__gc = rc; +} + +static zend_always_inline zend_uint zval_addref_p(zval* pz) { + return ++pz->refcount__gc; +} + +static zend_always_inline zend_uint zval_delref_p(zval* pz) { + return --pz->refcount__gc; +} + +static zend_always_inline zend_bool zval_isref_p(zval* pz) { + return pz->is_ref__gc; +} + +static zend_always_inline zend_bool zval_set_isref_p(zval* pz) { + return pz->is_ref__gc = 1; +} + +static zend_always_inline zend_bool zval_unset_isref_p(zval* pz) { + return pz->is_ref__gc = 0; +} + +static zend_always_inline zend_bool zval_set_isref_to_p(zval* pz, zend_bool isref) { + return pz->is_ref__gc = isref; +} /* excpt.h on Digital Unix 4.0 defines function_table */ #undef function_table @@ -342,7 +437,7 @@ struct _zend_class_entry { HashTable default_static_members; HashTable *static_members; HashTable constants_table; - struct _zend_function_entry *builtin_functions; + const struct _zend_function_entry *builtin_functions; union _zend_function *constructor; union _zend_function *destructor; @@ -352,6 +447,7 @@ struct _zend_class_entry { union _zend_function *__unset; union _zend_function *__isset; union _zend_function *__call; + union _zend_function *__callstatic; union _zend_function *__tostring; union _zend_function *serialize_func; union _zend_function *unserialize_func; @@ -362,6 +458,7 @@ struct _zend_class_entry { zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC); zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */ + union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, int method_len TSRMLS_DC); /* serializer callbacks */ int (*serialize)(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); @@ -384,29 +481,27 @@ typedef struct _zend_utility_functions { void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0); int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); int (*write_function)(const char *str, uint str_length); - FILE *(*fopen_function)(const char *filename, char **opened_path); - void (*message_handler)(long message, void *data); + FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC); + void (*message_handler)(long message, void *data TSRMLS_DC); void (*block_interruptions)(void); void (*unblock_interruptions)(void); - int (*get_configuration_directive)(char *name, uint name_length, zval *contents); + int (*get_configuration_directive)(const char *name, uint name_length, zval *contents); void (*ticks_function)(int ticks); void (*on_timeout)(int seconds TSRMLS_DC); int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap); char *(*getenv_function)(char *name, size_t name_len TSRMLS_DC); + char *(*resolve_path_function)(const char *filename, int filename_len TSRMLS_DC); } zend_utility_functions; - typedef struct _zend_utility_values { char *import_use_extension; uint import_use_extension_length; zend_bool html_errors; } zend_utility_values; - typedef int (*zend_write_func_t)(const char *str, uint str_length); - #undef MIN #undef MAX #define MAX(a, b) (((a)>(b))?(a):(b)) @@ -418,8 +513,6 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length); #define ZEND_TRUTH(x) ((x) ? 1 : 0) #define ZEND_LOG_XOR(a, b) (ZEND_TRUTH(a) ^ ZEND_TRUTH(b)) - - /* data types */ /* All data types <= IS_BOOL have their constructor/destructors skipped */ #define IS_NULL 0 @@ -434,22 +527,21 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length); #define IS_CONSTANT_ARRAY 9 /* Ugly hack to support constants as static array indices */ -#define IS_CONSTANT_INDEX 0x80 - +#define IS_CONSTANT_TYPE_MASK 0x0f +#define IS_CONSTANT_UNQUALIFIED 0x10 +#define IS_CONSTANT_INDEX 0x80 +#define IS_LEXICAL_VAR 0x20 +#define IS_LEXICAL_REF 0x40 /* overloaded elements data types */ -#define OE_IS_ARRAY (1<<0) +#define OE_IS_ARRAY (1<<0) #define OE_IS_OBJECT (1<<1) #define OE_IS_METHOD (1<<2) -int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions); +int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC); void zend_shutdown(TSRMLS_D); void zend_register_standard_ini_entries(TSRMLS_D); - -#ifdef ZTS void zend_post_startup(TSRMLS_D); -#endif - void zend_set_utility_values(zend_utility_values *utility_values); BEGIN_EXTERN_C() @@ -458,13 +550,23 @@ END_EXTERN_C() #define zend_bailout() _zend_bailout(__FILE__, __LINE__) +#ifdef HAVE_SIGSETJMP +# define SETJMP(a) sigsetjmp(a, 0) +# define LONGJMP(a,b) siglongjmp(a, b) +# define JMP_BUF sigjmp_buf +#else +# define SETJMP(a) setjmp(a) +# define LONGJMP(a,b) longjmp(a, b) +# define JMP_BUF jmp_buf +#endif + #define zend_try \ { \ - jmp_buf *__orig_bailout = EG(bailout); \ - jmp_buf __bailout; \ + JMP_BUF *__orig_bailout = EG(bailout); \ + JMP_BUF __bailout; \ \ EG(bailout) = &__bailout; \ - if (setjmp(__bailout)==0) { + if (SETJMP(__bailout)==0) { #define zend_catch \ } else { \ EG(bailout) = __orig_bailout; @@ -472,7 +574,7 @@ END_EXTERN_C() } \ EG(bailout) = __orig_bailout; \ } -#define zend_first_try EG(bailout)=NULL; zend_try +#define zend_first_try EG(bailout)=NULL; zend_try BEGIN_EXTERN_C() ZEND_API char *get_zend_version(void); @@ -482,7 +584,7 @@ ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int in ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC); ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC); ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC); -ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); +ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); END_EXTERN_C() void zend_activate(TSRMLS_D); @@ -519,11 +621,10 @@ END_EXTERN_C() #define ZEND_PUTS_EX(str) write_func((str), strlen((str))) #define ZEND_PUTC(c) zend_write(&(c), 1), (c) - BEGIN_EXTERN_C() extern ZEND_API int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); extern ZEND_API zend_write_func_t zend_write; -extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path); +extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC); extern ZEND_API void (*zend_block_interruptions)(void); extern ZEND_API void (*zend_unblock_interruptions)(void); extern ZEND_API void (*zend_ticks_function)(int ticks); @@ -532,11 +633,11 @@ extern void (*zend_on_timeout)(int seconds TSRMLS_DC); extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap); extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC); - +extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); -void zenderror(char *error); +void zenderror(const char *error); /* The following #define is used for code duality in PHP for Engine 1 & 2 */ #define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def @@ -548,17 +649,15 @@ END_EXTERN_C() #define ZEND_UV(name) (zend_uv.name) - #define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); } #define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); } BEGIN_EXTERN_C() -ZEND_API void zend_message_dispatcher(long message, void *data); +ZEND_API void zend_message_dispatcher(long message, void *data TSRMLS_DC); -ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents); +ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents); END_EXTERN_C() - /* Messages for applications of Zend */ #define ZMSG_FAILED_INCLUDE_FOPEN 1L #define ZMSG_FAILED_REQUIRE_FOPEN 2L @@ -568,14 +667,9 @@ END_EXTERN_C() #define ZMSG_LOG_SCRIPT_NAME 6L #define ZMSG_MEMORY_LEAKS_GRAND_TOTAL 7L - -#define ZVAL_ADDREF(pz) (++(pz)->refcount) -#define ZVAL_DELREF(pz) (--(pz)->refcount) -#define ZVAL_REFCOUNT(pz) ((pz)->refcount) - #define INIT_PZVAL(z) \ - (z)->refcount = 1; \ - (z)->is_ref = 0; + (z)->refcount__gc = 1; \ + (z)->is_ref__gc = 0; #define INIT_ZVAL(z) z = zval_used_for_init; @@ -587,19 +681,19 @@ END_EXTERN_C() ALLOC_ZVAL(zv); \ INIT_PZVAL(zv); -#define PZVAL_IS_REF(z) ((z)->is_ref) +#define PZVAL_IS_REF(z) Z_ISREF_P(z) #define SEPARATE_ZVAL(ppzv) \ { \ zval *orig_ptr = *(ppzv); \ \ - if (orig_ptr->refcount>1) { \ - orig_ptr->refcount--; \ + if (Z_REFCOUNT_P(orig_ptr) > 1) { \ + Z_DELREF_P(orig_ptr); \ ALLOC_ZVAL(*(ppzv)); \ **(ppzv) = *orig_ptr; \ zval_copy_ctor(*(ppzv)); \ - (*(ppzv))->refcount=1; \ - (*(ppzv))->is_ref = 0; \ + Z_SET_REFCOUNT_PP(ppzv, 1); \ + Z_UNSET_ISREF_PP((ppzv)); \ } \ } @@ -611,14 +705,14 @@ END_EXTERN_C() #define SEPARATE_ZVAL_TO_MAKE_IS_REF(ppzv) \ if (!PZVAL_IS_REF(*ppzv)) { \ SEPARATE_ZVAL(ppzv); \ - (*(ppzv))->is_ref = 1; \ + Z_SET_ISREF_PP((ppzv)); \ } #define COPY_PZVAL_TO_ZVAL(zv, pzv) \ (zv) = *(pzv); \ - if ((pzv)->refcount>1) { \ + if (Z_REFCOUNT_P(pzv)>1) { \ zval_copy_ctor(&(zv)); \ - (pzv)->refcount--; \ + Z_DELREF_P((pzv)); \ } else { \ FREE_ZVAL(pzv); \ } \ @@ -628,15 +722,15 @@ END_EXTERN_C() int is_ref, refcount; \ \ SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \ - is_ref = (*ppzv_dest)->is_ref; \ - refcount = (*ppzv_dest)->refcount; \ + is_ref = Z_ISREF_PP(ppzv_dest); \ + refcount = Z_REFCOUNT_PP(ppzv_dest); \ zval_dtor(*ppzv_dest); \ **ppzv_dest = *pzv_src; \ if (copy) { \ zval_copy_ctor(*ppzv_dest); \ } \ - (*ppzv_dest)->is_ref = is_ref; \ - (*ppzv_dest)->refcount = refcount; \ + Z_SET_ISREF_TO_PP(ppzv_dest, is_ref); \ + Z_SET_REFCOUNT_PP(ppzv_dest, refcount); \ } #define SEPARATE_ARG_IF_REF(varptr) \ @@ -644,25 +738,41 @@ END_EXTERN_C() zval *original_var = varptr; \ ALLOC_ZVAL(varptr); \ varptr->value = original_var->value; \ - varptr->type = original_var->type; \ - varptr->is_ref = 0; \ - varptr->refcount = 1; \ + Z_TYPE_P(varptr) = Z_TYPE_P(original_var); \ + Z_UNSET_ISREF_P(varptr); \ + Z_SET_REFCOUNT_P(varptr, 1); \ zval_copy_ctor(varptr); \ } else { \ - varptr->refcount++; \ + Z_ADDREF_P(varptr); \ } #define READY_TO_DESTROY(zv) \ - ((zv)->refcount == 1 && \ + (Z_REFCOUNT_P(zv) == 1 && \ (Z_TYPE_P(zv) != IS_OBJECT || \ zend_objects_store_get_refcount(zv TSRMLS_CC) == 1)) - #define ZEND_MAX_RESERVED_RESOURCES 4 +#include "zend_gc.h" #include "zend_operators.h" #include "zend_variables.h" +typedef enum { + EH_NORMAL = 0, + EH_SUPPRESS, + EH_THROW +} zend_error_handling_t; + +typedef struct { + zend_error_handling_t handling; + zend_class_entry *exception; + zval *user_handler; +} zend_error_handling; + +ZEND_API void zend_save_error_handling(zend_error_handling *current TSRMLS_DC); +ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling, zend_class_entry *exception_class, zend_error_handling *current TSRMLS_DC); +ZEND_API void zend_restore_error_handling(zend_error_handling *saved TSRMLS_DC); + #endif /* ZEND_H */ /* diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 49568a295..3890769d4 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -18,13 +18,15 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.296.2.27.2.41 2009/01/08 21:39:06 andrei Exp $ */ +/* $Id: zend_API.c,v 1.296.2.27.2.34.2.60 2009/01/14 11:56:08 dmitry Exp $ */ #include "zend.h" #include "zend_execute.h" #include "zend_API.h" #include "zend_modules.h" #include "zend_constants.h" +#include "zend_exceptions.h" +#include "zend_closures.h" #ifdef HAVE_STDARG_H #include @@ -35,7 +37,7 @@ static int module_count=0; ZEND_API HashTable module_registry; /* this function doesn't check for too many parameters */ -ZEND_API int zend_get_parameters(int ht, int param_count, ...) +ZEND_API int zend_get_parameters(int ht, int param_count, ...) /* {{{ */ { void **p; int arg_count; @@ -43,7 +45,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) zval **param, *param_ptr; TSRMLS_FETCH(); - p = EG(argument_stack).top_element-2; + p = zend_vm_stack_top(TSRMLS_C) - 1; arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { @@ -55,7 +57,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) while (param_count-->0) { param = va_arg(ptr, zval **); param_ptr = *(p-arg_count); - if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { + if (!PZVAL_IS_REF(param_ptr) && Z_REFCOUNT_P(param_ptr) > 1) { zval *new_tmp; ALLOC_ZVAL(new_tmp); @@ -63,7 +65,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) zval_copy_ctor(new_tmp); INIT_PZVAL(new_tmp); param_ptr = new_tmp; - ((zval *) *(p-arg_count))->refcount--; + Z_DELREF_P((zval *) *(p-arg_count)); *(p-arg_count) = param_ptr; } *param = param_ptr; @@ -73,15 +75,15 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) return SUCCESS; } +/* }}} */ - -ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC) +ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC) /* {{{ */ { void **p; int arg_count; zval *param_ptr; - p = EG(argument_stack).top_element-2; + p = zend_vm_stack_top(TSRMLS_C) - 1; arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { @@ -90,7 +92,7 @@ ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument while (param_count-->0) { param_ptr = *(p-arg_count); - if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { + if (!PZVAL_IS_REF(param_ptr) && Z_REFCOUNT_P(param_ptr) > 1) { zval *new_tmp; ALLOC_ZVAL(new_tmp); @@ -98,7 +100,7 @@ ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument zval_copy_ctor(new_tmp); INIT_PZVAL(new_tmp); param_ptr = new_tmp; - ((zval *) *(p-arg_count))->refcount--; + Z_DELREF_P((zval *) *(p-arg_count)); *(p-arg_count) = param_ptr; } *(argument_array++) = param_ptr; @@ -107,13 +109,11 @@ ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument return SUCCESS; } - - - +/* }}} */ /* Zend-optimized Extended functions */ /* this function doesn't check for too many parameters */ -ZEND_API int zend_get_parameters_ex(int param_count, ...) +ZEND_API int zend_get_parameters_ex(int param_count, ...) /* {{{ */ { void **p; int arg_count; @@ -121,7 +121,7 @@ ZEND_API int zend_get_parameters_ex(int param_count, ...) zval ***param; TSRMLS_FETCH(); - p = EG(argument_stack).top_element-2; + p = zend_vm_stack_top(TSRMLS_C) - 1; arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { @@ -137,14 +137,14 @@ ZEND_API int zend_get_parameters_ex(int param_count, ...) return SUCCESS; } +/* }}} */ - -ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC) +ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC) /* {{{ */ { void **p; int arg_count; - p = EG(argument_stack).top_element-2; + p = zend_vm_stack_top(TSRMLS_C) - 1; arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { @@ -154,47 +154,20 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr while (param_count-->0) { zval **value = (zval**)(p-arg_count); - if (EG(ze1_compatibility_mode) && - Z_TYPE_PP(value) == IS_OBJECT && - !(*value)->is_ref) { - zval *value_ptr; - char *class_name; - zend_uint class_name_len; - int dup; - - dup = zend_get_object_classname(*value, &class_name, &class_name_len TSRMLS_CC); - - ALLOC_ZVAL(value_ptr); - *value_ptr = **value; - INIT_PZVAL(value_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - - if (Z_OBJ_HANDLER_PP(value, clone_obj) == NULL) { - zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", class_name); - } - - if(!dup) { - efree(class_name); - } - - value_ptr->value.obj = Z_OBJ_HANDLER_PP(value, clone_obj)(*value TSRMLS_CC); - zval_ptr_dtor(value); - *value = value_ptr; - } *(argument_array++) = value; arg_count--; } return SUCCESS; } +/* }}} */ - -ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TSRMLS_DC) +ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TSRMLS_DC) /* {{{ */ { void **p; int arg_count; - p = EG(argument_stack).top_element-2; + p = zend_vm_stack_top(TSRMLS_C) - 1; arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { @@ -209,20 +182,19 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TS return SUCCESS; } +/* }}} */ - -ZEND_API void zend_wrong_param_count(TSRMLS_D) +ZEND_API void zend_wrong_param_count(TSRMLS_D) /* {{{ */ { char *space; char *class_name = get_active_class_name(&space TSRMLS_CC); - + zend_error(E_WARNING, "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name(TSRMLS_C)); } - +/* }}} */ /* Argument parsing API -- andrei */ - -ZEND_API char *zend_get_type_by_const(int type) +ZEND_API char *zend_get_type_by_const(int type) /* {{{ */ { switch(type) { case IS_BOOL: @@ -245,13 +217,15 @@ ZEND_API char *zend_get_type_by_const(int type) return "unknown"; } } +/* }}} */ -ZEND_API char *zend_zval_type_name(zval *arg) +ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */ { return zend_get_type_by_const(Z_TYPE_P(arg)); } +/* }}} */ -ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC) +ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC) /* {{{ */ { if (Z_OBJ_HT_P(zobject)->get_class_entry) { return Z_OBJ_HT_P(zobject)->get_class_entry(zobject TSRMLS_CC); @@ -260,9 +234,10 @@ ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC) return NULL; } } +/* }}} */ /* returns 1 if you need to copy result, 0 if it's already a copy */ -ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC) +ZEND_API int zend_get_object_classname(const zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC) /* {{{ */ { if (Z_OBJ_HT_P(object)->get_class_name == NULL || Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) { @@ -274,8 +249,9 @@ ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uin } return 0; } +/* }}} */ -static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TSRMLS_DC) +static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TSRMLS_DC) /* {{{ */ { if (Z_OBJ_HANDLER_PP(arg, cast_object)) { SEPARATE_ZVAL_IF_NOT_REF(arg); @@ -297,7 +273,7 @@ static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TS if (!Z_OBJ_HANDLER_PP(arg, cast_object) && Z_OBJ_HANDLER_PP(arg, get)) { int use_copy; zval *z = Z_OBJ_HANDLER_PP(arg, get)(*arg TSRMLS_CC); - z->refcount++; + Z_ADDREF_P(z); if(Z_TYPE_P(z) != IS_OBJECT) { zval_dtor(*arg); Z_TYPE_P(*arg) = IS_NULL; @@ -313,18 +289,24 @@ static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TS } return FAILURE; } +/* }}} */ -static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **spec TSRMLS_DC) +static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */ { char *spec_walk = *spec; char c = *spec_walk++; int return_null = 0; - while (*spec_walk == '/' || *spec_walk == '!') { + /* scan through modifiers */ + while (1) { if (*spec_walk == '/') { SEPARATE_ZVAL_IF_NOT_REF(arg); - } else if (*spec_walk == '!' && Z_TYPE_PP(arg) == IS_NULL) { - return_null = 1; + } else if (*spec_walk == '!') { + if (Z_TYPE_PP(arg) == IS_NULL) { + return_null = 1; + } + } else { + break; } spec_walk++; } @@ -458,44 +440,49 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp case 'r': { zval **p = va_arg(*va, zval **); - if (Z_TYPE_PP(arg) != IS_RESOURCE) { - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { - *p = NULL; - } else { - return "resource"; - } - } else { + if (return_null) { + *p = NULL; + break; + } + if (Z_TYPE_PP(arg) == IS_RESOURCE) { *p = *arg; + } else { + return "resource"; } } break; - + case 'A': case 'a': { zval **p = va_arg(*va, zval **); - if (Z_TYPE_PP(arg) != IS_ARRAY) { - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { - *p = NULL; - } else { - return "array"; - } - } else { + if (return_null) { + *p = NULL; + break; + } + if (Z_TYPE_PP(arg) == IS_ARRAY || (c == 'A' && Z_TYPE_PP(arg) == IS_OBJECT)) { *p = *arg; + } else { + return "array"; } } break; - + case 'H': case 'h': { HashTable **p = va_arg(*va, HashTable **); - if (Z_TYPE_PP(arg) != IS_ARRAY) { - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { - *p = NULL; - } else { + if (return_null) { + *p = NULL; + break; + } + if (Z_TYPE_PP(arg) == IS_ARRAY) { + *p = Z_ARRVAL_PP(arg); + } else if(c == 'H' && Z_TYPE_PP(arg) == IS_OBJECT) { + *p = HASH_OF(*arg); + if(*p == NULL) { return "array"; } } else { - *p = Z_ARRVAL_PP(arg); + return "array"; } } break; @@ -503,14 +490,14 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp case 'o': { zval **p = va_arg(*va, zval **); - if (Z_TYPE_PP(arg) != IS_OBJECT) { - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { - *p = NULL; - } else { - return "object"; - } - } else { + if (return_null) { + *p = NULL; + break; + } + if (Z_TYPE_PP(arg) == IS_OBJECT) { *p = *arg; + } else { + return "object"; } } break; @@ -520,13 +507,15 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp zval **p = va_arg(*va, zval **); zend_class_entry *ce = va_arg(*va, zend_class_entry *); + if (return_null) { + *p = NULL; + break; + } if (Z_TYPE_PP(arg) == IS_OBJECT && (!ce || instanceof_function(Z_OBJCE_PP(arg), ce TSRMLS_CC))) { *p = *arg; } else { - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { - *p = NULL; - } else if (ce) { + if (ce) { return ce->name; } else { return "object"; @@ -540,7 +529,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp zend_class_entry **lookup, **pce = va_arg(*va, zend_class_entry **); zend_class_entry *ce_base = *pce; - if (return_null && Z_TYPE_PP(arg) == IS_NULL) { + if (return_null) { *pce = NULL; break; } @@ -551,22 +540,16 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp *pce = *lookup; } if (ce_base) { - if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC)) && !return_null) { - char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); - zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given", - class_name, space, get_active_function_name(TSRMLS_C), - arg_num, ce_base->name, Z_STRVAL_PP(arg)); + if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC))) { + zend_spprintf(error, 0, "to be a class name derived from %s, '%s' given", + ce_base->name, Z_STRVAL_PP(arg)); *pce = NULL; return ""; } } if (!*pce) { - char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); - zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a valid class name, '%s' given", - class_name, space, get_active_function_name(TSRMLS_C), - arg_num, Z_STRVAL_PP(arg)); + zend_spprintf(error, 0, "to be a valid class name, '%s' given", + Z_STRVAL_PP(arg)); return ""; } break; @@ -576,40 +559,59 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp case 'f': { - zend_fcall_info *fci = va_arg(*va, zend_fcall_info *); + zend_fcall_info *fci = va_arg(*va, zend_fcall_info *); zend_fcall_info_cache *fcc = va_arg(*va, zend_fcall_info_cache *); + char *is_callable_error = NULL; - if (zend_fcall_info_init(*arg, fci, fcc TSRMLS_CC) == SUCCESS) { - break; - } else if (return_null) { + if (return_null) { fci->size = 0; fcc->initialized = 0; break; + } + + if (zend_fcall_info_init(*arg, 0, fci, fcc, NULL, &is_callable_error TSRMLS_CC) == SUCCESS) { + if (is_callable_error) { + *severity = E_STRICT; + zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); + efree(is_callable_error); + *spec = spec_walk; + return ""; + } + break; } else { - return "function"; + if (is_callable_error) { + *severity = E_WARNING; + zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); + efree(is_callable_error); + return ""; + } else { + return "valid callback"; + } } } case 'z': { zval **p = va_arg(*va, zval **); - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { + if (return_null) { *p = NULL; } else { *p = *arg; } } break; + case 'Z': { zval ***p = va_arg(*va, zval ***); - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { + if (return_null) { *p = NULL; } else { *p = arg; } } break; + default: return "unknown"; } @@ -618,37 +620,51 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp return NULL; } +/* }}} */ -static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int quiet TSRMLS_DC) +static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int quiet TSRMLS_DC) /* {{{ */ { - char *expected_type = NULL; + char *expected_type = NULL, *error = NULL; + int severity = E_WARNING; - expected_type = zend_parse_arg_impl(arg_num, arg, va, spec TSRMLS_CC); + expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity TSRMLS_CC); if (expected_type) { - if (!quiet && *expected_type) { + if (!quiet && (*expected_type || error)) { char *space; char *class_name = get_active_class_name(&space TSRMLS_CC); - zend_error(E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given", - class_name, space, get_active_function_name(TSRMLS_C), arg_num, expected_type, - zend_zval_type_name(*arg)); + if (error) { + zend_error(severity, "%s%s%s() expects parameter %d %s", + class_name, space, get_active_function_name(TSRMLS_C), arg_num, error); + efree(error); + } else { + zend_error(severity, "%s%s%s() expects parameter %d to be %s, %s given", + class_name, space, get_active_function_name(TSRMLS_C), arg_num, expected_type, + zend_zval_type_name(*arg)); + } + } + if (severity != E_STRICT) { + return FAILURE; } - return FAILURE; } return SUCCESS; } +/* }}} */ -static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int flags TSRMLS_DC) +static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int flags TSRMLS_DC) /* {{{ */ { char *spec_walk; int c, i; int min_num_args = -1; int max_num_args = 0; + int post_varargs = 0; zval **arg; - void **p; int arg_count; int quiet = flags & ZEND_PARSE_PARAMS_QUIET; + zend_bool have_varargs = 0; + zval ****varargs = NULL; + int *n_varargs = NULL; for (spec_walk = type_spec; *spec_walk; spec_walk++) { c = *spec_walk; @@ -659,7 +675,8 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl case 'o': case 'O': case 'z': case 'Z': case 'C': case 'h': - case 'f': + case 'f': case 'A': + case 'H': max_num_args++; break; @@ -672,11 +689,33 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl /* Pass */ break; + case '*': + case '+': + if (have_varargs) { + if (!quiet) { + zend_function *active_function = EG(current_execute_data)->function_state.function; + char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; + zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted", + class_name, + class_name[0] ? "::" : "", + get_active_function_name(TSRMLS_C)); + } + return FAILURE; + } + have_varargs = 1; + /* we expect at least one parameter in varargs */ + if (c == '+') { + max_num_args++; + } + /* mark the beginning of varargs */ + post_varargs = max_num_args; + break; + default: if (!quiet) { - zend_function *active_function = EG(function_state_ptr)->function; + zend_function *active_function = EG(current_execute_data)->function_state.function; char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; - zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters", + zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters", class_name, class_name[0] ? "::" : "", get_active_function_name(TSRMLS_C)); @@ -689,9 +728,15 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl min_num_args = max_num_args; } - if (num_args < min_num_args || num_args > max_num_args) { + if (have_varargs) { + /* calculate how many required args are at the end of the specifier list */ + post_varargs = max_num_args - post_varargs; + max_num_args = -1; + } + + if (num_args < min_num_args || (num_args > max_num_args && max_num_args > 0)) { if (!quiet) { - zend_function *active_function = EG(function_state_ptr)->function; + zend_function *active_function = EG(current_execute_data)->function_state.function; char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given", class_name, @@ -705,8 +750,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl return FAILURE; } - p = EG(argument_stack).top_element-2; - arg_count = (int)(zend_uintptr_t) *p; + arg_count = (int)(zend_uintptr_t) *(zend_vm_stack_top(TSRMLS_C) - 1); if (num_args > arg_count) { zend_error(E_WARNING, "%s(): could not obtain parameters for parsing", @@ -716,11 +760,48 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl i = 0; while (num_args-- > 0) { - arg = (zval **) p - (arg_count-i); if (*type_spec == '|') { type_spec++; } + + if (*type_spec == '*' || *type_spec == '+') { + int num_varargs = num_args + 1 - post_varargs; + + /* eat up the passed in storage even if it won't be filled in with varargs */ + varargs = va_arg(*va, zval ****); + n_varargs = va_arg(*va, int *); + type_spec++; + + if (num_varargs > 0) { + int iv = 0; + zval **p = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count - i)); + + *n_varargs = num_varargs; + + /* allocate space for array and store args */ + *varargs = safe_emalloc(num_varargs, sizeof(zval **), 0); + while (num_varargs-- > 0) { + (*varargs)[iv++] = p++; + } + + /* adjust how many args we have left and restart loop */ + num_args = num_args + 1 - iv; + i += iv; + continue; + } else { + *varargs = NULL; + *n_varargs = 0; + } + } + + arg = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count-i)); + if (zend_parse_arg(i+1, arg, va, &type_spec, quiet TSRMLS_CC) == FAILURE) { + /* clean up varargs array if it was used */ + if (varargs && *varargs) { + efree(*varargs); + *varargs = NULL; + } return FAILURE; } i++; @@ -728,32 +809,52 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl return SUCCESS; } +/* }}} */ -ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...) +#define RETURN_IF_ZERO_ARGS(num_args, type_spec, quiet) { \ + int __num_args = (num_args); \ + \ + if (0 == (type_spec)[0] && 0 != __num_args && !(quiet)) { \ + char *__space; \ + char * __class_name = get_active_class_name(&__space TSRMLS_CC); \ + zend_error(E_WARNING, "%s%s%s() expects exactly 0 parameters, %d given", \ + __class_name, __space, \ + get_active_function_name(TSRMLS_C), __num_args); \ + return FAILURE; \ + }\ +} + +ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...) /* {{{ */ { va_list va; int retval; + RETURN_IF_ZERO_ARGS(num_args, type_spec, flags & ZEND_PARSE_PARAMS_QUIET); + va_start(va, type_spec); retval = zend_parse_va_args(num_args, type_spec, &va, flags TSRMLS_CC); va_end(va); return retval; } +/* }}} */ -ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...) +ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...) /* {{{ */ { va_list va; int retval; + RETURN_IF_ZERO_ARGS(num_args, type_spec, 0); + va_start(va, type_spec); retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC); va_end(va); return retval; } +/* }}} */ -ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...) +ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...) /* {{{ */ { va_list va; int retval; @@ -762,16 +863,21 @@ ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr zend_class_entry *ce; if (!this_ptr) { + RETURN_IF_ZERO_ARGS(num_args, p, 0); + va_start(va, type_spec); retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC); va_end(va); } else { p++; + RETURN_IF_ZERO_ARGS(num_args, p, 0); + va_start(va, type_spec); object = va_arg(va, zval **); ce = va_arg(va, zend_class_entry *); *object = this_ptr; + if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) { zend_error(E_CORE_ERROR, "%s::%s() must be derived from %s::%s", ce->name, get_active_function_name(TSRMLS_C), Z_OBJCE_P(this_ptr)->name, get_active_function_name(TSRMLS_C)); @@ -782,9 +888,9 @@ ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr } return retval; } +/* }}} */ - -ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...) +ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...) /* {{{ */ { va_list va; int retval; @@ -794,16 +900,21 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, int quiet = flags & ZEND_PARSE_PARAMS_QUIET; if (!this_ptr) { + RETURN_IF_ZERO_ARGS(num_args, p, quiet); + va_start(va, type_spec); retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC); va_end(va); } else { p++; + RETURN_IF_ZERO_ARGS(num_args-1, p, quiet); + va_start(va, type_spec); object = va_arg(va, zval **); ce = va_arg(va, zend_class_entry *); *object = this_ptr; + if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) { if (!quiet) { zend_error(E_CORE_ERROR, "%s::%s() must be derived from %s::%s", @@ -817,29 +928,26 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, } return retval; } - +/* }}} */ /* Argument parsing API -- andrei */ - - -ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC) +ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC) /* {{{ */ { - ALLOC_HASHTABLE_REL(arg->value.ht); + ALLOC_HASHTABLE_REL(Z_ARRVAL_P(arg)); - _zend_hash_init(arg->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC); - arg->type = IS_ARRAY; + _zend_hash_init(Z_ARRVAL_P(arg), size, NULL, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC); + Z_TYPE_P(arg) = IS_ARRAY; return SUCCESS; } +/* }}} */ - -static int zend_merge_property(zval **value, int num_args, va_list args, zend_hash_key *hash_key) +static int zend_merge_property(zval **value TSRMLS_DC, int num_args, va_list args, const zend_hash_key *hash_key) /* {{{ */ { /* which name should a numeric property have ? */ if (hash_key->nKeyLength) { zval *obj = va_arg(args, zval *); zend_object_handlers *obj_ht = va_arg(args, zend_object_handlers *); zval *member; - TSRMLS_FETCH(); MAKE_STD_ZVAL(member); ZVAL_STRINGL(member, hash_key->arKey, hash_key->nKeyLength-1, 1); @@ -848,17 +956,17 @@ static int zend_merge_property(zval **value, int num_args, va_list args, zend_ha } return ZEND_HASH_APPLY_KEEP; } - +/* }}} */ /* This function should be called after the constructor has been called * because it may call __set from the uninitialized object otherwise. */ -ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC) +ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC) /* {{{ */ { zend_object_handlers *obj_ht = Z_OBJ_HT_P(obj); zend_class_entry *old_scope = EG(scope); EG(scope) = Z_OBJCE_P(obj); - zend_hash_apply_with_arguments(properties, (apply_func_args_t)zend_merge_property, 2, obj, obj_ht); + zend_hash_apply_with_arguments(properties TSRMLS_CC, (apply_func_args_t)zend_merge_property, 2, obj, obj_ht); EG(scope) = old_scope; if (destroy_ht) { @@ -866,9 +974,9 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro FREE_HASHTABLE(properties); } } +/* }}} */ - -ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC) +ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { if (!class_type->constants_updated || !CE_STATIC_MEMBERS(class_type)) { zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry); @@ -900,13 +1008,14 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC zval **q; zend_hash_get_current_key_ex(&class_type->default_static_members, &str_index, &str_length, &num_index, 0, &pos); - if ((*p)->is_ref && - class_type->parent && - zend_hash_find(&class_type->parent->default_static_members, str_index, str_length, (void**)&q) == SUCCESS && - *p == *q && - zend_hash_find(CE_STATIC_MEMBERS(class_type->parent), str_index, str_length, (void**)&q) == SUCCESS) { - (*q)->refcount++; - (*q)->is_ref = 1; + if (Z_ISREF_PP(p) && + class_type->parent && + zend_hash_find(&class_type->parent->default_static_members, str_index, str_length, (void**)&q) == SUCCESS && + *p == *q && + zend_hash_find(CE_STATIC_MEMBERS(class_type->parent), str_index, str_length, (void**)&q) == SUCCESS + ) { + Z_ADDREF_PP(q); + Z_SET_ISREF_PP(q); zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)q, sizeof(zval*), NULL); } else { zval *q; @@ -926,13 +1035,13 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC class_type->constants_updated = 1; } } - +/* }}} */ /* This function requires 'properties' to contain all props declared in the * class and all props being public. If only a subset is given or the class * has protected members then you need to merge the properties seperately by * calling zend_merge_properties(). */ -ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC) +ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC) /* {{{ */ { zval *tmp; zend_object *object; @@ -959,26 +1068,28 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type } return SUCCESS; } +/* }}} */ -ZEND_API int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_LINE_DC TSRMLS_DC) +ZEND_API int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_LINE_DC TSRMLS_DC) /* {{{ */ { return _object_and_properties_init(arg, class_type, 0 ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); } +/* }}} */ -ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC) +ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC) /* {{{ */ { return _object_init_ex(arg, zend_standard_class_def ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); } +/* }}} */ - -ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)) +ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)) /* {{{ */ { zend_error(E_WARNING, "add_assoc_function() is no longer supported"); return FAILURE; } +/* }}} */ - -ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n) +ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n) /* {{{ */ { zval *tmp; @@ -987,8 +1098,9 @@ ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n) return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ -ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len) +ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len) /* {{{ */ { zval *tmp; @@ -997,8 +1109,9 @@ ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len) return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ -ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b) +ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b) /* {{{ */ { zval *tmp; @@ -1007,8 +1120,9 @@ ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b) return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ -ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r) +ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r) /* {{{ */ { zval *tmp; @@ -1017,9 +1131,9 @@ ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r) return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d) +ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d) /* {{{ */ { zval *tmp; @@ -1028,9 +1142,9 @@ ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d) return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate) +ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate) /* {{{ */ { zval *tmp; @@ -1039,9 +1153,9 @@ ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate) +ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate) /* {{{ */ { zval *tmp; @@ -1050,14 +1164,15 @@ ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ -ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value) +ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value) /* {{{ */ { return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_index_long(zval *arg, ulong index, long n) +ZEND_API int add_index_long(zval *arg, ulong index, long n) /* {{{ */ { zval *tmp; @@ -1066,9 +1181,9 @@ ZEND_API int add_index_long(zval *arg, ulong index, long n) return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_index_null(zval *arg, ulong index) +ZEND_API int add_index_null(zval *arg, ulong index) /* {{{ */ { zval *tmp; @@ -1077,8 +1192,9 @@ ZEND_API int add_index_null(zval *arg, ulong index) return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ -ZEND_API int add_index_bool(zval *arg, ulong index, int b) +ZEND_API int add_index_bool(zval *arg, ulong index, int b) /* {{{ */ { zval *tmp; @@ -1087,9 +1203,9 @@ ZEND_API int add_index_bool(zval *arg, ulong index, int b) return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_index_resource(zval *arg, ulong index, int r) +ZEND_API int add_index_resource(zval *arg, ulong index, int r) /* {{{ */ { zval *tmp; @@ -1098,9 +1214,9 @@ ZEND_API int add_index_resource(zval *arg, ulong index, int r) return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_index_double(zval *arg, ulong index, double d) +ZEND_API int add_index_double(zval *arg, ulong index, double d) /* {{{ */ { zval *tmp; @@ -1109,9 +1225,9 @@ ZEND_API int add_index_double(zval *arg, ulong index, double d) return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_index_string(zval *arg, ulong index, char *str, int duplicate) +ZEND_API int add_index_string(zval *arg, ulong index, const char *str, int duplicate) /* {{{ */ { zval *tmp; @@ -1120,26 +1236,26 @@ ZEND_API int add_index_string(zval *arg, ulong index, char *str, int duplicate) return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_index_stringl(zval *arg, ulong index, char *str, uint length, int duplicate) +ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */ { zval *tmp; MAKE_STD_ZVAL(tmp); ZVAL_STRINGL(tmp, str, length, duplicate); - + return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_index_zval(zval *arg, ulong index, zval *value) +ZEND_API int add_index_zval(zval *arg, ulong index, zval *value) /* {{{ */ { return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &value, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_next_index_long(zval *arg, long n) +ZEND_API int add_next_index_long(zval *arg, long n) /* {{{ */ { zval *tmp; @@ -1148,9 +1264,9 @@ ZEND_API int add_next_index_long(zval *arg, long n) return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_next_index_null(zval *arg) +ZEND_API int add_next_index_null(zval *arg) /* {{{ */ { zval *tmp; @@ -1159,9 +1275,9 @@ ZEND_API int add_next_index_null(zval *arg) return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_next_index_bool(zval *arg, int b) +ZEND_API int add_next_index_bool(zval *arg, int b) /* {{{ */ { zval *tmp; @@ -1170,9 +1286,9 @@ ZEND_API int add_next_index_bool(zval *arg, int b) return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_next_index_resource(zval *arg, int r) +ZEND_API int add_next_index_resource(zval *arg, int r) /* {{{ */ { zval *tmp; @@ -1181,9 +1297,9 @@ ZEND_API int add_next_index_resource(zval *arg, int r) return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_next_index_double(zval *arg, double d) +ZEND_API int add_next_index_double(zval *arg, double d) /* {{{ */ { zval *tmp; @@ -1192,9 +1308,9 @@ ZEND_API int add_next_index_double(zval *arg, double d) return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate) +ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) /* {{{ */ { zval *tmp; @@ -1203,9 +1319,9 @@ ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate) return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate) +ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate) /* {{{ */ { zval *tmp; @@ -1214,15 +1330,15 @@ ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int dupli return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_next_index_zval(zval *arg, zval *value) +ZEND_API int add_next_index_zval(zval *arg, zval *value) /* {{{ */ { return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &value, sizeof(zval *), NULL); } +/* }}} */ - -ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate) +ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate) /* {{{ */ { zval *tmp; @@ -1231,9 +1347,9 @@ ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *s return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest); } +/* }}} */ - -ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate) +ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate) /* {{{ */ { zval *tmp; @@ -1242,9 +1358,9 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char * return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest); } +/* }}} */ - -ZEND_API int add_get_index_long(zval *arg, ulong index, long l, void **dest) +ZEND_API int add_get_index_long(zval *arg, ulong index, long l, void **dest) /* {{{ */ { zval *tmp; @@ -1253,9 +1369,9 @@ ZEND_API int add_get_index_long(zval *arg, ulong index, long l, void **dest) return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); } +/* }}} */ - -ZEND_API int add_get_index_double(zval *arg, ulong index, double d, void **dest) +ZEND_API int add_get_index_double(zval *arg, ulong index, double d, void **dest) /* {{{ */ { zval *tmp; @@ -1264,38 +1380,38 @@ ZEND_API int add_get_index_double(zval *arg, ulong index, double d, void **dest) return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); } +/* }}} */ - -ZEND_API int add_get_index_string(zval *arg, ulong index, char *str, void **dest, int duplicate) +ZEND_API int add_get_index_string(zval *arg, ulong index, const char *str, void **dest, int duplicate) /* {{{ */ { zval *tmp; MAKE_STD_ZVAL(tmp); ZVAL_STRING(tmp, str, duplicate); - + return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); } +/* }}} */ - -ZEND_API int add_get_index_stringl(zval *arg, ulong index, char *str, uint length, void **dest, int duplicate) +ZEND_API int add_get_index_stringl(zval *arg, ulong index, const char *str, uint length, void **dest, int duplicate) /* {{{ */ { zval *tmp; - + MAKE_STD_ZVAL(tmp); ZVAL_STRINGL(tmp, str, length, duplicate); - + return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); } +/* }}} */ - -ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC) +ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long n TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; MAKE_STD_ZVAL(tmp); ZVAL_LONG(tmp, n); - + MAKE_STD_ZVAL(z_key); ZVAL_STRINGL(z_key, key, key_len-1, 1); @@ -1304,8 +1420,9 @@ ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long n TSR zval_ptr_dtor(&z_key); return SUCCESS; } +/* }}} */ -ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC) +ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1321,15 +1438,16 @@ ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRM zval_ptr_dtor(&z_key); return SUCCESS; } +/* }}} */ -ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC) +ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; - + MAKE_STD_ZVAL(tmp); ZVAL_NULL(tmp); - + MAKE_STD_ZVAL(z_key); ZVAL_STRINGL(z_key, key, key_len-1, 1); @@ -1338,12 +1456,13 @@ ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC) zval_ptr_dtor(&z_key); return SUCCESS; } +/* }}} */ -ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC) +ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, long n TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; - + MAKE_STD_ZVAL(tmp); ZVAL_RESOURCE(tmp, n); @@ -1355,16 +1474,16 @@ ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long n zval_ptr_dtor(&z_key); return SUCCESS; } +/* }}} */ - -ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC) +ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; MAKE_STD_ZVAL(tmp); ZVAL_DOUBLE(tmp, d); - + MAKE_STD_ZVAL(z_key); ZVAL_STRINGL(z_key, key, key_len-1, 1); @@ -1373,9 +1492,9 @@ ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d zval_ptr_dtor(&z_key); return SUCCESS; } +/* }}} */ - -ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC) +ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1391,8 +1510,9 @@ ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *st zval_ptr_dtor(&z_key); return SUCCESS; } +/* }}} */ -ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC) +ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1408,8 +1528,9 @@ ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *s zval_ptr_dtor(&z_key); return SUCCESS; } +/* }}} */ -ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC) +ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC) /* {{{ */ { zval *z_key; @@ -1420,8 +1541,9 @@ ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *valu zval_ptr_dtor(&z_key); return SUCCESS; } +/* }}} */ -ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) +ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */ { int name_len; char *lcname; @@ -1433,7 +1555,7 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* Check module dependencies */ if (module->deps) { - zend_module_dep *dep = module->deps; + const zend_module_dep *dep = module->deps; while (dep->name) { if (dep->type == MODULE_DEP_REQUIRED) { @@ -1442,8 +1564,7 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) name_len = strlen(dep->name); lcname = zend_str_tolower_dup(dep->name, name_len); - if (zend_hash_find(&module_registry, lcname, name_len+1, (void**)&req_mod) == FAILURE || - !req_mod->module_started) { + if (zend_hash_find(&module_registry, lcname, name_len+1, (void**)&req_mod) == FAILURE || !req_mod->module_started) { efree(lcname); /* TODO: Check version relationship */ zend_error(E_CORE_WARNING, "Cannot load module '%s' because required module '%s' is not loaded", module->name, dep->name); @@ -1478,8 +1599,9 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) } return SUCCESS; } +/* }}} */ -static void zend_sort_modules(void *base, size_t count, size_t siz, compare_func_t compare TSRMLS_DC) +static void zend_sort_modules(void *base, size_t count, size_t siz, compare_func_t compare TSRMLS_DC) /* {{{ */ { Bucket **b1 = base; Bucket **b2; @@ -1491,14 +1613,14 @@ static void zend_sort_modules(void *base, size_t count, size_t siz, compare_func try_again: m = (zend_module_entry*)(*b1)->pData; if (!m->module_started && m->deps) { - zend_module_dep *dep = m->deps; + const zend_module_dep *dep = m->deps; while (dep->name) { if (dep->type == MODULE_DEP_REQUIRED || dep->type == MODULE_DEP_OPTIONAL) { b2 = b1 + 1; while (b2 < end) { r = (zend_module_entry*)(*b2)->pData; if (strcasecmp(dep->name, r->name) == 0) { - tmp = *b1; + tmp = *b1; *b1 = *b2; *b2 = tmp; goto try_again; @@ -1512,15 +1634,17 @@ try_again: b1++; } } +/* }}} */ -ZEND_API int zend_startup_modules(TSRMLS_D) +ZEND_API int zend_startup_modules(TSRMLS_D) /* {{{ */ { zend_hash_sort(&module_registry, zend_sort_modules, NULL, 0 TSRMLS_CC); zend_hash_apply(&module_registry, (apply_func_t)zend_startup_module_ex TSRMLS_CC); return SUCCESS; } +/* }}} */ -ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC) +ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */ { int name_len; char *lcname; @@ -1531,12 +1655,12 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TS } #if 0 - zend_printf("%s: Registering module %d\n", module->name, module->module_number); + zend_printf("%s: Registering module %d\n", module->name, module->module_number); #endif /* Check module dependencies */ if (module->deps) { - zend_module_dep *dep = module->deps; + const zend_module_dep *dep = module->deps; while (dep->name) { if (dep->type == MODULE_DEP_CONFLICTS) { @@ -1569,27 +1693,29 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TS if (module->functions && zend_register_functions(NULL, module->functions, NULL, module->type TSRMLS_CC)==FAILURE) { EG(current_module) = NULL; - zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load", module->name); + zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load", module->name); return NULL; } EG(current_module) = NULL; return module; } +/* }}} */ -ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module TSRMLS_DC) +ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module TSRMLS_DC) /* {{{ */ { module->module_number = zend_next_free_module(); module->type = MODULE_PERSISTENT; return zend_register_module_ex(module TSRMLS_CC); } +/* }}} */ -ZEND_API void zend_check_magic_method_implementation(zend_class_entry *ce, zend_function *fptr, int error_type TSRMLS_DC) +ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, int error_type TSRMLS_DC) /* {{{ */ { char lcname[16]; int name_len; - /* we don't care if the function name is longer, in fact lowercasing only + /* we don't care if the function name is longer, in fact lowercasing only * the beginning of the name speeds up the check process */ name_len = strlen(fptr->common.function_name); zend_str_tolower_copy(lcname, fptr->common.function_name, MIN(name_len, sizeof(lcname)-1)); @@ -1629,19 +1755,32 @@ ZEND_API void zend_check_magic_method_implementation(zend_class_entry *ce, zend_ } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name, ZEND_CALL_FUNC_NAME); } + } else if (name_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME) - 1 && + !memcmp(lcname, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) + ) { + if (fptr->common.num_args != 2) { + zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_CALLSTATIC_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name, ZEND_CALLSTATIC_FUNC_NAME); + } + } else if (name_len == sizeof(ZEND_TOSTRING_FUNC_NAME) - 1 && + !memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args != 0 + ) { + zend_error(error_type, "Method %s::%s() cannot take arguments", ce->name, ZEND_TOSTRING_FUNC_NAME); } } +/* }}} */ /* registers all functions in *library_functions in the function hash */ -ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC) +ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC) /* {{{ */ { - zend_function_entry *ptr = functions; + const zend_function_entry *ptr = functions; zend_function function, *reg_function; zend_internal_function *internal_function = (zend_internal_function *)&function; int count=0, unload=0; HashTable *target_function_table = function_table; int error_type; - zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__tostring = NULL; + zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL; char *lowercase_name; int fname_len; char *lc_class_name = NULL; @@ -1658,19 +1797,25 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr } internal_function->type = ZEND_INTERNAL_FUNCTION; internal_function->module = EG(current_module); - + if (scope) { class_name_len = strlen(scope->name); - lc_class_name = zend_str_tolower_dup(scope->name, class_name_len); + if ((lc_class_name = zend_memrchr(scope->name, '\\', class_name_len))) { + ++lc_class_name; + class_name_len -= (lc_class_name - scope->name); + lc_class_name = zend_str_tolower_dup(lc_class_name, class_name_len); + } else { + lc_class_name = zend_str_tolower_dup(scope->name, class_name_len); + } } while (ptr->fname) { internal_function->handler = ptr->handler; - internal_function->function_name = ptr->fname; + internal_function->function_name = (char*)ptr->fname; internal_function->scope = scope; internal_function->prototype = NULL; if (ptr->arg_info) { - internal_function->arg_info = ptr->arg_info+1; + internal_function->arg_info = (zend_arg_info*)ptr->arg_info+1; internal_function->num_args = ptr->num_args; /* Currently you cannot denote that the function can accept less arguments than num_args */ if (ptr->arg_info[0].required_num_args == -1) { @@ -1753,6 +1898,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr clone = reg_function; } else if ((fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME))) { __call = reg_function; + } else if ((fname_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME))) { + __callstatic = reg_function; } else if ((fname_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME))) { __tostring = reg_function; } else if ((fname_len == sizeof(ZEND_GET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME))) { @@ -1796,6 +1943,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr scope->destructor = dtor; scope->clone = clone; scope->__call = __call; + scope->__callstatic = __callstatic; scope->__tostring = __tostring; scope->__get = __get; scope->__set = __set; @@ -1828,6 +1976,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr } __call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } + if (__callstatic) { + if (!(__callstatic->common.fn_flags & ZEND_ACC_STATIC)) { + zend_error(error_type, "Method %s::%s() must be static", scope->name, __callstatic->common.function_name); + } + __callstatic->common.fn_flags |= ZEND_ACC_STATIC; + } if (__tostring) { if (__tostring->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __tostring->common.function_name); @@ -1862,13 +2016,14 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr } return SUCCESS; } +/* }}} */ /* count=-1 means erase all functions, otherwise, * erase the first count functions */ -ZEND_API void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC) +ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC) /* {{{ */ { - zend_function_entry *ptr = functions; + const zend_function_entry *ptr = functions; int i=0; HashTable *target_function_table = function_table; @@ -1887,29 +2042,28 @@ ZEND_API void zend_unregister_functions(zend_function_entry *functions, int coun i++; } } +/* }}} */ - -ZEND_API int zend_startup_module(zend_module_entry *module) +ZEND_API int zend_startup_module(zend_module_entry *module) /* {{{ */ { TSRMLS_FETCH(); - if ((module = zend_register_internal_module(module TSRMLS_CC)) != NULL && - zend_startup_module_ex(module TSRMLS_CC) == SUCCESS) { + if ((module = zend_register_internal_module(module TSRMLS_CC)) != NULL && zend_startup_module_ex(module TSRMLS_CC) == SUCCESS) { return SUCCESS; } return FAILURE; } +/* }}} */ - -ZEND_API int zend_get_module_started(char *module_name) +ZEND_API int zend_get_module_started(const char *module_name) /* {{{ */ { zend_module_entry *module; return (zend_hash_find(&module_registry, module_name, strlen(module_name)+1, (void**)&module) == SUCCESS && module->module_started) ? SUCCESS : FAILURE; } +/* }}} */ - -void module_destructor(zend_module_entry *module) +void module_destructor(zend_module_entry *module) /* {{{ */ { TSRMLS_FETCH(); @@ -1920,11 +2074,11 @@ void module_destructor(zend_module_entry *module) if (module->module_started && module->module_shutdown_func) { #if 0 - zend_printf("%s: Module shutdown\n", module->name); + zend_printf("%s: Module shutdown\n", module->name); #endif module->module_shutdown_func(module->type, module->module_number TSRMLS_CC); } - + /* Deinitilaise module globals */ if (module->globals_size) { #ifdef ZTS @@ -1949,14 +2103,14 @@ void module_destructor(zend_module_entry *module) #endif #endif } - +/* }}} */ /* call request startup for all modules */ -int module_registry_request_startup(zend_module_entry *module TSRMLS_DC) +int module_registry_request_startup(zend_module_entry *module TSRMLS_DC) /* {{{ */ { if (module->request_startup_func) { #if 0 - zend_printf("%s: Request startup\n", module->name); + zend_printf("%s: Request startup\n", module->name); #endif if (module->request_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) { zend_error(E_WARNING, "request_startup() for %s module failed", module->name); @@ -1965,33 +2119,35 @@ int module_registry_request_startup(zend_module_entry *module TSRMLS_DC) } return 0; } - +/* }}} */ /* call request shutdown for all modules */ -int module_registry_cleanup(zend_module_entry *module TSRMLS_DC) +int module_registry_cleanup(zend_module_entry *module TSRMLS_DC) /* {{{ */ { if (module->request_shutdown_func) { #if 0 - zend_printf("%s: Request shutdown\n", module->name); + zend_printf("%s: Request shutdown\n", module->name); #endif module->request_shutdown_func(module->type, module->module_number TSRMLS_CC); } return 0; } +/* }}} */ -int module_registry_unload_temp(zend_module_entry *module TSRMLS_DC) +int module_registry_unload_temp(const zend_module_entry *module TSRMLS_DC) /* {{{ */ { return (module->type == MODULE_TEMPORARY) ? ZEND_HASH_APPLY_REMOVE : ZEND_HASH_APPLY_STOP; } - +/* }}} */ /* return the next free module number */ -int zend_next_free_module(void) +int zend_next_free_module(void) /* {{{ */ { return ++module_count; } +/* }}} */ -static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, zend_uint ce_flags TSRMLS_DC) +static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, zend_uint ce_flags TSRMLS_DC) /* {{{ */ { zend_class_entry *class_entry = malloc(sizeof(zend_class_entry)); char *lowercase_name = malloc(orig_class_entry->name_length + 1); @@ -2011,13 +2167,14 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class free(lowercase_name); return class_entry; } +/* }}} */ /* If parent_ce is not NULL then it inherits from parent_ce * If parent_ce is NULL and parent_name isn't then it looks for the parent and inherits from it * If both parent_ce and parent_name are NULL it does a regular class registration * If parent_name is specified but not found NULL is returned */ -ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC) +ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC) /* {{{ */ { zend_class_entry *register_class; @@ -2037,8 +2194,9 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla } return register_class; } +/* }}} */ -ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...) +ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...) /* {{{ */ { zend_class_entry *interface_entry; va_list interface_list; @@ -2048,31 +2206,47 @@ ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int interface_entry = va_arg(interface_list, zend_class_entry *); zend_do_implement_interface(class_entry, interface_entry TSRMLS_CC); } - + va_end(interface_list); } +/* }}} */ /* A class that contains at least one abstract method automatically becomes an abstract class. */ -ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *orig_class_entry TSRMLS_DC) +ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *orig_class_entry TSRMLS_DC) /* {{{ */ { return do_register_internal_class(orig_class_entry, 0 TSRMLS_CC); } +/* }}} */ -ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC) +ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC) /* {{{ */ { return do_register_internal_class(orig_class_entry, ZEND_ACC_INTERFACE TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, - zend_bool is_ref, int num_symbol_tables, ...) +ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_class_entry *ce TSRMLS_DC) /* {{{ */ { - HashTable *symbol_table; - va_list symbol_table_list; + char *lcname = zend_str_tolower_dup(name, name_len); + int ret; + + ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL); + efree(lcname); + if (ret == SUCCESS) { + ce->refcount++; + } + return ret; +} +/* }}} */ + +ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ +{ + HashTable *symbol_table; + va_list symbol_table_list; if (num_symbol_tables <= 0) return FAILURE; - symbol->is_ref = is_ref; + Z_SET_ISREF_TO_P(symbol, is_ref); va_start(symbol_table_list, num_symbol_tables); while (num_symbol_tables-- > 0) { @@ -2083,25 +2257,24 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, va_end(symbol_table_list); return SUCCESS; } - - - +/* }}} */ /* Disabled functions support */ +/* {{{ proto void display_disabled_function(void) +Dummy function which displays an error when a disabled function is called. */ ZEND_API ZEND_FUNCTION(display_disabled_function) { zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name(TSRMLS_C)); } +/* }}} */ - -static zend_function_entry disabled_function[] = { +static zend_function_entry disabled_function[] = { ZEND_FE(display_disabled_function, NULL) { NULL, NULL, NULL } }; - -ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) +ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) /* {{{ */ { if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) { return FAILURE; @@ -2109,8 +2282,9 @@ ZEND_API int zend_disable_function(char *function_name, uint function_name_lengt disabled_function[0].fname = function_name; return zend_register_functions(NULL, disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC); } +/* }}} */ -static zend_object_value display_disabled_class(zend_class_entry *class_type TSRMLS_DC) +static zend_object_value display_disabled_class(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { zend_object_value retval; zend_object *intern; @@ -2120,12 +2294,13 @@ static zend_object_value display_disabled_class(zend_class_entry *class_type TSR zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name); return retval; } +/* }}} */ -static zend_function_entry disabled_class_new[] = { +static const zend_function_entry disabled_class_new[] = { { NULL, NULL, NULL } }; -ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) +ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) /* {{{ */ { zend_class_entry disabled_class; @@ -2133,108 +2308,298 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_ if (zend_hash_del(CG(class_table), class_name, class_name_length+1)==FAILURE) { return FAILURE; } - INIT_CLASS_ENTRY(disabled_class, class_name, disabled_class_new); + INIT_OVERLOADED_CLASS_ENTRY_EX(disabled_class, class_name, class_name_length, disabled_class_new, NULL, NULL, NULL, NULL, NULL); disabled_class.create_object = display_disabled_class; disabled_class.name_length = class_name_length; zend_register_internal_class(&disabled_class TSRMLS_CC); return SUCCESS; } +/* }}} */ -static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, zend_class_entry *ce_org, zval *callable, zend_class_entry **ce_ptr, zend_function **fptr_ptr TSRMLS_DC) +static int zend_is_callable_check_class(const char *name, int name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */ { - int retval; - char *lcname, *lmname, *colon; - int clen, mlen; - zend_function *fptr; + int ret = 0; zend_class_entry **pce; + char *lcname = zend_str_tolower_dup(name, name_len); + + if (name_len == sizeof("self") - 1 && + !memcmp(lcname, "self", sizeof("self") - 1)) { + if (!EG(scope)) { + if (error) *error = estrdup("cannot access self:: when no class scope is active"); + } else { + fcc->called_scope = EG(called_scope); + fcc->calling_scope = EG(scope); + if (!fcc->object_ptr) { + fcc->object_ptr = EG(This); + } + ret = 1; + } + } else if (name_len == sizeof("parent") - 1 && + !memcmp(lcname, "parent", sizeof("parent") - 1)) { + if (!EG(scope)) { + if (error) *error = estrdup("cannot access parent:: when no class scope is active"); + } else if (!EG(scope)->parent) { + if (error) *error = estrdup("cannot access parent:: when current class scope has no parent"); + } else { + fcc->called_scope = EG(called_scope); + fcc->calling_scope = EG(scope)->parent; + if (!fcc->object_ptr) { + fcc->object_ptr = EG(This); + } + ret = 1; + } + } else if (name_len == sizeof("static") - 1 && + !memcmp(lcname, "static", sizeof("static") - 1)) { + if (!EG(called_scope)) { + if (error) *error = estrdup("cannot access static:: when no class scope is active"); + } else { + fcc->called_scope = EG(called_scope); + fcc->calling_scope = EG(called_scope); + if (!fcc->object_ptr) { + fcc->object_ptr = EG(This); + } + ret = 1; + } + } else if (zend_lookup_class_ex(name, name_len, 1, &pce TSRMLS_CC) == SUCCESS) { + zend_class_entry *scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL; + + fcc->calling_scope = *pce; + if (scope && !fcc->object_ptr && EG(This) && + instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) && + instanceof_function(scope, fcc->calling_scope TSRMLS_CC)) { + fcc->object_ptr = EG(This); + fcc->called_scope = Z_OBJCE_P(fcc->object_ptr); + } else { + fcc->called_scope = fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : fcc->calling_scope; + } + ret = 1; + } else { + if (error) zend_spprintf(error, 0, "class '%.*s' not found", name_len, name); + } + efree(lcname); + return ret; +} +/* }}} */ + + +static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */ +{ + zend_class_entry *ce_org = fcc->calling_scope; + int retval = 0; + char *mname, *lmname, *colon; + int clen, mlen; + zend_class_entry *last_scope; HashTable *ftable; + int call_via_handler = 0; + + if (error) { + *error = NULL; + } + + fcc->calling_scope = NULL; + fcc->function_handler = NULL; - *ce_ptr = NULL; - *fptr_ptr = NULL; + if (!ce_org) { + /* Skip leading \ */ + if (Z_STRVAL_P(callable)[0] == '\\') { + mlen = Z_STRLEN_P(callable) - 1; + mname = Z_STRVAL_P(callable) + 1; + lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 1, mlen); + } else { + mlen = Z_STRLEN_P(callable); + mname = Z_STRVAL_P(callable); + lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen); + } + /* Check if function with given name exists. + * This may be a compound name that includes namespace name */ + if (zend_hash_find(EG(function_table), lmname, mlen+1, (void**)&fcc->function_handler) == SUCCESS) { + efree(lmname); + return 1; + } + efree(lmname); + } - if ((colon = strstr(Z_STRVAL_P(callable), "::")) != NULL) { + /* Split name into class/namespace and method/function names */ + if ((colon = zend_memrchr(Z_STRVAL_P(callable), ':', Z_STRLEN_P(callable))) != NULL && + colon > Z_STRVAL_P(callable) && + *(colon-1) == ':' + ) { + colon--; clen = colon - Z_STRVAL_P(callable); mlen = Z_STRLEN_P(callable) - clen - 2; - lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen); - /* caution: lcname is not '\0' terminated */ - if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) { - *ce_ptr = EG(scope); - } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) { - *ce_ptr = EG(scope) ? EG(scope)->parent : NULL; - } else if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) { - *ce_ptr = *pce; + + if (colon == Z_STRVAL_P(callable)) { + if (error) zend_spprintf(error, 0, "invalid function name"); + return 0; } - efree(lcname); - if (!*ce_ptr) { + + /* This is a compound name. + * Try to fetch class and then find static method. */ + last_scope = EG(scope); + if (ce_org) { + EG(scope) = ce_org; + } + + if (!zend_is_callable_check_class(Z_STRVAL_P(callable), clen, fcc, error TSRMLS_CC)) { + EG(scope) = last_scope; return 0; } - ftable = &(*ce_ptr)->function_table; - if (ce_org && !instanceof_function(ce_org, *ce_ptr TSRMLS_CC)) { + EG(scope) = last_scope; + + ftable = &fcc->calling_scope->function_table; + if (ce_org && !instanceof_function(ce_org, fcc->calling_scope TSRMLS_CC)) { + if (error) zend_spprintf(error, 0, "class '%s' is not a subclass of '%s'", ce_org->name, fcc->calling_scope->name); return 0; } - lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + clen + 2, mlen); - } else { + mname = Z_STRVAL_P(callable) + clen + 2; + } else if (ce_org) { + /* Try to fetch find static method of given class. */ mlen = Z_STRLEN_P(callable); - lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen); - if (ce_org) { - ftable = &ce_org->function_table; - *ce_ptr = ce_org; - } else { - ftable = EG(function_table); + mname = Z_STRVAL_P(callable); + ftable = &ce_org->function_table; + fcc->calling_scope = ce_org; + } else { + /* We already checked for plain function before. */ + if (error && !(check_flags & IS_CALLABLE_CHECK_SILENT)) { + zend_spprintf(error, 0, "function '%s' not found or invalid function name", Z_STRVAL_P(callable)); } + return 0; } - retval = zend_hash_find(ftable, lmname, mlen+1, (void**)&fptr) == SUCCESS ? 1 : 0; + lmname = zend_str_tolower_dup(mname, mlen); + if (zend_hash_find(ftable, lmname, mlen+1, (void**)&fcc->function_handler) == SUCCESS) { + retval = 1; + if ((fcc->function_handler->op_array.fn_flags & ZEND_ACC_CHANGED) && + EG(scope) && + instanceof_function(fcc->function_handler->common.scope, EG(scope) TSRMLS_CC)) { + zend_function *priv_fbc; - if (!retval) { - if (*zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__call != 0) { - retval = (*ce_ptr)->__call != NULL; - *fptr_ptr = (*ce_ptr)->__call; + if (zend_hash_find(&EG(scope)->function_table, lmname, mlen+1, (void **) &priv_fbc)==SUCCESS + && priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE + && priv_fbc->common.scope == EG(scope)) { + fcc->function_handler = priv_fbc; + } + } + if ((check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0 && + (fcc->calling_scope && + (fcc->calling_scope->__call || + fcc->calling_scope->__callstatic))) { + if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) { + if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) { + retval = 0; + fcc->function_handler = NULL; + goto get_function_via_handler; + } + } else if (fcc->function_handler->common.fn_flags & ZEND_ACC_PROTECTED) { + if (!zend_check_protected(fcc->function_handler->common.scope, EG(scope))) { + retval = 0; + fcc->function_handler = NULL; + goto get_function_via_handler; + } + } } } else { - *fptr_ptr = fptr; - if (*ce_ptr) { - if (!*zobj_ptr_ptr && !(fptr->common.fn_flags & ZEND_ACC_STATIC)) { +get_function_via_handler: + if (fcc->object_ptr) { + if (Z_OBJ_HT_P(fcc->object_ptr)->get_method) { + fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, mname, mlen TSRMLS_CC); + if (fcc->function_handler) { + retval = 1; + call_via_handler = (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0; + } + } + } else if (fcc->calling_scope) { + if (fcc->calling_scope->get_static_method) { + fcc->function_handler = fcc->calling_scope->get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC); + } else { + fcc->function_handler = zend_std_get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC); + } + if (fcc->function_handler) { + retval = 1; + call_via_handler = (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0; + } + } + } + + if (retval) { + if (fcc->calling_scope && !call_via_handler) { + if (!fcc->object_ptr && !(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_STRICT; + 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; + } + if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), fcc->calling_scope TSRMLS_CC)) { + fcc->object_ptr = EG(This); + if (error) { + zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb, Z_OBJCE_P(EG(This))->name); + } else if (retval) { + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb, Z_OBJCE_P(EG(This))->name); + } } else { - if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), *ce_ptr TSRMLS_CC)) { - *zobj_ptr_ptr = &EG(This); - zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically, assuming $this from compatible context %s", (*ce_ptr)->name, fptr->common.function_name, Z_OBJCE_P(EG(This))->name); - } else { - zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically", (*ce_ptr)->name, fptr->common.function_name); + if (error) { + zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb); + } else if (retval) { + zend_error(severity, "Non-static method %s::%s() %s be called statically", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb); } } } if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) { - if (fptr->op_array.fn_flags & ZEND_ACC_PRIVATE) { - if (!zend_check_private(fptr, *zobj_ptr_ptr ? Z_OBJCE_PP(*zobj_ptr_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) { + if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) { + if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) { + if (error) { + if (*error) { + efree(*error); + } + zend_spprintf(error, 0, "cannot access private method %s::%s()", fcc->calling_scope->name, fcc->function_handler->common.function_name); + } retval = 0; } - } else if ((fptr->common.fn_flags & ZEND_ACC_PROTECTED)) { - if (!zend_check_protected(fptr->common.scope, EG(scope))) { + } else if ((fcc->function_handler->common.fn_flags & ZEND_ACC_PROTECTED)) { + if (!zend_check_protected(fcc->function_handler->common.scope, EG(scope))) { + if (error) { + if (*error) { + efree(*error); + } + zend_spprintf(error, 0, "cannot access protected method %s::%s()", fcc->calling_scope->name, fcc->function_handler->common.function_name); + } retval = 0; } } - if (!retval && *zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__call != 0) { - retval = (*ce_ptr)->__call != NULL; - *fptr_ptr = (*ce_ptr)->__call; - } } } + } else if (error && !(check_flags & IS_CALLABLE_CHECK_SILENT)) { + if (fcc->calling_scope) { + if (error) zend_spprintf(error, 0, "class '%s' does not have a method '%s'", fcc->calling_scope->name, mname); + } else { + if (error) zend_spprintf(error, 0, "function '%s' does not exist", mname); + } } efree(lmname); + + if (fcc->object_ptr) { + fcc->called_scope = Z_OBJCE_P(fcc->object_ptr); + } + if (retval) { + fcc->initialized = 1; + } return retval; } +/* }}} */ -ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC) +ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */ { - char *lcname; - zend_bool retval = 0; + zend_bool ret; int callable_name_len_local; - zend_class_entry *ce_local, **pce; - zend_function *fptr_local; - zval **zobj_ptr_local; + zend_fcall_info_cache fcc_local; if (callable_name) { *callable_name = NULL; @@ -2242,42 +2607,80 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char ** if (callable_name_len == NULL) { callable_name_len = &callable_name_len_local; } - if (ce_ptr == NULL) { - ce_ptr = &ce_local; + if (fcc == NULL) { + fcc = &fcc_local; } - if (fptr_ptr == NULL) { - fptr_ptr = &fptr_local; + if (error) { + *error = NULL; } - if (zobj_ptr_ptr == NULL) { - zobj_ptr_ptr = &zobj_ptr_local; + + fcc->initialized = 0; + fcc->calling_scope = NULL; + fcc->called_scope = NULL; + fcc->function_handler = NULL; + fcc->calling_scope = NULL; + fcc->object_ptr = NULL; + + if (object_ptr && Z_TYPE_P(object_ptr) != IS_OBJECT) { + object_ptr = NULL; + } + if (object_ptr && + (!EG(objects_store).object_buckets || + !EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(object_ptr)].valid)) { + return 0; } - *ce_ptr = NULL; - *fptr_ptr = NULL; - *zobj_ptr_ptr = NULL; switch (Z_TYPE_P(callable)) { case IS_STRING: - if (callable_name) { + if (object_ptr) { + fcc->object_ptr = object_ptr; + fcc->calling_scope = Z_OBJCE_P(object_ptr); + if (callable_name) { + char *ptr; + + *callable_name_len = fcc->calling_scope->name_length + Z_STRLEN_P(callable) + sizeof("::") - 1; + ptr = *callable_name = emalloc(*callable_name_len + 1); + memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name_length); + ptr += fcc->calling_scope->name_length; + memcpy(ptr, "::", sizeof("::") - 1); + ptr += sizeof("::") - 1; + memcpy(ptr, Z_STRVAL_P(callable), Z_STRLEN_P(callable) + 1); + } + } else if (callable_name) { *callable_name = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable)); *callable_name_len = Z_STRLEN_P(callable); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { + fcc->called_scope = fcc->calling_scope; return 1; } - - retval = zend_is_callable_check_func(check_flags|IS_CALLABLE_CHECK_IS_STATIC, zobj_ptr_ptr, NULL, callable, ce_ptr, fptr_ptr TSRMLS_CC); - break; + + ret = zend_is_callable_check_func(check_flags, callable, fcc, error TSRMLS_CC); + if (fcc == &fcc_local && + fcc->function_handler && + ((fcc->function_handler->type == ZEND_INTERNAL_FUNCTION && + (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER)) || + fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || + fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { + if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { + efree(fcc->function_handler->common.function_name); + } + efree(fcc->function_handler); + } + return ret; case IS_ARRAY: { - zend_class_entry *ce = NULL; - zval **method; - zval **obj; - - if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2 && - zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj) == SUCCESS && - zend_hash_index_find(Z_ARRVAL_P(callable), 1, (void **) &method) == SUCCESS && - (Z_TYPE_PP(obj) == IS_OBJECT || Z_TYPE_PP(obj) == IS_STRING) && + zval **method = NULL; + zval **obj = NULL; + + if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2) { + zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj); + zend_hash_index_find(Z_ARRVAL_P(callable), 1, (void **) &method); + } + if (obj && method && + (Z_TYPE_PP(obj) == IS_OBJECT || + Z_TYPE_PP(obj) == IS_STRING) && Z_TYPE_PP(method) == IS_STRING) { if (Z_TYPE_PP(obj) == IS_STRING) { @@ -2297,48 +2700,84 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char ** return 1; } - lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj)); - if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0 && EG(active_op_array)) { - ce = EG(active_op_array)->scope; - } else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array) && EG(active_op_array)->scope) { - ce = EG(active_op_array)->scope->parent; - } else if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) { - ce = *pce; + if (!zend_is_callable_check_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), fcc, error TSRMLS_CC)) { + return 0; } - efree(lcname); + } else { - ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */ + if (!EG(objects_store).object_buckets || + !EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(obj)].valid) { + return 0; + } - *zobj_ptr_ptr = obj; + fcc->calling_scope = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */ + + fcc->object_ptr = *obj; if (callable_name) { char *ptr; - *callable_name_len = ce->name_length + Z_STRLEN_PP(method) + sizeof("::") - 1; + *callable_name_len = fcc->calling_scope->name_length + Z_STRLEN_PP(method) + sizeof("::") - 1; ptr = *callable_name = emalloc(*callable_name_len + 1); - memcpy(ptr, ce->name, ce->name_length); - ptr += ce->name_length; + memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name_length); + ptr += fcc->calling_scope->name_length; memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { - *ce_ptr = ce; + fcc->called_scope = fcc->calling_scope; return 1; } } - if (ce) { - retval = zend_is_callable_check_func(check_flags, zobj_ptr_ptr, ce, *method, ce_ptr, fptr_ptr TSRMLS_CC); + ret = zend_is_callable_check_func(check_flags, *method, fcc, error TSRMLS_CC); + if (fcc == &fcc_local && + fcc->function_handler && + ((fcc->function_handler->type == ZEND_INTERNAL_FUNCTION && + (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER)) || + fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || + fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { + if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { + efree(fcc->function_handler->common.function_name); + } + efree(fcc->function_handler); + } + return ret; + + } else { + if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2) { + if (!obj || (Z_TYPE_PP(obj) != IS_STRING && Z_TYPE_PP(obj) != IS_OBJECT)) { + if (error) zend_spprintf(error, 0, "first array member is not a valid class name or object"); + } else { + if (error) zend_spprintf(error, 0, "second array member is not a valid method"); + } + } else { + if (error) zend_spprintf(error, 0, "array must have exactly two members"); + } + if (callable_name) { + *callable_name = estrndup("Array", sizeof("Array")-1); + *callable_name_len = sizeof("Array") - 1; } - } else if (callable_name) { - *callable_name = estrndup("Array", sizeof("Array")-1); - *callable_name_len = sizeof("Array") - 1; } - *ce_ptr = ce; } - break; + return 0; + + case IS_OBJECT: + if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, &fcc->object_ptr TSRMLS_CC) == SUCCESS) { + fcc->called_scope = fcc->calling_scope; + if (callable_name) { + zend_class_entry *ce = Z_OBJCE_P(callable); /* TBFixed: what if it's overloaded? */ + + *callable_name_len = ce->name_length + sizeof("::__invoke") - 1; + *callable_name = emalloc(*callable_name_len + 1); + memcpy(*callable_name, ce->name, ce->name_length); + memcpy((*callable_name) + ce->name_length, "::__invoke", sizeof("::__invoke")); + } + return 1; + } + /* break missing intentionally */ default: if (callable_name) { @@ -2350,53 +2789,54 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char ** *callable_name_len = Z_STRLEN(expr_copy); zval_dtor(&expr_copy); } - break; + if (error) zend_spprintf(error, 0, "no array or string given"); + return 0; } - - return retval; } +/* }}} */ - -ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name) +ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name TSRMLS_DC) /* {{{ */ { - TSRMLS_FETCH(); - - return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL, NULL TSRMLS_CC); + return zend_is_callable_ex(callable, NULL, check_flags, callable_name, NULL, NULL, NULL TSRMLS_CC); } +/* }}} */ - -ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC) +ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC) /* {{{ */ { - zend_class_entry *ce; - zend_function *fptr; - zval **zobj_ptr; + zend_fcall_info_cache fcc; - if (zend_is_callable_ex(callable, 0, callable_name, NULL, &ce, &fptr, &zobj_ptr TSRMLS_CC)) { - if (Z_TYPE_P(callable) == IS_STRING && ce) { + if (zend_is_callable_ex(callable, NULL, IS_CALLABLE_STRICT, callable_name, NULL, &fcc, NULL TSRMLS_CC)) { + if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) { zval_dtor(callable); array_init(callable); - add_next_index_string(callable, ce->name, 1); - add_next_index_string(callable, fptr->common.function_name, 1); + add_next_index_string(callable, fcc.calling_scope->name, 1); + add_next_index_string(callable, fcc.function_handler->common.function_name, 1); + } + if (fcc.function_handler && + ((fcc.function_handler->type == ZEND_INTERNAL_FUNCTION && + (fcc.function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER)) || + fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || + fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION)) { + if (fcc.function_handler->type != ZEND_OVERLOADED_FUNCTION) { + efree(fcc.function_handler->common.function_name); + } + efree(fcc.function_handler); } return 1; } return 0; } +/* }}} */ - -ZEND_API int zend_fcall_info_init(zval *callable, zend_fcall_info *fci, zend_fcall_info_cache *fcc TSRMLS_DC) +ZEND_API int zend_fcall_info_init(zval *callable, uint check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, char **callable_name, char **error TSRMLS_DC) /* {{{ */ { - zend_class_entry *ce; - zend_function *func; - zval **obj; - - if (!zend_is_callable_ex(callable, IS_CALLABLE_STRICT, NULL, NULL, &ce, &func, &obj TSRMLS_CC)) { + if (!zend_is_callable_ex(callable, NULL, check_flags, callable_name, NULL, fcc, error TSRMLS_CC)) { return FAILURE; } fci->size = sizeof(*fci); - fci->function_table = ce ? &ce->function_table : EG(function_table); - fci->object_pp = obj; + fci->function_table = fcc->calling_scope ? &fcc->calling_scope->function_table : EG(function_table); + fci->object_ptr = fcc->object_ptr; fci->function_name = callable; fci->retval_ptr_ptr = NULL; fci->param_count = 0; @@ -2404,23 +2844,11 @@ ZEND_API int zend_fcall_info_init(zval *callable, zend_fcall_info *fci, zend_fca fci->no_separation = 1; fci->symbol_table = NULL; - if (strlen(func->common.function_name) == sizeof(ZEND_CALL_FUNC_NAME) - 1 && !memcmp(func->common.function_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME))) { - fcc->initialized = 0; - fcc->function_handler = NULL; - fcc->calling_scope = NULL; - fcc->object_pp = NULL; - } else { - fcc->initialized = 1; - fcc->function_handler = func; - fcc->calling_scope = ce; - fcc->object_pp = obj; - } - return SUCCESS; } +/* }}} */ - -ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem) +ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem) /* {{{ */ { if (fci->params) { while (fci->param_count) { @@ -2433,26 +2861,29 @@ ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem) } fci->param_count = 0; } +/* }}} */ -ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, int *param_count, zval ****params) +ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, int *param_count, zval ****params) /* {{{ */ { *param_count = fci->param_count; *params = fci->params; fci->param_count = 0; fci->params = NULL; } +/* }}} */ -ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count, zval ***params) +ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count, zval ***params) /* {{{ */ { zend_fcall_info_args_clear(fci, 1); fci->param_count = param_count; fci->params = params; } +/* }}} */ -ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) +ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /* {{{ */ { HashPosition pos; - zval **arg, ***params; + zval **arg, ***params; zend_fcall_info_args_clear(fci, !args); @@ -2465,22 +2896,86 @@ ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) } fci->param_count = zend_hash_num_elements(Z_ARRVAL_P(args)); - fci->params = params = (zval***)safe_emalloc(sizeof(zval**), fci->param_count, 0); + fci->params = params = (zval ***) erealloc(fci->params, fci->param_count * sizeof(zval **)); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos); - while (zend_hash_get_current_data_ex(Z_ARRVAL_P(args), (void **) &arg, &pos) == SUCCESS) { + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(args), (void *) &arg, &pos) == SUCCESS) { *params++ = arg; - (*arg)->refcount++; + Z_ADDREF_P(*arg); zend_hash_move_forward_ex(Z_ARRVAL_P(args), &pos); } + + return SUCCESS; +} +/* }}} */ + +ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval ***argv) /* {{{ */ +{ + int i; + + if (argc < 0) { + return FAILURE; + } + + zend_fcall_info_args_clear(fci, !argc); + + if (argc) { + fci->param_count = argc; + fci->params = (zval ***) erealloc(fci->params, fci->param_count * sizeof(zval **)); + + for (i = 0; i < argc; ++i) { + Z_ADDREF_P(*(argv[i])); + fci->params[i] = argv[i]; + } + } + return SUCCESS; } +/* }}} */ + +ZEND_API int zend_fcall_info_argv(zend_fcall_info *fci TSRMLS_DC, int argc, va_list *argv) /* {{{ */ +{ + int i; + zval **arg; + + if (argc < 0) { + return FAILURE; + } + + zend_fcall_info_args_clear(fci, !argc); + if (argc) { + fci->param_count = argc; + fci->params = (zval ***) erealloc(fci->params, fci->param_count * sizeof(zval **)); + + for (i = 0; i < argc; ++i) { + arg = va_arg(*argv, zval **); + Z_ADDREF_P(*arg); + fci->params[i] = arg; + } + } -ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval **retval_ptr_ptr, zval *args TSRMLS_DC) + return SUCCESS; +} +/* }}} */ + +ZEND_API int zend_fcall_info_argn(zend_fcall_info *fci TSRMLS_DC, int argc, ...) /* {{{ */ +{ + int ret; + va_list argv; + + va_start(argv, argc); + ret = zend_fcall_info_argv(fci TSRMLS_CC, argc, &argv); + va_end(argv); + + return ret; +} +/* }}} */ + +ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval **retval_ptr_ptr, zval *args TSRMLS_DC) /* {{{ */ { zval *retval, ***org_params = NULL; - int result, org_count = 0; + int result, org_count = 0; fci->retval_ptr_ptr = retval_ptr_ptr ? retval_ptr_ptr : &retval; if (args) { @@ -2488,7 +2983,7 @@ ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *f zend_fcall_info_args(fci, args TSRMLS_CC); } result = zend_call_function(fci, fcc TSRMLS_CC); - + if (!retval_ptr_ptr && retval) { zval_ptr_dtor(&retval); } @@ -2497,31 +2992,25 @@ ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *f } return result; } +/* }}} */ - -ZEND_API char *zend_get_module_version(char *module_name) +ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */ { char *lname; int name_len = strlen(module_name); zend_module_entry *module; lname = zend_str_tolower_dup(module_name, name_len); - if (zend_hash_find(&module_registry, lname, name_len + 1, - (void**)&module) == FAILURE) { + if (zend_hash_find(&module_registry, lname, name_len + 1, (void**)&module) == FAILURE) { efree(lname); return NULL; } efree(lname); return module->version; } +/* }}} */ - -ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC) -{ - return zend_declare_property_ex(ce, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); -} - -ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) +ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) /* {{{ */ { zend_property_info property_info; HashTable *target_symbol_table; @@ -2593,26 +3082,34 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name return SUCCESS; } +/* }}} */ + +ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC) /* {{{ */ +{ + return zend_declare_property_ex(ce, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); +} +/* }}} */ -ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC) +ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC) /* {{{ */ { zval *property; if (ce->type & ZEND_INTERNAL_CLASS) { - property = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(property); } else { ALLOC_ZVAL(property); } INIT_ZVAL(*property); return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC) +ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; if (ce->type & ZEND_INTERNAL_CLASS) { - property = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(property); } else { ALLOC_ZVAL(property); } @@ -2620,13 +3117,14 @@ ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int na ZVAL_BOOL(property, value); return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC) +ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; if (ce->type & ZEND_INTERNAL_CLASS) { - property = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(property); } else { ALLOC_ZVAL(property); } @@ -2634,13 +3132,14 @@ ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int na ZVAL_LONG(property, value); return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC) +ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; if (ce->type & ZEND_INTERNAL_CLASS) { - property = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(property); } else { ALLOC_ZVAL(property); } @@ -2648,14 +3147,15 @@ ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int ZVAL_DOUBLE(property, value); return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC) +ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; int len = strlen(value); if (ce->type & ZEND_INTERNAL_CLASS) { - property = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(property); ZVAL_STRINGL(property, zend_strndup(value, len), len, 0); } else { ALLOC_ZVAL(property); @@ -2664,13 +3164,14 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int INIT_PZVAL(property); return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC) +ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC) /* {{{ */ { zval *property; if (ce->type & ZEND_INTERNAL_CLASS) { - property = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(property); ZVAL_STRINGL(property, zend_strndup(value, value_len), value_len, 0); } else { ALLOC_ZVAL(property); @@ -2679,18 +3180,20 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int INIT_PZVAL(property); return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC) +ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC) /* {{{ */ { return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL); } +/* }}} */ -ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, size_t name_length TSRMLS_DC) +ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC) /* {{{ */ { zval *constant; if (ce->type & ZEND_INTERNAL_CLASS) { - constant = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(constant); } else { ALLOC_ZVAL(constant); } @@ -2698,13 +3201,14 @@ ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, INIT_PZVAL(constant); return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC) +ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, long value TSRMLS_DC) /* {{{ */ { zval *constant; if (ce->type & ZEND_INTERNAL_CLASS) { - constant = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(constant); } else { ALLOC_ZVAL(constant); } @@ -2712,13 +3216,14 @@ ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, INIT_PZVAL(constant); return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC) +ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value TSRMLS_DC) /* {{{ */ { zval *constant; if (ce->type & ZEND_INTERNAL_CLASS) { - constant = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(constant); } else { ALLOC_ZVAL(constant); } @@ -2726,13 +3231,14 @@ ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, INIT_PZVAL(constant); return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC) +ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value TSRMLS_DC) /* {{{ */ { zval *constant; if (ce->type & ZEND_INTERNAL_CLASS) { - constant = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(constant); } else { ALLOC_ZVAL(constant); } @@ -2740,13 +3246,14 @@ ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name INIT_PZVAL(constant); return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC) +ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC) /* {{{ */ { zval *constant; if (ce->type & ZEND_INTERNAL_CLASS) { - constant = malloc(sizeof(zval)); + ALLOC_PERMANENT_ZVAL(constant); ZVAL_STRINGL(constant, zend_strndup(value, value_length), value_length, 0); } else { ALLOC_ZVAL(constant); @@ -2755,13 +3262,15 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *nam INIT_PZVAL(constant); return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC) +ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value TSRMLS_DC) /* {{{ */ { return zend_declare_class_constant_stringl(ce, name, name_length, value, strlen(value) TSRMLS_CC); } +/* }}} */ -ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC) +ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */ { zval *property; zend_class_entry *old_scope = EG(scope); @@ -2783,74 +3292,81 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char * EG(scope) = old_scope; } +/* }}} */ -ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC) +ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_NULL(tmp); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC) +ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_BOOL(tmp, value); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC) +ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_LONG(tmp, value); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC) +ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_DOUBLE(tmp, value); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC) +ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_STRING(tmp, value, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_len TSRMLS_DC) +ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_STRINGL(tmp, value, value_len, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC) +ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */ { zval **property; zend_class_entry *old_scope = EG(scope); @@ -2866,13 +3382,13 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, in zval_dtor(*property); Z_TYPE_PP(property) = Z_TYPE_P(value); (*property)->value = value->value; - if (value->refcount > 0) { + if (Z_REFCOUNT_P(value) > 0) { zval_copy_ctor(*property); } } else { zval *garbage = *property; - value->refcount++; + Z_ADDREF_P(value); if (PZVAL_IS_REF(value)) { SEPARATE_ZVAL(&value); } @@ -2883,74 +3399,81 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, in return SUCCESS; } } +/* }}} */ -ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC) +ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_NULL(tmp); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC) +ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_BOOL(tmp, value); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC) +ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_LONG(tmp, value); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC) +ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_DOUBLE(tmp, value); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC) +ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_STRING(tmp, value, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_len TSRMLS_DC) +ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_STRINGL(tmp, value, value_len, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } +/* }}} */ -ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC) +ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ { zval *property, *value; zend_class_entry *old_scope = EG(scope); @@ -2973,8 +3496,9 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n EG(scope) = old_scope; return value; } +/* }}} */ -ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC) +ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ { zval **property; zend_class_entry *old_scope = EG(scope); @@ -2985,6 +3509,48 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, in return property?*property:NULL; } +/* }}} */ + +ZEND_API void zend_save_error_handling(zend_error_handling *current TSRMLS_DC) /* {{{ */ +{ + current->handling = EG(error_handling); + current->exception = EG(exception_class); + current->user_handler = EG(user_error_handler); + if (current->user_handler) { + Z_ADDREF_P(current->user_handler); + } +} +/* }}} */ + +ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling, zend_class_entry *exception_class, zend_error_handling *current TSRMLS_DC) /* {{{ */ +{ + if (current) { + zend_save_error_handling(current TSRMLS_CC); + if (error_handling != EH_NORMAL && EG(user_error_handler)) { + zval_ptr_dtor(&EG(user_error_handler)); + EG(user_error_handler) = NULL; + } + } + EG(error_handling) = error_handling; + EG(exception_class) = error_handling == EH_THROW ? exception_class : NULL; +} +/* }}} */ + +ZEND_API void zend_restore_error_handling(zend_error_handling *saved TSRMLS_DC) /* {{{ */ +{ + EG(error_handling) = saved->handling; + EG(exception_class) = saved->handling == EH_THROW ? saved->exception : NULL; + if (saved->user_handler && saved->user_handler != EG(user_error_handler)) { + if (EG(user_error_handler)) { + zval_ptr_dtor(&EG(user_error_handler)); + } + EG(user_error_handler) = saved->user_handler; + } else if (saved->user_handler) { + zval_ptr_dtor(&saved->user_handler); + } + saved->user_handler = NULL; +} +/* }}} */ /* * Local variables: diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 19cfd43b6..c286f2d8c 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -5,7 +5,7 @@ | Copyright (c) 1998-2009 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 | + | 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.207.2.8.2.10 2008/12/31 11:17:32 sebastian Exp $ */ +/* $Id: zend_API.h,v 1.207.2.8.2.8.2.24 2008/12/31 11:15:31 sebastian Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -33,13 +33,35 @@ BEGIN_EXTERN_C() typedef struct _zend_function_entry { - char *fname; + const char *fname; void (*handler)(INTERNAL_FUNCTION_PARAMETERS); - struct _zend_arg_info *arg_info; + const struct _zend_arg_info *arg_info; zend_uint num_args; zend_uint flags; } zend_function_entry; +typedef struct _zend_fcall_info { + size_t size; + HashTable *function_table; + zval *function_name; + HashTable *symbol_table; + zval **retval_ptr_ptr; + zend_uint param_count; + zval ***params; + zval *object_ptr; + zend_bool no_separation; +} zend_fcall_info; + +typedef struct _zend_fcall_info_cache { + zend_bool initialized; + zend_function *function_handler; + zend_class_entry *calling_scope; + zend_class_entry *called_scope; + zval *object_ptr; +} zend_fcall_info_cache; + +#define ZEND_NS_NAME(ns, name) ns"\\"name + #define ZEND_FN(name) zif_##name #define ZEND_MN(name) zim_##name #define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS) @@ -63,12 +85,23 @@ typedef struct _zend_function_entry { ZEND_FENTRY(name, ZEND_MN(classname##_##alias), arg_info, flags) #define ZEND_ME_MAPPING(name, func_name, arg_types, flags) ZEND_NAMED_ME(name, ZEND_FN(func_name), arg_types, flags) +#define ZEND_NS_FENTRY(ns, zend_name, name, arg_info, flags) ZEND_RAW_FENTRY(ZEND_NS_NAME(ns, #zend_name), name, arg_info, flags) + +#define ZEND_NS_RAW_FENTRY(ns, zend_name, name, arg_info, flags) ZEND_RAW_FENTRY(ZEND_NS_NAME(ns, zend_name), name, arg_info, flags) +#define ZEND_NS_RAW_NAMED_FE(ns, zend_name, name, arg_info) ZEND_NS_RAW_FENTRY(ns, #zend_name, name, arg_info, 0) + +#define ZEND_NS_NAMED_FE(ns, zend_name, name, arg_info) +#define ZEND_NS_FE(ns, name, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(name), arg_info, 0) +#define ZEND_NS_DEP_FE(ns, name, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(name), arg_info, ZEND_ACC_DEPRECATED) +#define ZEND_NS_FALIAS(ns, name, alias, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(alias), arg_info, 0) +#define ZEND_NS_DEP_FALIAS(ns, name, alias, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED) + #define ZEND_ARG_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, 0, pass_by_ref, 0, 0 }, #define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, NULL, 0, 0, 0, pass_by_ref, 0, 0 }, #define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, 0, allow_null, pass_by_ref, 0, 0 }, #define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, 1, allow_null, pass_by_ref, 0, 0 }, #define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args) \ - zend_arg_info name[] = { \ + static const zend_arg_info name[] = { \ { NULL, 0, NULL, 0, 0, 0, pass_rest_by_reference, return_reference, required_num_args }, #define ZEND_BEGIN_ARG_INFO(name, pass_rest_by_reference) \ ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_VALUE, -1) @@ -124,12 +157,17 @@ typedef struct _zend_function_entry { #endif -#define INIT_CLASS_ENTRY(class_container, class_name, functions) INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL) +#define INIT_CLASS_ENTRY(class_container, class_name, functions) \ + INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL) -#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ +#define INIT_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions) \ + INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, NULL, NULL, NULL, NULL, NULL) + +#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ { \ - class_container.name = strdup(class_name); \ - class_container.name_length = sizeof(class_name) - 1; \ + int _len = class_name_len; \ + class_container.name = zend_strndup(class_name, _len); \ + class_container.name_length = _len; \ class_container.builtin_functions = functions; \ class_container.constructor = NULL; \ class_container.destructor = NULL; \ @@ -138,7 +176,9 @@ typedef struct _zend_function_entry { class_container.unserialize = NULL; \ class_container.create_object = NULL; \ class_container.interface_gets_implemented = NULL; \ + class_container.get_static_method = NULL; \ class_container.__call = handle_fcall; \ + class_container.__callstatic = NULL; \ class_container.__tostring = NULL; \ class_container.__get = handle_propget; \ class_container.__set = handle_propset; \ @@ -157,7 +197,14 @@ typedef struct _zend_function_entry { } #define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \ - INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL) + INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, sizeof(class_name)-1, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL) + +#define INIT_NS_CLASS_ENTRY(class_container, ns, class_name, functions) \ + INIT_CLASS_ENTRY(class_container, ZEND_NS_NAME(ns, class_name), functions) +#define INIT_OVERLOADED_NS_CLASS_ENTRY_EX(class_container, ns, class_name, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ + INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, ZEND_NS_NAME(ns, class_name), sizeof(ZEND_NS_NAME(ns, class_name))-1, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) +#define INIT_OVERLOADED_NS_CLASS_ENTRY(class_container, ns, class_name, functions, handle_fcall, handle_propget, handle_propset) \ + INIT_OVERLOADED_CLASS_ENTRY(class_container, ZEND_NS_NAME(ns, class_name), functions, handle_fcall, handle_propget, handle_propset) #ifdef ZTS # define CE_STATIC_MEMBERS(ce) (((ce)->type==ZEND_USER_CLASS)?(ce)->static_members:CG(static_members)[(zend_intptr_t)(ce)->static_members]) @@ -165,12 +212,14 @@ typedef struct _zend_function_entry { # define CE_STATIC_MEMBERS(ce) ((ce)->static_members) #endif +#define ZEND_FCI_INITIALIZED(fci) ((fci).size != 0) + int zend_next_free_module(void); BEGIN_EXTERN_C() ZEND_API int zend_get_parameters(int ht, int param_count, ...); ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC); -ZEND_API int zend_get_parameters_ex(int param_count, ...); +ZEND_API ZEND_ATTRIBUTE_DEPRECATED int zend_get_parameters_ex(int param_count, ...); ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC); /* internal function to efficiently copy parameters when executing __call() */ @@ -180,34 +229,42 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TS _zend_get_parameters_array(ht, param_count, argument_array TSRMLS_CC) #define zend_get_parameters_array_ex(param_count, argument_array) \ _zend_get_parameters_array_ex(param_count, argument_array TSRMLS_CC) - +#define zend_parse_parameters_none() \ + zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") /* Parameter parsing API -- andrei */ #define ZEND_PARSE_PARAMS_QUIET 1<<1 ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...); ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...); -ZEND_API char *zend_zval_type_name(zval *arg); +ZEND_API char *zend_zval_type_name(const zval *arg); ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...); ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...); /* End of parameter parsing API -- andrei */ -ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC); -ZEND_API void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC); +ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC); +ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC); ZEND_API int zend_startup_module(zend_module_entry *module_entry); ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry TSRMLS_DC); ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC); ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC); ZEND_API int zend_startup_modules(TSRMLS_D); -ZEND_API void zend_check_magic_method_implementation(zend_class_entry *ce, zend_function *fptr, int error_type TSRMLS_DC); +ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, int error_type TSRMLS_DC); ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC); ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC); ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC); ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...); +ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_class_entry *ce TSRMLS_DC); + +#define zend_register_class_alias(name, ce) \ + zend_register_class_alias_ex(name, sizeof(name)-1, ce TSRMLS_DC) +#define zend_register_ns_class_alias(ns, name, ce) \ + zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce TSRMLS_DC) + ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC); ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC); @@ -216,16 +273,17 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D); #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 zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC); -ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name); +ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC); +ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name TSRMLS_DC); ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC); -ZEND_API char *zend_get_module_version(char *module_name); -ZEND_API int zend_get_module_started(char *module_name); +ZEND_API const char *zend_get_module_version(const char *module_name); +ZEND_API int zend_get_module_started(const char *module_name); ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC); +ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC); ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC); ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC); ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC); @@ -233,13 +291,13 @@ ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC); ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC); -ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, size_t name_length TSRMLS_DC); -ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC); -ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC); +ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC); +ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, long value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC); +ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value TSRMLS_DC); ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC); ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC); @@ -247,23 +305,23 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC); ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC); ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC); -ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC); -ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC); +ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value TSRMLS_DC); +ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value, int value_length TSRMLS_DC); ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC); ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC); ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC); ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC); ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC); -ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC); -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_length TSRMLS_DC); +ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, const char *value TSRMLS_DC); +ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, const char *value, int value_length TSRMLS_DC); ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC); ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC); -ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC); -ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC); +ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC); +ZEND_API int zend_get_object_classname(const zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC); ZEND_API char *zend_get_type_by_const(int type); #define getThis() (this_ptr) @@ -279,11 +337,12 @@ ZEND_API char *zend_get_type_by_const(int type); #define DLEXPORT #endif -#define array_init(arg) _array_init((arg) ZEND_FILE_LINE_CC) +#define array_init(arg) _array_init((arg), 0 ZEND_FILE_LINE_CC) +#define array_init_size(arg, size) _array_init((arg), (size) ZEND_FILE_LINE_CC) #define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC TSRMLS_CC) #define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC TSRMLS_CC) #define object_and_properties_init(arg, ce, properties) _object_and_properties_init((arg), (ce), (properties) ZEND_FILE_LINE_CC TSRMLS_CC) -ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC); +ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC); ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC); ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC TSRMLS_DC); ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC); @@ -291,16 +350,16 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTa ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC); /* no longer supported */ -ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)); +ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)); -ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n); -ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len); -ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b); -ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r); -ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d); -ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate); -ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate); -ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value); +ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n); +ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len); +ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b); +ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r); +ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d); +ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate); +ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate); +ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value); #define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n) #define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1) @@ -322,8 +381,8 @@ ZEND_API int add_index_null(zval *arg, ulong idx); ZEND_API int add_index_bool(zval *arg, ulong idx, int b); ZEND_API int add_index_resource(zval *arg, ulong idx, int r); ZEND_API int add_index_double(zval *arg, ulong idx, double d); -ZEND_API int add_index_string(zval *arg, ulong idx, char *str, int duplicate); -ZEND_API int add_index_stringl(zval *arg, ulong idx, char *str, uint length, int duplicate); +ZEND_API int add_index_string(zval *arg, ulong idx, const char *str, int duplicate); +ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate); ZEND_API int add_index_zval(zval *arg, ulong index, zval *value); ZEND_API int add_next_index_long(zval *arg, long n); @@ -331,29 +390,29 @@ ZEND_API int add_next_index_null(zval *arg); ZEND_API int add_next_index_bool(zval *arg, int b); ZEND_API int add_next_index_resource(zval *arg, int r); ZEND_API int add_next_index_double(zval *arg, double d); -ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate); -ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate); +ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate); +ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate); ZEND_API int add_next_index_zval(zval *arg, zval *value); -ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate); -ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate); +ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate); +ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate); #define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate) #define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate) ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest); ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest); -ZEND_API int add_get_index_string(zval *arg, ulong idx, char *str, void **dest, int duplicate); -ZEND_API int add_get_index_stringl(zval *arg, ulong idx, char *str, uint length, void **dest, int duplicate); - -ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC); -ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC); -ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC); -ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long r TSRMLS_DC); -ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC); -ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC); -ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC); -ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC); +ZEND_API int add_get_index_string(zval *arg, ulong idx, const char *str, void **dest, int duplicate); +ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, void **dest, int duplicate); + +ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long l TSRMLS_DC); +ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC); +ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC); +ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, long r TSRMLS_DC); +ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC); +ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate TSRMLS_DC); +ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC); +ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC); #define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC) #define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC) @@ -367,29 +426,9 @@ ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *valu ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC); ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC); -END_EXTERN_C() - -typedef struct _zend_fcall_info { - size_t size; - HashTable *function_table; - zval *function_name; - HashTable *symbol_table; - zval **retval_ptr_ptr; - zend_uint param_count; - zval ***params; - zval **object_pp; - zend_bool no_separation; -} zend_fcall_info; - -typedef struct _zend_fcall_info_cache { - zend_bool initialized; - zend_function *function_handler; - zend_class_entry *calling_scope; - zval **object_pp; -} zend_fcall_info_cache; -BEGIN_EXTERN_C() -ZEND_API extern zend_fcall_info_cache empty_fcall_info_cache; +ZEND_API extern const zend_fcall_info empty_fcall_info; +ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache; /** Build zend_call_info/cache from a zval* * @@ -398,14 +437,48 @@ ZEND_API extern zend_fcall_info_cache empty_fcall_info_cache; * In order to pass parameters the following members need to be set: * 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, uint check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, char **callable_name, char **error TSRMLS_DC); + +/** Clear argumens connected with zend_fcall_info *fci + * If free_mem is not zero then the params array gets free'd as well + */ +ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem); + +/** Save current arguments from zend_fcall_info *fci + * params array will be set to NULL + */ +ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, int *param_count, zval ****params); + +/** Free arguments connected with zend_fcall_info *fci andset back saved ones. */ -ZEND_API int zend_fcall_info_init(zval *callable, zend_fcall_info *fci, zend_fcall_info_cache *fcc TSRMLS_DC); +ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count, zval ***params); /** Set or clear the arguments in the zend_call_info struct taking care of * refcount. If args is NULL and arguments are set then those are cleared. */ ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC); +/** Set arguments in the zend_fcall_info struct taking care of refcount. + * If argc is 0 the arguments which are set will be cleared, else pass + * a variable amount of zval** arguments. + */ +ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval ***argv); + +/** Set arguments in the zend_fcall_info struct taking care of refcount. + * If argc is 0 the arguments which are set will be cleared, else pass + * a variable amount of zval** arguments. + */ +ZEND_API int zend_fcall_info_argv(zend_fcall_info *fci TSRMLS_DC, int argc, va_list *argv); + +/** Set arguments in the zend_fcall_info struct taking care of refcount. + * If argc is 0 the arguments which are set will be cleared, else pass + * a variable amount of zval** arguments. + */ +ZEND_API int zend_fcall_info_argn(zend_fcall_info *fci TSRMLS_DC, int argc, ...); + /** Call a function using information created by zend_fcall_info_init()/args(). * If args is given then those replace the arguement info in fci is temporarily. */ @@ -413,14 +486,14 @@ ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *f ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC); - -ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, - zend_bool is_ref, int num_symbol_tables, ...); +ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...); ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC); ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC); +ZEND_API void zend_rebuild_symbol_table(TSRMLS_D); + #define add_method(arg, key, method) add_assoc_function((arg), (key), (method)) ZEND_API ZEND_FUNCTION(display_disabled_function); @@ -429,9 +502,9 @@ END_EXTERN_C() #if ZEND_DEBUG #define CHECK_ZVAL_STRING(z) \ - if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", (z)->value.str.val); } + if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); } #define CHECK_ZVAL_STRING_REL(z) \ - if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (z)->value.str.val ZEND_FILE_LINE_RELAY_CC); } + if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); } #else #define CHECK_ZVAL_STRING(z) #define CHECK_ZVAL_STRING_REL(z) @@ -462,41 +535,40 @@ END_EXTERN_C() } #define ZVAL_STRING(z, s, duplicate) { \ - char *__s=(s); \ - (z)->value.str.len = strlen(__s); \ - (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \ - (z)->type = IS_STRING; \ + const char *__s=(s); \ + Z_STRLEN_P(z) = strlen(__s); \ + Z_STRVAL_P(z) = (duplicate?estrndup(__s, Z_STRLEN_P(z)):(char*)__s);\ + Z_TYPE_P(z) = IS_STRING; \ } #define ZVAL_STRINGL(z, s, l, duplicate) { \ - char *__s=(s); int __l=l; \ - (z)->value.str.len = __l; \ - (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \ - (z)->type = IS_STRING; \ + const char *__s=(s); int __l=l; \ + Z_STRLEN_P(z) = __l; \ + Z_STRVAL_P(z) = (duplicate?estrndup(__s, __l):(char*)__s);\ + Z_TYPE_P(z) = IS_STRING; \ } -#define ZVAL_EMPTY_STRING(z) { \ - (z)->value.str.len = 0; \ - (z)->value.str.val = STR_EMPTY_ALLOC(); \ - (z)->type = IS_STRING; \ +#define ZVAL_EMPTY_STRING(z) { \ + Z_STRLEN_P(z) = 0; \ + Z_STRVAL_P(z) = STR_EMPTY_ALLOC();\ + Z_TYPE_P(z) = IS_STRING; \ } -#define ZVAL_ZVAL(z, zv, copy, dtor) { \ - int is_ref, refcount; \ - is_ref = (z)->is_ref; \ - refcount = (z)->refcount; \ - *(z) = *(zv); \ - if (copy) { \ - zval_copy_ctor(z); \ - } \ - if (dtor) { \ - if (!copy) { \ - ZVAL_NULL(zv); \ - } \ - zval_ptr_dtor(&zv); \ - } \ - (z)->is_ref = is_ref; \ - (z)->refcount = refcount; \ +#define ZVAL_ZVAL(z, zv, copy, dtor) { \ + zend_uchar is_ref = Z_ISREF_P(z); \ + zend_uint refcount = Z_REFCOUNT_P(z); \ + *(z) = *(zv); \ + if (copy) { \ + zval_copy_ctor(z); \ + } \ + if (dtor) { \ + if (!copy) { \ + ZVAL_NULL(zv); \ + } \ + zval_ptr_dtor(&zv); \ + } \ + Z_SET_ISREF_TO_P(z, is_ref); \ + Z_SET_REFCOUNT_P(z, refcount); \ } #define ZVAL_FALSE(z) ZVAL_BOOL(z, 0) @@ -576,19 +648,19 @@ END_EXTERN_C() \ if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \ && PZVAL_IS_REF(*orig_var)) { \ - (var)->refcount = (*orig_var)->refcount; \ - (var)->is_ref = 1; \ + Z_SET_REFCOUNT_P(var, Z_REFCOUNT_PP(orig_var)); \ + Z_SET_ISREF_P(var); \ \ if (_refcount) { \ - (var)->refcount += _refcount-1; \ + Z_SET_REFCOUNT_P(var, Z_REFCOUNT_P(var) + _refcount - 1); \ } \ zval_dtor(*orig_var); \ **orig_var = *(var); \ - FREE_ZVAL(var); \ + FREE_ZVAL(var); \ } else { \ - (var)->is_ref = _is_ref; \ + Z_SET_ISREF_TO_P(var, _is_ref); \ if (_refcount) { \ - (var)->refcount = _refcount; \ + Z_SET_REFCOUNT_P(var, _refcount); \ } \ zend_hash_update(symtable, (name), (name_length), &(var), sizeof(zval *), NULL); \ } \ @@ -598,10 +670,10 @@ END_EXTERN_C() #define ZEND_SET_GLOBAL_VAR(name, var) \ ZEND_SET_SYMBOL(&EG(symbol_table), name, var) -#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \ +#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \ ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var, _refcount, _is_ref) -#define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \ +#define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \ { \ char *_name = (name); \ int namelen = strlen(_name); \ diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 942b0d173..870171207 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_alloc.c,v 1.144.2.3.2.54 2009/01/25 14:04:09 dsp Exp $ */ +/* $Id: zend_alloc.c,v 1.144.2.3.2.43.2.22 2009/03/20 11:23:00 dmitry Exp $ */ #include "zend.h" #include "zend_alloc.h" @@ -33,7 +33,6 @@ #endif #ifdef ZEND_WIN32 -# define _WIN32_WINNT 0x0400 # include # include #endif @@ -79,12 +78,7 @@ void zend_debug_alloc_output(char *format, ...) #endif #if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) -# define EXPECTED(condition) __builtin_expect(condition, 1) -# define UNEXPECTED(condition) __builtin_expect(condition, 0) static void zend_mm_panic(const char *message) __attribute__ ((noreturn)); -#else -# define EXPECTED(condition) (condition) -# define UNEXPECTED(condition) (condition) #endif static void zend_mm_panic(const char *message) @@ -115,8 +109,12 @@ static void zend_mm_panic(const char *message) #if defined(HAVE_MEM_MMAP_ANON) || defined(HAVE_MEM_MMAP_ZERO) # ifdef HAVE_MREMAP +# ifndef _GNU_SOURCE # define _GNU_SOURCE +# endif +# ifndef __USE_GNU # define __USE_GNU +# endif # endif # include # ifndef MAP_ANON @@ -142,6 +140,10 @@ static void zend_mm_mem_dummy_dtor(zend_mm_storage *storage) free(storage); } +static void zend_mm_mem_dummy_compact(zend_mm_storage *storage) +{ +} + #if defined(HAVE_MEM_MMAP_ANON) || defined(HAVE_MEM_MMAP_ZERO) static zend_mm_segment* zend_mm_mem_mmap_realloc(zend_mm_storage *storage, zend_mm_segment* segment, size_t size) @@ -180,7 +182,7 @@ static zend_mm_segment* zend_mm_mem_mmap_anon_alloc(zend_mm_storage *storage, si return ret; } -# define ZEND_MM_MEM_MMAP_ANON_DSC {"mmap_anon", zend_mm_mem_dummy_init, zend_mm_mem_dummy_dtor, zend_mm_mem_mmap_anon_alloc, zend_mm_mem_mmap_realloc, zend_mm_mem_mmap_free} +# define ZEND_MM_MEM_MMAP_ANON_DSC {"mmap_anon", zend_mm_mem_dummy_init, zend_mm_mem_dummy_dtor, zend_mm_mem_dummy_compact, zend_mm_mem_mmap_anon_alloc, zend_mm_mem_mmap_realloc, zend_mm_mem_mmap_free} #endif @@ -215,7 +217,7 @@ static zend_mm_segment* zend_mm_mem_mmap_zero_alloc(zend_mm_storage *storage, si return ret; } -# define ZEND_MM_MEM_MMAP_ZERO_DSC {"mmap_zero", zend_mm_mem_mmap_zero_init, zend_mm_mem_mmap_zero_dtor, zend_mm_mem_mmap_zero_alloc, zend_mm_mem_mmap_realloc, zend_mm_mem_mmap_free} +# define ZEND_MM_MEM_MMAP_ZERO_DSC {"mmap_zero", zend_mm_mem_mmap_zero_init, zend_mm_mem_mmap_zero_dtor, zend_mm_mem_dummy_compact, zend_mm_mem_mmap_zero_alloc, zend_mm_mem_mmap_realloc, zend_mm_mem_mmap_free} #endif @@ -240,6 +242,12 @@ static void zend_mm_mem_win32_dtor(zend_mm_storage *storage) free(storage); } +static void zend_mm_mem_win32_compact(zend_mm_storage *storage) +{ + HeapDestroy((HANDLE)storage->data); + storage->data = (void*)HeapCreate(HEAP_NO_SERIALIZE, 0, 0); +} + static zend_mm_segment* zend_mm_mem_win32_alloc(zend_mm_storage *storage, size_t size) { return (zend_mm_segment*) HeapAlloc((HANDLE)storage->data, HEAP_NO_SERIALIZE, size); @@ -255,7 +263,7 @@ static zend_mm_segment* zend_mm_mem_win32_realloc(zend_mm_storage *storage, zend return (zend_mm_segment*) HeapReAlloc((HANDLE)storage->data, HEAP_NO_SERIALIZE, segment, size); } -# define ZEND_MM_MEM_WIN32_DSC {"win32", zend_mm_mem_win32_init, zend_mm_mem_win32_dtor, zend_mm_mem_win32_alloc, zend_mm_mem_win32_realloc, zend_mm_mem_win32_free} +# define ZEND_MM_MEM_WIN32_DSC {"win32", zend_mm_mem_win32_init, zend_mm_mem_win32_dtor, zend_mm_mem_win32_compact, zend_mm_mem_win32_alloc, zend_mm_mem_win32_realloc, zend_mm_mem_win32_free} #endif @@ -276,7 +284,7 @@ static void zend_mm_mem_malloc_free(zend_mm_storage *storage, zend_mm_segment *p free(ptr); } -# define ZEND_MM_MEM_MALLOC_DSC {"malloc", zend_mm_mem_dummy_init, zend_mm_mem_dummy_dtor, zend_mm_mem_malloc_alloc, zend_mm_mem_malloc_realloc, zend_mm_mem_malloc_free} +# define ZEND_MM_MEM_MALLOC_DSC {"malloc", zend_mm_mem_dummy_init, zend_mm_mem_dummy_dtor, zend_mm_mem_dummy_compact, zend_mm_mem_malloc_alloc, zend_mm_mem_malloc_realloc, zend_mm_mem_malloc_free} #endif @@ -385,7 +393,7 @@ typedef struct _zend_mm_free_block { #define ZEND_MM_NUM_BUCKETS (sizeof(size_t) << 3) #define ZEND_MM_CACHE 1 -#define ZEND_MM_CACHE_SIZE (ZEND_MM_NUM_BUCKETS * 2 * 1024) +#define ZEND_MM_CACHE_SIZE (ZEND_MM_NUM_BUCKETS * 4 * 1024) #ifndef ZEND_MM_CACHE_STAT # define ZEND_MM_CACHE_STAT 0 @@ -393,6 +401,9 @@ typedef struct _zend_mm_free_block { struct _zend_mm_heap { int use_zend_alloc; + void *(*_malloc)(size_t); + void (*_free)(void*); + void *(*_realloc)(void*, size_t); size_t free_bitmap; size_t large_free_bitmap; size_t block_size; @@ -1189,7 +1200,7 @@ static long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b) return leaks; } -static void zend_mm_check_leaks(zend_mm_heap *heap) +static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC) { zend_mm_segment *segment = heap->segments_list; zend_mm_block *p, *q; @@ -1220,12 +1231,12 @@ static void zend_mm_check_leaks(zend_mm_heap *heap) leak.orig_filename = p->debug.orig_filename; leak.orig_lineno = p->debug.orig_lineno; - zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL); - zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak); + zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC); + zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak TSRMLS_CC); repeated = zend_mm_find_leaks(segment, p); total += 1 + repeated; if (repeated) { - zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated); + zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated TSRMLS_CC); } #if ZEND_MM_CACHE } else if (p->magic == MEM_BLOCK_CACHED) { @@ -1245,7 +1256,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap) p = q; } if (total) { - zend_message_dispatcher(ZMSG_MEMORY_LEAKS_GRAND_TOTAL, &total); + zend_message_dispatcher(ZMSG_MEMORY_LEAKS_GRAND_TOTAL, &total TSRMLS_CC); } } @@ -1264,7 +1275,9 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE no_cache_notice = 1; } if (!silent) { - zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL); + TSRMLS_FETCH(); + + zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC); zend_debug_alloc_output("---------------------------------------\n"); zend_debug_alloc_output("%s(%d) : Block "PTR_FMT" status:\n" ZEND_FILE_LINE_RELAY_CC, ptr); if (__zend_orig_filename) { @@ -1513,7 +1526,7 @@ static int zend_mm_check_heap(zend_mm_heap *heap, int silent ZEND_FILE_LINE_DC Z } #endif -ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent) +ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent TSRMLS_DC) { zend_mm_storage *storage; zend_mm_segment *segment; @@ -1577,7 +1590,7 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent #if ZEND_DEBUG if (!silent) { - zend_mm_check_leaks(heap); + zend_mm_check_leaks(heap TSRMLS_CC); } #endif @@ -1595,17 +1608,10 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent free(heap); } } else { -#ifdef HAVE_MEM_WIN32 - /* FIX for bug #41713 */ - /* TODO: add new "compact" handler */ if (heap->compact_size && - heap->real_peak > heap->compact_size && - storage->handlers->dtor == zend_mm_mem_win32_dtor && - storage->handlers->init == zend_mm_mem_win32_init) { - HeapDestroy((HANDLE)storage->data); - storage->data = (void*)HeapCreate(HEAP_NO_SERIALIZE, 0, 0); + heap->real_peak > heap->compact_size) { + storage->handlers->compact(storage); } -#endif heap->segments_list = NULL; zend_mm_init(heap); heap->real_size = 0; @@ -2290,7 +2296,7 @@ ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) TSRMLS_FETCH(); if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) { - return malloc(size); + return AG(mm_heap)->_malloc(size); } return _zend_mm_alloc_int(AG(mm_heap), size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); } @@ -2300,7 +2306,7 @@ ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) TSRMLS_FETCH(); if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) { - free(ptr); + AG(mm_heap)->_free(ptr); return; } _zend_mm_free_int(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); @@ -2311,7 +2317,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN TSRMLS_FETCH(); if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) { - return realloc(ptr, size); + return AG(mm_heap)->_realloc(ptr, size); } return _zend_mm_realloc_int(AG(mm_heap), ptr, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); } @@ -2364,6 +2370,19 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) return res; } +#elif SIZEOF_SIZE_T == 4 && defined(HAVE_ZEND_LONG64) + +static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) +{ + zend_ulong64 res = (zend_ulong64)nmemb * (zend_ulong64)size + (zend_ulong64)offset; + + if (UNEXPECTED(res > (zend_ulong64)0xFFFFFFFFL)) { + zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset); + return 0; + } + return (size_t) res; +} + #else static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) @@ -2487,7 +2506,7 @@ ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC) ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC) { - zend_mm_shutdown(AG(mm_heap), full_shutdown, silent); + zend_mm_shutdown(AG(mm_heap), full_shutdown, silent TSRMLS_CC); } static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC) @@ -2498,6 +2517,11 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC) tmp = getenv("USE_ZEND_ALLOC"); if (tmp) { alloc_globals->mm_heap->use_zend_alloc = zend_atoi(tmp, 0); + if (!alloc_globals->mm_heap->use_zend_alloc) { + alloc_globals->mm_heap->_malloc = malloc; + alloc_globals->mm_heap->_free = free; + alloc_globals->mm_heap->_realloc = realloc; + } } } @@ -2531,6 +2555,17 @@ ZEND_API zend_mm_storage *zend_mm_get_storage(zend_mm_heap *heap) return heap->storage; } +ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap, + void* (*_malloc)(size_t), + void (*_free)(void*), + void* (*_realloc)(void*, size_t)) +{ + heap->use_zend_alloc = 0; + heap->_malloc = _malloc; + heap->_free = _free; + heap->_realloc = _realloc; +} + #if ZEND_DEBUG ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index 75c0c3f64..bd284ac8b 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_alloc.h,v 1.63.2.2.2.17 2009/01/25 13:42:39 dsp Exp $ */ +/* $Id: zend_alloc.h,v 1.63.2.2.2.12.2.9 2009/01/25 13:41:50 dsp Exp $ */ #ifndef ZEND_ALLOC_H #define ZEND_ALLOC_H @@ -191,7 +191,7 @@ END_EXTERN_C() typedef struct _zend_mm_heap zend_mm_heap; ZEND_API zend_mm_heap *zend_mm_startup(void); -ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent); +ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent TSRMLS_DC); ZEND_API void *_zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; ZEND_API void _zend_mm_free(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); ZEND_API void *_zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); @@ -219,6 +219,7 @@ typedef struct _zend_mm_mem_handlers { const char *name; zend_mm_storage* (*init)(void *params); void (*dtor)(zend_mm_storage *storage); + void (*compact)(zend_mm_storage *storage); zend_mm_segment* (*_alloc)(zend_mm_storage *storage, size_t size); zend_mm_segment* (*_realloc)(zend_mm_storage *storage, zend_mm_segment *ptr, size_t size); void (*_free)(zend_mm_storage *storage, zend_mm_segment *ptr); @@ -233,6 +234,11 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers, ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap TSRMLS_DC); ZEND_API zend_mm_storage *zend_mm_get_storage(zend_mm_heap *heap); +ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap, + void* (*_malloc)(size_t), + void (*_free)(void*), + void* (*_realloc)(void*, size_t)); + #endif /* diff --git a/Zend/zend_arg_defs.c b/Zend/zend_arg_defs.c deleted file mode 100644 index 78e18b723..000000000 --- a/Zend/zend_arg_defs.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998-2009 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: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id: zend_arg_defs.c,v 1.2.2.2.2.4 2008/12/31 11:17:33 sebastian Exp $ */ - -ZEND_BEGIN_ARG_INFO(first_arg_force_ref, 0) - ZEND_ARG_PASS_INFO(1) -ZEND_END_ARG_INFO(); - -ZEND_BEGIN_ARG_INFO(second_arg_force_ref, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(1) -ZEND_END_ARG_INFO(); - -ZEND_BEGIN_ARG_INFO(third_arg_force_ref, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(1) -ZEND_END_ARG_INFO(); - -ZEND_BEGIN_ARG_INFO(fourth_arg_force_ref, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(1) -ZEND_END_ARG_INFO(); - -ZEND_BEGIN_ARG_INFO(fifth_arg_force_ref, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(1) -ZEND_END_ARG_INFO(); - -ZEND_BEGIN_ARG_INFO(all_args_by_ref, 1) -ZEND_END_ARG_INFO(); diff --git a/Zend/zend_build.h b/Zend/zend_build.h new file mode 100755 index 000000000..4c81fccb7 --- /dev/null +++ b/Zend/zend_build.h @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2009 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: Stanislav Malyshev | + +----------------------------------------------------------------------+ +*/ + +#ifndef ZEND_BUILD_H +#define ZEND_BUILD_H + +#define ZEND_TOSTR_(x) #x +#define ZEND_TOSTR(x) ZEND_TOSTR_(x) + +#ifdef ZTS +#define ZEND_BUILD_TS ",TS" +#else +#define ZEND_BUILD_TS ",NTS" +#endif + +#if ZEND_DEBUG +#define ZEND_BUILD_DEBUG ",debug" +#else +#define ZEND_BUILD_DEBUG +#endif + +#if defined(ZEND_WIN32) && defined(PHP_COMPILER_ID) +#define ZEND_BUILD_SYSTEM "," PHP_COMPILER_ID +#else +#define ZEND_BUILD_SYSTEM +#endif + +/* for private applications */ +#define ZEND_BUILD_EXTRA + +#endif diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index c5525ea85..a33b66c36 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.33 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.25.2.47 2009/03/16 09:51:31 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -33,7 +33,7 @@ static ZEND_FUNCTION(zend_version); static ZEND_FUNCTION(func_num_args); static ZEND_FUNCTION(func_get_arg); static ZEND_FUNCTION(func_get_args); -static ZEND_NAMED_FUNCTION(zend_if_strlen); +static ZEND_FUNCTION(strlen); static ZEND_FUNCTION(strcmp); static ZEND_FUNCTION(strncmp); static ZEND_FUNCTION(strcasecmp); @@ -43,12 +43,14 @@ static ZEND_FUNCTION(error_reporting); static ZEND_FUNCTION(define); static ZEND_FUNCTION(defined); static ZEND_FUNCTION(get_class); +static ZEND_FUNCTION(get_called_class); static ZEND_FUNCTION(get_parent_class); static ZEND_FUNCTION(method_exists); static ZEND_FUNCTION(property_exists); static ZEND_FUNCTION(class_exists); static ZEND_FUNCTION(interface_exists); static ZEND_FUNCTION(function_exists); +static ZEND_FUNCTION(class_alias); #if ZEND_DEBUG static ZEND_FUNCTION(leak); #ifdef ZEND_TEST_EXCEPTIONS @@ -84,77 +86,239 @@ static ZEND_FUNCTION(zend_test_func); static ZEND_FUNCTION(zend_thread_id); #endif #endif +static ZEND_FUNCTION(gc_collect_cycles); +static ZEND_FUNCTION(gc_enabled); +static ZEND_FUNCTION(gc_enable); +static ZEND_FUNCTION(gc_disable); + +/* {{{ 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, 3) + 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_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_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_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, messsage) + 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_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_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, provide_object) +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_arg_defs.c" - - -static zend_function_entry builtin_functions[] = { - ZEND_FE(zend_version, NULL) - ZEND_FE(func_num_args, NULL) - ZEND_FE(func_get_arg, NULL) - ZEND_FE(func_get_args, NULL) - { "strlen", zend_if_strlen, NULL }, - ZEND_FE(strcmp, NULL) - ZEND_FE(strncmp, NULL) - ZEND_FE(strcasecmp, NULL) - ZEND_FE(strncasecmp, NULL) - ZEND_FE(each, first_arg_force_ref) - ZEND_FE(error_reporting, NULL) - ZEND_FE(define, NULL) - ZEND_FE(defined, NULL) - ZEND_FE(get_class, NULL) - ZEND_FE(get_parent_class, NULL) - ZEND_FE(method_exists, NULL) - ZEND_FE(property_exists, NULL) - ZEND_FE(class_exists, NULL) - ZEND_FE(interface_exists, NULL) - ZEND_FE(function_exists, NULL) +static const zend_function_entry builtin_functions[] = { /* {{{ */ + ZEND_FE(zend_version, arginfo_zend__void) + ZEND_FE(func_num_args, arginfo_zend__void) + ZEND_FE(func_get_arg, arginfo_func_get_arg) + ZEND_FE(func_get_args, arginfo_zend__void) + 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(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(function_exists, arginfo_function_exists) + ZEND_FE(class_alias, arginfo_class_alias) #if ZEND_DEBUG ZEND_FE(leak, NULL) #ifdef ZEND_TEST_EXCEPTIONS ZEND_FE(crash, NULL) #endif #endif - ZEND_FE(get_included_files, NULL) - ZEND_FALIAS(get_required_files, get_included_files, NULL) - ZEND_FE(is_subclass_of, NULL) - ZEND_FE(is_a, NULL) - ZEND_FE(get_class_vars, NULL) - ZEND_FE(get_object_vars, NULL) - ZEND_FE(get_class_methods, NULL) - ZEND_FE(trigger_error, NULL) - ZEND_FALIAS(user_error, trigger_error, NULL) - ZEND_FE(set_error_handler, NULL) - ZEND_FE(restore_error_handler, NULL) - ZEND_FE(set_exception_handler, NULL) - ZEND_FE(restore_exception_handler, NULL) - ZEND_FE(get_declared_classes, NULL) - ZEND_FE(get_declared_interfaces, NULL) - ZEND_FE(get_defined_functions, NULL) - ZEND_FE(get_defined_vars, NULL) - ZEND_FE(create_function, NULL) - ZEND_FE(get_resource_type, NULL) - ZEND_FE(get_loaded_extensions, NULL) - ZEND_FE(extension_loaded, NULL) - ZEND_FE(get_extension_funcs, NULL) - ZEND_FE(get_defined_constants, NULL) - ZEND_FE(debug_backtrace, NULL) - ZEND_FE(debug_print_backtrace, NULL) + ZEND_FE(get_included_files, arginfo_zend__void) + ZEND_FALIAS(get_required_files, get_included_files, arginfo_zend__void) + ZEND_FE(is_subclass_of, arginfo_is_subclass_of) + ZEND_FE(is_a, arginfo_is_subclass_of) + ZEND_FE(get_class_vars, arginfo_get_class_vars) + ZEND_FE(get_object_vars, arginfo_get_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_FE(set_error_handler, arginfo_set_error_handler) + ZEND_FE(restore_error_handler, arginfo_zend__void) + 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_interfaces, arginfo_zend__void) + ZEND_FE(get_defined_functions, arginfo_zend__void) + ZEND_FE(get_defined_vars, arginfo_zend__void) + ZEND_FE(create_function, arginfo_create_function) + ZEND_FE(get_resource_type, arginfo_get_resource_type) + 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_defined_constants, arginfo_get_defined_constants) + ZEND_FE(debug_backtrace, arginfo_debug_backtrace) + ZEND_FE(debug_print_backtrace, arginfo_zend__void) #if ZEND_DEBUG ZEND_FE(zend_test_func, NULL) #ifdef ZTS ZEND_FE(zend_thread_id, NULL) #endif #endif + 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) { NULL, NULL, NULL } }; +/* }}} */ +ZEND_MINIT_FUNCTION(core) { /* {{{ */ + zend_class_entry class_entry; -int zend_startup_builtin_functions(TSRMLS_D) -{ - return zend_register_functions(NULL, builtin_functions, NULL, MODULE_PERSISTENT TSRMLS_CC); + INIT_CLASS_ENTRY(class_entry, "stdClass", NULL); + zend_standard_class_def = zend_register_internal_class(&class_entry TSRMLS_CC); + + zend_register_default_classes(TSRMLS_C); + + return SUCCESS; } +/* }}} */ +zend_module_entry zend_builtin_module = { /* {{{ */ + STANDARD_MODULE_HEADER, + "Core", + builtin_functions, + ZEND_MINIT(core), + NULL, + NULL, + NULL, + NULL, + ZEND_VERSION, + STANDARD_MODULE_PROPERTIES +}; +/* }}} */ + +int zend_startup_builtin_functions(TSRMLS_D) /* {{{ */ +{ + zend_builtin_module.module_number = 0; + zend_builtin_module.type = MODULE_PERSISTENT; + return (EG(current_module) = zend_register_module_ex(&zend_builtin_module TSRMLS_CC)) == NULL ? FAILURE : SUCCESS; +} +/* }}} */ /* {{{ proto string zend_version(void) Get the version of the Zend Engine */ @@ -164,23 +328,47 @@ ZEND_FUNCTION(zend_version) } /* }}} */ +/* {{{ proto int gc_collect_cycles(void) + Forces collection of any existing garbage cycles. + Returns number of freed zvals */ +ZEND_FUNCTION(gc_collect_cycles) +{ + RETURN_LONG(gc_collect_cycles(TSRMLS_C)); +} +/* }}} */ + +/* {{{ proto void gc_enabled(void) + Returns status of the circular reference collector */ +ZEND_FUNCTION(gc_enabled) +{ + RETURN_BOOL(GC_G(gc_enabled)); +} +/* }}} */ + +/* {{{ proto void gc_enable(void) + Activates the circular reference collector */ +ZEND_FUNCTION(gc_enable) +{ + zend_alter_ini_entry("zend.enable_gc", sizeof("zend.enable_gc"), "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); +} +/* }}} */ + +/* {{{ proto void gc_disable(void) + Deactivates the circular reference collector */ +ZEND_FUNCTION(gc_disable) +{ + zend_alter_ini_entry("zend.enable_gc", sizeof("zend.enable_gc"), "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); +} +/* }}} */ /* {{{ proto int func_num_args(void) Get the number of arguments that were passed to the function */ ZEND_FUNCTION(func_num_args) { - void **p; - int arg_count; + zend_execute_data *ex = EG(current_execute_data)->prev_execute_data; - p = EG(argument_stack).top_element-1-1; - arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_num_args(); */ - p -= 1+arg_count; - if (*p) { - zend_error(E_ERROR, "func_num_args(): Can't be used as a function parameter"); - } - --p; - if (p>=EG(argument_stack).elements) { - RETURN_LONG((long)(zend_uintptr_t) *p); + if (ex && ex->function_state.arguments) { + RETURN_LONG((long)(zend_uintptr_t)*(ex->function_state.arguments)); } else { zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context"); RETURN_LONG(-1); @@ -195,35 +383,28 @@ ZEND_FUNCTION(func_get_arg) { void **p; int arg_count; - zval **z_requested_offset; zval *arg; long requested_offset; + zend_execute_data *ex = EG(current_execute_data)->prev_execute_data; - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_requested_offset)==FAILURE) { - RETURN_FALSE; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &requested_offset) == FAILURE) { + return; } - convert_to_long_ex(z_requested_offset); - requested_offset = Z_LVAL_PP(z_requested_offset); if (requested_offset < 0) { zend_error(E_WARNING, "func_get_arg(): The argument number should be >= 0"); RETURN_FALSE; } - p = EG(argument_stack).top_element-1-1; - arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_get_arg(); */ - p -= 1+arg_count; - if (*p) { - zend_error(E_ERROR, "func_get_arg(): Can't be used as a function parameter"); - } - --p; - if (pfunction_state.arguments) { zend_error(E_WARNING, "func_get_arg(): Called from the global scope - no function context"); RETURN_FALSE; } - arg_count = (int)(zend_uintptr_t) *p; - if (requested_offset>=arg_count) { + p = ex->function_state.arguments; + arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_get_arg(); */ + + if (requested_offset >= arg_count) { zend_error(E_WARNING, "func_get_arg(): Argument %ld not passed to function", requested_offset); RETURN_FALSE; } @@ -243,23 +424,17 @@ ZEND_FUNCTION(func_get_args) void **p; int arg_count; int i; + zend_execute_data *ex = EG(current_execute_data)->prev_execute_data; - p = EG(argument_stack).top_element-1-1; - arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_get_args(); */ - p -= 1+arg_count; - if (*p) { - zend_error(E_ERROR, "func_get_args(): Can't be used as a function parameter"); - } - --p; - - if (pfunction_state.arguments) { zend_error(E_WARNING, "func_get_args(): Called from the global scope - no function context"); RETURN_FALSE; } - arg_count = (int)(zend_uintptr_t) *p; + p = ex->function_state.arguments; + arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_get_args(); */ - array_init(return_value); + array_init_size(return_value, arg_count); for (i=0; iis_ref) { + if (Z_ISREF_P(entry)) { ALLOC_ZVAL(tmp); *tmp = *entry; zval_copy_ctor(tmp); - tmp->is_ref=0; - tmp->refcount=0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); entry=tmp; } zend_hash_index_update(return_value->value.ht, 1, &entry, sizeof(zval *), NULL); - entry->refcount++; + Z_ADDREF_P(entry); zend_hash_update(return_value->value.ht, "value", sizeof("value"), &entry, sizeof(zval *), NULL); - entry->refcount++; + Z_ADDREF_P(entry); /* add the key elements */ switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 1, NULL)) { @@ -416,33 +590,27 @@ ZEND_FUNCTION(each) break; } zend_hash_update(return_value->value.ht, "key", sizeof("key"), inserted_pointer, sizeof(zval *), NULL); - (*inserted_pointer)->refcount++; + Z_ADDREF_PP(inserted_pointer); zend_hash_move_forward(target_hash); } /* }}} */ -/* {{{ proto int error_reporting(int new_error_level=null) +/* {{{ 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) { - zval **arg; + char *err; + int err_len; int old_error_reporting; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &err, &err_len) == FAILURE) { + return; + } + old_error_reporting = EG(error_reporting); - switch (ZEND_NUM_ARGS()) { - case 0: - break; - case 1: - if (zend_get_parameters_ex(1, &arg) == FAILURE) { - RETURN_FALSE; - } - convert_to_string_ex(arg); - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - break; - default: - ZEND_WRONG_PARAM_COUNT(); - break; + if(ZEND_NUM_ARGS() != 0) { + zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), err, err_len, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); } RETVAL_LONG(old_error_reporting); @@ -450,7 +618,7 @@ ZEND_FUNCTION(error_reporting) /* }}} */ -/* {{{ proto bool define(string constant_name, mixed value, boolean case_sensitive=true) +/* {{{ proto bool define(string constant_name, mixed value, boolean case_insensitive=false) Define a new constant */ ZEND_FUNCTION(define) { @@ -523,15 +691,15 @@ repeat: Check whether a constant exists */ ZEND_FUNCTION(defined) { - zval **var; + char *name; + int name_len; zval c; - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &var)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + return; } - convert_to_string_ex(var); - if (zend_get_constant(Z_STRVAL_PP(var), Z_STRLEN_PP(var), &c TSRMLS_CC)) { + if (zend_get_constant_ex(name, name_len, &c, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) { zval_dtor(&c); RETURN_TRUE; } else { @@ -545,12 +713,16 @@ ZEND_FUNCTION(defined) Retrieves the class name */ ZEND_FUNCTION(get_class) { - zval **arg; + zval *obj = NULL; char *name = ""; zend_uint name_len = 0; int dup; - if (!ZEND_NUM_ARGS()) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|o", &obj) == FAILURE) { + RETURN_FALSE; + } + + if (!obj) { if (EG(scope)) { RETURN_STRINGL(EG(scope)->name, EG(scope)->name_length, 1); } else { @@ -558,29 +730,45 @@ ZEND_FUNCTION(get_class) RETURN_FALSE; } } - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - if (Z_TYPE_PP(arg) != IS_OBJECT) { - RETURN_FALSE; - } - dup = zend_get_object_classname(*arg, &name, &name_len TSRMLS_CC); + dup = zend_get_object_classname(obj, &name, &name_len TSRMLS_CC); RETURN_STRINGL(name, name_len, dup); } /* }}} */ +/* {{{ proto string get_called_class() + Retrieves the "Late Static Binding" class name */ +ZEND_FUNCTION(get_called_class) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + if (EG(called_scope)) { + RETURN_STRINGL(EG(called_scope)->name, EG(called_scope)->name_length, 1); + } else if (!EG(scope)) { + zend_error(E_WARNING, "get_called_class() called from outside a class"); + } + RETURN_FALSE; +} +/* }}} */ + + /* {{{ proto string get_parent_class([mixed object]) Retrieves the parent class name for object or class or current scope. */ ZEND_FUNCTION(get_parent_class) { - zval **arg; + zval *arg; zend_class_entry *ce = NULL; char *name; zend_uint name_length; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) { + return; + } + if (!ZEND_NUM_ARGS()) { ce = EG(scope); if (ce && ce->parent) { @@ -589,21 +777,18 @@ ZEND_FUNCTION(get_parent_class) RETURN_FALSE; } } - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - if (Z_TYPE_PP(arg) == IS_OBJECT) { - if (Z_OBJ_HT_PP(arg)->get_class_name - && Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_length, 1 TSRMLS_CC) == SUCCESS) { + if (Z_TYPE_P(arg) == IS_OBJECT) { + if (Z_OBJ_HT_P(arg)->get_class_name + && Z_OBJ_HT_P(arg)->get_class_name(arg, &name, &name_length, 1 TSRMLS_CC) == SUCCESS) { RETURN_STRINGL(name, name_length, 0); } else { - ce = zend_get_class_entry(*arg TSRMLS_CC); + ce = zend_get_class_entry(arg TSRMLS_CC); } - } else if (Z_TYPE_PP(arg) == IS_STRING) { + } else if (Z_TYPE_P(arg) == IS_STRING) { zend_class_entry **pce; - if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &pce TSRMLS_CC) == SUCCESS) { + if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } } @@ -619,46 +804,46 @@ ZEND_FUNCTION(get_parent_class) static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) { - zval **obj, **class_name; + zval *obj; + char *class_name; + int class_name_len; zend_class_entry *instance_ce; zend_class_entry **ce; zend_bool retval; - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &obj, &class_name)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &obj, &class_name, &class_name_len) == FAILURE) { + return; } - - if (only_subclass && Z_TYPE_PP(obj) == IS_STRING) { + + if (only_subclass && Z_TYPE_P(obj) == IS_STRING) { zend_class_entry **the_ce; - if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &the_ce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) { zend_error(E_WARNING, "Unknown class passed as parameter"); RETURN_FALSE; } instance_ce = *the_ce; - } else if (Z_TYPE_PP(obj) != IS_OBJECT) { + } else if (Z_TYPE_P(obj) != IS_OBJECT) { RETURN_FALSE; } else { instance_ce = NULL; } /* TBI!! new object handlers */ - if (Z_TYPE_PP(obj) == IS_OBJECT && !HAS_CLASS_ENTRY(**obj)) { + if (Z_TYPE_P(obj) == IS_OBJECT && !HAS_CLASS_ENTRY(*obj)) { RETURN_FALSE; } - convert_to_string_ex(class_name); - - if (zend_lookup_class_ex(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), 0, &ce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class_ex(class_name, class_name_len, 0, &ce TSRMLS_CC) == FAILURE) { retval = 0; } else { if (only_subclass) { if (!instance_ce) { - instance_ce = Z_OBJCE_PP(obj)->parent; + instance_ce = Z_OBJCE_P(obj)->parent; } else { instance_ce = instance_ce->parent; } } else { - instance_ce = Z_OBJCE_PP(obj); + instance_ce = Z_OBJCE_P(obj); } if (!instance_ce) { @@ -689,7 +874,6 @@ ZEND_FUNCTION(is_subclass_of) Returns true if the object is of this class or has this class as one of its parents */ ZEND_FUNCTION(is_a) { - zend_error(E_STRICT, "is_a(): Deprecated. Please use the instanceof operator"); is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ @@ -738,7 +922,7 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re /* this is necessary to make it able to work with default array * properties, returned to user */ - if (Z_TYPE_P(prop_copy) == IS_CONSTANT_ARRAY || Z_TYPE_P(prop_copy) == IS_CONSTANT) { + if (Z_TYPE_P(prop_copy) == IS_CONSTANT_ARRAY || (Z_TYPE_P(prop_copy) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zval_update_constant(&prop_copy, 0 TSRMLS_CC); } @@ -777,7 +961,7 @@ ZEND_FUNCTION(get_class_vars) Returns an array of object properties */ ZEND_FUNCTION(get_object_vars) { - zval **obj; + zval *obj; zval **value; HashTable *properties; HashPosition pos; @@ -786,24 +970,21 @@ ZEND_FUNCTION(get_object_vars) ulong num_index; zend_object *zobj; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &obj) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) { + return; } - if (Z_TYPE_PP(obj) != IS_OBJECT) { - RETURN_FALSE; - } - if (Z_OBJ_HT_PP(obj)->get_properties == NULL) { + if (Z_OBJ_HT_P(obj)->get_properties == NULL) { RETURN_FALSE; } - properties = Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC); + properties = Z_OBJ_HT_P(obj)->get_properties(obj TSRMLS_CC); if (properties == NULL) { RETURN_FALSE; } - zobj = zend_objects_get_address(*obj TSRMLS_CC); + zobj = zend_objects_get_address(obj TSRMLS_CC); array_init(return_value); @@ -814,7 +995,7 @@ ZEND_FUNCTION(get_object_vars) if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) == SUCCESS) { zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name); /* Not separating references */ - (*value)->refcount++; + Z_ADDREF_PP(value); add_assoc_zval_ex(return_value, prop_name, strlen(prop_name)+1, *value); } } @@ -828,24 +1009,24 @@ ZEND_FUNCTION(get_object_vars) Returns an array of method names for class or class instance. */ ZEND_FUNCTION(get_class_methods) { - zval **class; + zval *klass; zval *method_name; zend_class_entry *ce = NULL, **pce; HashPosition pos; zend_function *mptr; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &klass) == FAILURE) { + return; } - if (Z_TYPE_PP(class) == IS_OBJECT) { + if (Z_TYPE_P(klass) == IS_OBJECT) { /* TBI!! new object handlers */ - if (!HAS_CLASS_ENTRY(**class)) { + if (!HAS_CLASS_ENTRY(*klass)) { RETURN_FALSE; } - ce = Z_OBJCE_PP(class); - } else if (Z_TYPE_PP(class) == IS_STRING) { - if (zend_lookup_class(Z_STRVAL_PP(class), Z_STRLEN_PP(class), &pce TSRMLS_CC) == SUCCESS) { + ce = Z_OBJCE_P(klass); + } else if (Z_TYPE_P(klass) == IS_STRING) { + if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } } @@ -890,17 +1071,19 @@ ZEND_FUNCTION(get_class_methods) Checks if the class method exists */ ZEND_FUNCTION(method_exists) { - zval **klass, **method_name; + zval *klass; + char *method_name; + int method_len; char *lcname; zend_class_entry * ce, **pce; - if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &klass, &method_name, &method_len) == FAILURE) { + return; } - if (Z_TYPE_PP(klass) == IS_OBJECT) { - ce = Z_OBJCE_PP(klass); - } else if (Z_TYPE_PP(klass) == IS_STRING) { - if (zend_lookup_class(Z_STRVAL_PP(klass), Z_STRLEN_PP(klass), &pce TSRMLS_CC) == FAILURE) { + if (Z_TYPE_P(klass) == IS_OBJECT) { + ce = Z_OBJCE_P(klass); + } else if (Z_TYPE_P(klass) == IS_STRING) { + if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == FAILURE) { RETURN_FALSE; } ce = *pce; @@ -908,18 +1091,17 @@ ZEND_FUNCTION(method_exists) RETURN_FALSE; } - convert_to_string_ex(method_name); - lcname = zend_str_tolower_dup(Z_STRVAL_PP(method_name), Z_STRLEN_PP(method_name)); - if (zend_hash_exists(&ce->function_table, lcname, Z_STRLEN_PP(method_name)+1)) { + lcname = zend_str_tolower_dup(method_name, method_len); + if (zend_hash_exists(&ce->function_table, lcname, method_len+1)) { efree(lcname); RETURN_TRUE; } else { union _zend_function *func = NULL; efree(lcname); - if (Z_TYPE_PP(klass) == IS_OBJECT - && Z_OBJ_HT_PP(klass)->get_method != NULL - && (func = Z_OBJ_HT_PP(klass)->get_method(klass, Z_STRVAL_PP(method_name), Z_STRLEN_PP(method_name) TSRMLS_CC)) != NULL + if (Z_TYPE_P(klass) == IS_OBJECT + && Z_OBJ_HT_P(klass)->get_method != NULL + && (func = Z_OBJ_HT_P(klass)->get_method(&klass, method_name, method_len TSRMLS_CC)) != NULL ) { if (func->type == ZEND_INTERNAL_FUNCTION && ((zend_internal_function*)func)->handler == zend_std_call_user_call @@ -939,63 +1121,50 @@ ZEND_FUNCTION(method_exists) Checks if the object or class has a property */ ZEND_FUNCTION(property_exists) { - zval **object, **property; + zval *object; + char *property; + int property_len; zend_class_entry *ce, **pce; zend_property_info *property_info; - char *prop_name, *class_name; + zval property_z; + ulong h; - if (ZEND_NUM_ARGS()!= 2 || zend_get_parameters_ex(2, &object, &property)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &object, &property, &property_len) == FAILURE) { + return; } - convert_to_string_ex(property); - if (!Z_STRLEN_PP(property)) { + + if (property_len == 0) { RETURN_FALSE; } - switch((*object)->type) { - case IS_STRING: - if (!Z_STRLEN_PP(object)) { - RETURN_FALSE; - } - if (zend_lookup_class(Z_STRVAL_PP(object), Z_STRLEN_PP(object), &pce TSRMLS_CC) == SUCCESS) { - ce = *pce; - } else { + if (Z_TYPE_P(object) == IS_STRING) { + if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) { RETURN_FALSE; } - if (!ce) { - RETURN_NULL(); - } - if (!(property_info = zend_get_property_info(ce, *property, 1 TSRMLS_CC)) || property_info == &EG(std_property_info)) { - RETURN_FALSE; - } - if (property_info->flags & ZEND_ACC_PUBLIC) { - RETURN_TRUE; - } - zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name); - if (!strncmp(class_name, "*", 1)) { - if (instanceof_function(EG(scope), ce TSRMLS_CC) || - (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC))) { - RETURN_TRUE; - } + ce = *pce; + } else if (Z_TYPE_P(object) == IS_OBJECT) { + ce = Z_OBJCE_P(object); + } else { + zend_error(E_WARNING, "First parameter must either be an object or the name of an existing class"); + RETURN_NULL(); + } + + h = zend_get_hash_value(property, property_len+1); + if (zend_hash_quick_find(&ce->properties_info, property, property_len+1, h, (void **) &property_info) == SUCCESS) { + if (property_info->flags & ZEND_ACC_SHADOW) { RETURN_FALSE; } - if (zend_lookup_class(Z_STRVAL_PP(object), Z_STRLEN_PP(object), &pce TSRMLS_CC) == SUCCESS) { - ce = *pce; - } else { - RETURN_FALSE; /* shouldn't happen */ - } - RETURN_BOOL(EG(scope) == ce); + RETURN_TRUE; + } - case IS_OBJECT: - if (Z_OBJ_HANDLER_PP(object, has_property) && Z_OBJ_HANDLER_PP(object, has_property)(*object, *property, 2 TSRMLS_CC)) { - RETURN_TRUE; - } - RETURN_FALSE; + ZVAL_STRINGL(&property_z, property, property_len, 0); - default: - zend_error(E_WARNING, "First parameter must either be an object or the name of an existing class"); - RETURN_NULL(); + if (Z_TYPE_P(object) == IS_OBJECT && + Z_OBJ_HANDLER_P(object, has_property) && + Z_OBJ_HANDLER_P(object, has_property)(object, &property_z, 2 TSRMLS_CC)) { + RETURN_TRUE; } + RETURN_FALSE; } /* }}} */ @@ -1016,11 +1185,22 @@ ZEND_FUNCTION(class_exists) } if (!autoload) { - lc_name = do_alloca_with_limit(class_name_len + 1, use_heap); + char *name; + int len; + + lc_name = do_alloca(class_name_len + 1, use_heap); zend_str_tolower_copy(lc_name, class_name, class_name_len); + + /* Ignore leading "\" */ + name = lc_name; + len = class_name_len; + if (lc_name[0] == '\\') { + name = &lc_name[1]; + len--; + } - found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce); - free_alloca_with_limit(lc_name, use_heap); + found = zend_hash_find(EG(class_table), name, len+1, (void **) &ce); + free_alloca(lc_name, use_heap); RETURN_BOOL(found == SUCCESS && !((*ce)->ce_flags & ZEND_ACC_INTERFACE)); } @@ -1048,11 +1228,22 @@ ZEND_FUNCTION(interface_exists) } if (!autoload) { - lc_name = do_alloca_with_limit(iface_name_len + 1, use_heap); + char *name; + int len; + + lc_name = do_alloca(iface_name_len + 1, use_heap); zend_str_tolower_copy(lc_name, iface_name, iface_name_len); - found = zend_hash_find(EG(class_table), lc_name, iface_name_len+1, (void **) &ce); - free_alloca_with_limit(lc_name, use_heap); + /* Ignore leading "\" */ + name = lc_name; + len = iface_name_len; + if (lc_name[0] == '\\') { + name = &lc_name[1]; + len--; + } + + found = zend_hash_find(EG(class_table), name, len+1, (void **) &ce); + free_alloca(lc_name, use_heap); RETURN_BOOL(found == SUCCESS && (*ce)->ce_flags & ZEND_ACC_INTERFACE); } @@ -1069,18 +1260,26 @@ ZEND_FUNCTION(interface_exists) Checks if the function exists */ ZEND_FUNCTION(function_exists) { - zval **function_name; + char *name; + int name_len; zend_function *func; char *lcname; zend_bool retval; - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + return; + } + + lcname = zend_str_tolower_dup(name, name_len); + + /* Ignore leading "\" */ + name = lcname; + if (lcname[0] == '\\') { + name = &lcname[1]; + name_len--; } - convert_to_string_ex(function_name); - lcname = zend_str_tolower_dup(Z_STRVAL_PP(function_name), Z_STRLEN_PP(function_name)); - retval = (zend_hash_find(EG(function_table), lcname, Z_STRLEN_PP(function_name)+1, (void **)&func) == SUCCESS); + retval = (zend_hash_find(EG(function_table), name, name_len+1, (void **)&func) == SUCCESS); efree(lcname); @@ -1097,19 +1296,58 @@ ZEND_FUNCTION(function_exists) } /* }}} */ +/* {{{ proto bool class_alias(string user_class_name , string alias_name [, bool autoload]) + Creates an alias for user defined class */ +ZEND_FUNCTION(class_alias) +{ + char *class_name, *lc_name, *alias_name; + zend_class_entry **ce; + int class_name_len, alias_name_len; + int found; + zend_bool autoload = 1; + ALLOCA_FLAG(use_heap) + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &class_name, &class_name_len, &alias_name, &alias_name_len, &autoload) == FAILURE) { + return; + } + + if (!autoload) { + lc_name = do_alloca(class_name_len + 1, use_heap); + zend_str_tolower_copy(lc_name, class_name, class_name_len); + + found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce); + free_alloca(lc_name, use_heap); + } else { + found = zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC); + } + if (found == SUCCESS) { + if ((*ce)->type == ZEND_USER_CLASS) { + if (zend_register_class_alias_ex(alias_name, alias_name_len, *ce TSRMLS_CC) == SUCCESS) { + RETURN_TRUE; + } else { + zend_error(E_WARNING, "Cannot redeclare class %s", alias_name); + RETURN_FALSE; + } + } else { + zend_error(E_WARNING, "First argument of class_alias() must be a name of user defined class"); + RETURN_FALSE; + } + } else { + zend_error(E_WARNING, "Class '%s' not found", class_name); + RETURN_FALSE; + } +} +/* }}} */ + #if ZEND_DEBUG /* {{{ proto void leak(int num_bytes=3) Cause an intentional memory leak, for testing/debugging purposes */ ZEND_FUNCTION(leak) { - int leakbytes=3; - zval **leak; + long leakbytes=3; - if (ZEND_NUM_ARGS()>=1) { - if (zend_get_parameters_ex(1, &leak)==SUCCESS) { - convert_to_long_ex(leak); - leakbytes = Z_LVAL_PP(leak); - } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &leakbytes) == FAILURE) { + return; } emalloc(leakbytes); @@ -1133,8 +1371,8 @@ ZEND_FUNCTION(crash) ZEND_FUNCTION(get_included_files) { char *entry; - if (ZEND_NUM_ARGS() != 0) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } array_init(return_value); @@ -1151,37 +1389,27 @@ ZEND_FUNCTION(get_included_files) Generates a user-level error/warning/notice message */ ZEND_FUNCTION(trigger_error) { - int error_type = E_USER_NOTICE; - zval **z_error_type, **z_error_message; + long error_type = E_USER_NOTICE; + char *message; + int message_len; - switch (ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters_ex(1, &z_error_message)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - break; - case 2: - if (zend_get_parameters_ex(2, &z_error_message, &z_error_type)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - convert_to_long_ex(z_error_type); - error_type = Z_LVAL_PP(z_error_type); - switch (error_type) { - case E_USER_ERROR: - case E_USER_WARNING: - case E_USER_NOTICE: - break; - default: - zend_error(E_WARNING, "Invalid error type specified"); - RETURN_FALSE; - break; - } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &message, &message_len, &error_type) == FAILURE) { + return; + } + + switch (error_type) { + case E_USER_ERROR: + case E_USER_WARNING: + case E_USER_NOTICE: + case E_USER_DEPRECATED: break; default: - ZEND_WRONG_PARAM_COUNT(); + zend_error(E_WARNING, "Invalid error type specified"); + RETURN_FALSE; + break; } - convert_to_string_ex(z_error_message); - zend_error(error_type, "%s", Z_STRVAL_PP(z_error_message)); + + zend_error((int)error_type, "%s", message); RETURN_TRUE; } /* }}} */ @@ -1200,7 +1428,7 @@ ZEND_FUNCTION(set_error_handler) return; } - if (!zend_is_callable(error_handler, 0, &error_handler_name)) { + if (!zend_is_callable(error_handler, 0, &error_handler_name TSRMLS_CC)) { zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback", get_active_function_name(TSRMLS_C), error_handler_name?error_handler_name:"unknown"); efree(error_handler_name); @@ -1263,16 +1491,16 @@ ZEND_FUNCTION(restore_error_handler) Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */ ZEND_FUNCTION(set_exception_handler) { - zval **exception_handler; + zval *exception_handler; char *exception_handler_name = NULL; zend_bool had_orig_exception_handler=0; - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &exception_handler)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &exception_handler) == FAILURE) { + return; } - if (Z_TYPE_PP(exception_handler) != IS_NULL) { /* NULL == unset */ - if (!zend_is_callable(*exception_handler, 0, &exception_handler_name)) { + if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */ + if (!zend_is_callable(exception_handler, 0, &exception_handler_name TSRMLS_CC)) { zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback", get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown"); efree(exception_handler_name); @@ -1289,13 +1517,13 @@ ZEND_FUNCTION(set_exception_handler) } ALLOC_ZVAL(EG(user_exception_handler)); - if (Z_TYPE_PP(exception_handler) == IS_NULL) { /* unset user-defined handler */ + if (Z_TYPE_P(exception_handler) == IS_NULL) { /* unset user-defined handler */ FREE_ZVAL(EG(user_exception_handler)); EG(user_exception_handler) = NULL; RETURN_TRUE; } - *EG(user_exception_handler) = **exception_handler; + *EG(user_exception_handler) = *exception_handler; zval_copy_ctor(EG(user_exception_handler)); if (!had_orig_exception_handler) { @@ -1322,7 +1550,7 @@ ZEND_FUNCTION(restore_exception_handler) /* }}} */ -static int copy_class_or_interface_name(zend_class_entry **pce, int num_args, va_list args, zend_hash_key *hash_key) +static int copy_class_or_interface_name(zend_class_entry **pce TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { zval *array = va_arg(args, zval *); zend_uint mask = va_arg(args, zend_uint); @@ -1345,12 +1573,12 @@ ZEND_FUNCTION(get_declared_classes) zend_uint mask = ZEND_ACC_INTERFACE; zend_uint comply = 0; - if (ZEND_NUM_ARGS() != 0) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } array_init(return_value); - zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) copy_class_or_interface_name, 3, return_value, mask, comply); + zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, (apply_func_args_t) copy_class_or_interface_name, 3, return_value, mask, comply); } /* }}} */ @@ -1361,17 +1589,17 @@ ZEND_FUNCTION(get_declared_interfaces) zend_uint mask = ZEND_ACC_INTERFACE; zend_uint comply = 1; - if (ZEND_NUM_ARGS() != 0) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } array_init(return_value); - zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) copy_class_or_interface_name, 3, return_value, mask, comply); + zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, (apply_func_args_t) copy_class_or_interface_name, 3, return_value, mask, comply); } /* }}} */ -static int copy_function_name(zend_function *func, int num_args, va_list args, zend_hash_key *hash_key) +static int copy_function_name(zend_function *func TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { zval *internal_ar = va_arg(args, zval *), *user_ar = va_arg(args, zval *); @@ -1397,8 +1625,8 @@ ZEND_FUNCTION(get_defined_functions) zval *internal; zval *user; - if (ZEND_NUM_ARGS() != 0) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } MAKE_STD_ZVAL(internal); @@ -1408,7 +1636,7 @@ ZEND_FUNCTION(get_defined_functions) array_init(user); array_init(return_value); - zend_hash_apply_with_arguments(EG(function_table), (apply_func_args_t) copy_function_name, 2, internal, user); + zend_hash_apply_with_arguments(EG(function_table) TSRMLS_CC, (apply_func_args_t) copy_function_name, 2, internal, user); if (zend_hash_add(Z_ARRVAL_P(return_value), "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) { zval_ptr_dtor(&internal); @@ -1432,12 +1660,14 @@ ZEND_FUNCTION(get_defined_functions) Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */ ZEND_FUNCTION(get_defined_vars) { - zval *tmp; + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } - array_init(return_value); + array_init_size(return_value, zend_hash_num_elements(EG(active_symbol_table))); zend_hash_copy(Z_ARRVAL_P(return_value), EG(active_symbol_table), - (copy_ctor_func_t)zval_add_ref, &tmp, sizeof(zval *)); + (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval *)); } /* }}} */ @@ -1447,26 +1677,16 @@ ZEND_FUNCTION(get_defined_vars) Creates an anonymous function, and returns its name (funny, eh?) */ ZEND_FUNCTION(create_function) { - char *eval_code, *function_name; - int eval_code_length, function_name_length; - zval **z_function_args, **z_function_code; + char *eval_code, *function_name, *function_args, *function_code; + int function_name_length, function_args_len, function_code_len; int retval; char *eval_name; - if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &z_function_args, &z_function_code)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) { + return; } - convert_to_string_ex(z_function_args); - convert_to_string_ex(z_function_code); - - eval_code_length = sizeof("function " LAMBDA_TEMP_FUNCNAME) - +Z_STRLEN_PP(z_function_args) - +2 /* for the args parentheses */ - +2 /* for the curly braces */ - +Z_STRLEN_PP(z_function_code); - - zend_spprintf(&eval_code, 0, "function " LAMBDA_TEMP_FUNCNAME "(%s){%s}", Z_STRVAL_PP(z_function_args), Z_STRVAL_PP(z_function_code)); + zend_spprintf(&eval_code, 0, "function " LAMBDA_TEMP_FUNCNAME "(%s){%s}", function_args, function_code); eval_name = zend_make_compiled_string_description("runtime-created function" TSRMLS_CC); retval = zend_eval_string(eval_code, NULL, eval_name TSRMLS_CC); @@ -1510,7 +1730,7 @@ ZEND_FUNCTION(zend_test_func) #ifdef ZTS ZEND_FUNCTION(zend_thread_id) { - RETURN_LONG(tsrm_thread_id()); + RETURN_LONG((long)tsrm_thread_id()); } #endif #endif @@ -1520,18 +1740,13 @@ ZEND_FUNCTION(zend_thread_id) ZEND_FUNCTION(get_resource_type) { char *resource_type; - zval **z_resource_type; - - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_resource_type)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } + zval *z_resource_type; - if (Z_TYPE_PP(z_resource_type) != IS_RESOURCE) { - zend_error(E_WARNING, "Supplied argument is not a valid resource handle"); - RETURN_FALSE; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_resource_type) == FAILURE) { + return; } - resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(z_resource_type) TSRMLS_CC); + resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_P(z_resource_type) TSRMLS_CC); if (resource_type) { RETURN_STRING(resource_type, 1); } else { @@ -1617,7 +1832,8 @@ ZEND_FUNCTION(get_defined_constants) module_names[0] = "internal"; zend_hash_internal_pointer_reset_ex(&module_registry, &pos); while (zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) != FAILURE) { - module_names[i++] = module->name; + module_names[module->module_number] = (char *)module->name; + i++; zend_hash_move_forward_ex(&module_registry, &pos); } module_names[i] = "user"; @@ -1659,16 +1875,14 @@ bad_module_id: /* }}} */ -static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) +static zval *debug_backtrace_get_args(void **curpos TSRMLS_DC) { - void **p = *curpos - 2; + void **p = curpos; zval *arg_array, **arg; int arg_count = (int)(zend_uintptr_t) *p; - *curpos -= (arg_count+2); - MAKE_STD_ZVAL(arg_array); - array_init(arg_array); + array_init_size(arg_array, arg_count); p -= arg_count; while (--arg_count >= 0) { @@ -1677,18 +1891,13 @@ static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) if (Z_TYPE_PP(arg) != IS_OBJECT) { SEPARATE_ZVAL_TO_MAKE_IS_REF(arg); } - (*arg)->refcount++; + Z_ADDREF_PP(arg); add_next_index_zval(arg_array, *arg); } else { add_next_index_null(arg_array); } } - /* skip args from incomplete frames */ - while ((((*curpos)-1) > EG(argument_stack).elements) && *((*curpos)-1)) { - (*curpos)--; - } - return arg_array; } @@ -1719,47 +1928,16 @@ ZEND_FUNCTION(debug_print_backtrace) char *call_type; char *include_filename = NULL; zval *arg_array = NULL; - void **cur_arg_pos = EG(argument_stack).top_element; - void **args = cur_arg_pos; - int arg_stack_consistent = 0; - int frames_on_stack = 0; int indent = 0; - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); - } - - while (--args > EG(argument_stack).elements) { - if (*args--) { - break; - } - args -= *(ulong*)args; - frames_on_stack++; - - /* skip args from incomplete frames */ - while (((args-1) > EG(argument_stack).elements) && *(args-1)) { - args--; - } - - if ((args-1) == EG(argument_stack).elements) { - arg_stack_consistent = 1; - break; - } + if (zend_parse_parameters_none() == FAILURE) { + return; } ptr = EG(current_execute_data); /* skip debug_backtrace() */ ptr = ptr->prev_execute_data; - cur_arg_pos -= 2; - frames_on_stack--; - - if (arg_stack_consistent) { - /* skip args from incomplete frames */ - while (((cur_arg_pos-1) > EG(argument_stack).elements) && *(cur_arg_pos-1)) { - cur_arg_pos--; - } - } while (ptr) { char *free_class_name = NULL; @@ -1775,7 +1953,7 @@ ZEND_FUNCTION(debug_print_backtrace) skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL && skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL_BY_NAME && skip->prev_execute_data->opline->opcode != ZEND_INCLUDE_OR_EVAL) { - skip = skip->prev_execute_data; + skip = skip->prev_execute_data; } if (skip->op_array) { @@ -1811,9 +1989,8 @@ ZEND_FUNCTION(debug_print_backtrace) call_type = NULL; } if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) { - if (arg_stack_consistent && (frames_on_stack > 0)) { - arg_array = debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC); - frames_on_stack--; + if (ptr->function_state.arguments) { + arg_array = debug_backtrace_get_args(ptr->function_state.arguments TSRMLS_CC); } } } else { @@ -1908,28 +2085,6 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int char *class_name; char *include_filename = NULL; zval *stack_frame; - void **cur_arg_pos = EG(argument_stack).top_element; - void **args = cur_arg_pos; - int arg_stack_consistent = 0; - int frames_on_stack = 0; - - while (--args > EG(argument_stack).elements) { - if (*args--) { - break; - } - args -= *(ulong*)args; - frames_on_stack++; - - /* skip args from incomplete frames */ - while (((args-1) > EG(argument_stack).elements) && *(args-1)) { - args--; - } - - if ((args-1) == EG(argument_stack).elements) { - arg_stack_consistent = 1; - break; - } - } ptr = EG(current_execute_data); @@ -1940,17 +2095,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int /* skip debug_backtrace() */ if (skip_last-- && ptr) { - int arg_count = *((ulong*)(cur_arg_pos - 2)); - cur_arg_pos -= (arg_count + 2); - frames_on_stack--; ptr = ptr->prev_execute_data; - - if (arg_stack_consistent) { - /* skip args from incomplete frames */ - while (((cur_arg_pos-1) > EG(argument_stack).elements) && *(cur_arg_pos-1)) { - cur_arg_pos--; - } - } } array_init(return_value); @@ -2015,7 +2160,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int } if (provide_object) { add_assoc_zval_ex(stack_frame, "object", sizeof("object"), ptr->object); - ptr->object->refcount++; + Z_ADDREF_P(ptr->object); } add_assoc_string_ex(stack_frame, "type", sizeof("type"), "->", 1); @@ -2025,9 +2170,8 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int } if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) { - if (arg_stack_consistent && (frames_on_stack > 0)) { - add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC)); - frames_on_stack--; + if (ptr->function_state.arguments) { + add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(ptr->function_state.arguments TSRMLS_CC)); } } } else { @@ -2109,16 +2253,16 @@ ZEND_FUNCTION(debug_backtrace) Returns true if the named extension is loaded */ ZEND_FUNCTION(extension_loaded) { - zval **extension_name; + char *extension_name; + int extension_name_len; char *lcname; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) { + return; } - convert_to_string_ex(extension_name); - lcname = zend_str_tolower_dup(Z_STRVAL_PP(extension_name), Z_STRLEN_PP(extension_name)); - if (zend_hash_exists(&module_registry, lcname, Z_STRLEN_PP(extension_name)+1)) { + lcname = zend_str_tolower_dup(extension_name, extension_name_len); + if (zend_hash_exists(&module_registry, lcname, extension_name_len+1)) { RETVAL_TRUE; } else { RETVAL_FALSE; @@ -2132,19 +2276,19 @@ ZEND_FUNCTION(extension_loaded) Returns an array with the names of functions belonging to the named extension */ ZEND_FUNCTION(get_extension_funcs) { - zval **extension_name; + char *extension_name; + int extension_name_len; zend_module_entry *module; - zend_function_entry *func; + const zend_function_entry *func; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) { + return; } - convert_to_string_ex(extension_name); - if (strncasecmp(Z_STRVAL_PP(extension_name), "zend", sizeof("zend"))) { - char *lcname = zend_str_tolower_dup(Z_STRVAL_PP(extension_name), Z_STRLEN_PP(extension_name)); + if (strncasecmp(extension_name, "zend", sizeof("zend"))) { + char *lcname = zend_str_tolower_dup(extension_name, extension_name_len); if (zend_hash_find(&module_registry, lcname, - Z_STRLEN_PP(extension_name)+1, (void**)&module) == FAILURE) { + extension_name_len+1, (void**)&module) == FAILURE) { efree(lcname); RETURN_FALSE; } diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h index b8b087e2f..68175b323 100644 --- a/Zend/zend_builtin_functions.h +++ b/Zend/zend_builtin_functions.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.h,v 1.17.2.2.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_builtin_functions.h,v 1.17.2.2.2.1.2.2 2008/12/31 11:15:31 sebastian Exp $ */ #ifndef ZEND_BUILTIN_FUNCTIONS_H #define ZEND_BUILTIN_FUNCTIONS_H diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c new file mode 100644 index 000000000..a28f8ccfd --- /dev/null +++ b/Zend/zend_closures.c @@ -0,0 +1,377 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2009 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: Christian Seiler | + | Dmitry Stogov | + | Marcus Boerger | + +----------------------------------------------------------------------+ +*/ + +/* $Id: zend_closures.c,v 1.3.2.26 2009/01/26 22:54:18 cseiler Exp $ */ + +#include "zend.h" +#include "zend_API.h" +#include "zend_closures.h" +#include "zend_exceptions.h" +#include "zend_interfaces.h" +#include "zend_objects.h" +#include "zend_objects_API.h" +#include "zend_globals.h" + +#define ZEND_CLOSURE_PRINT_NAME "Closure object" + +#define ZEND_CLOSURE_PROPERTY_ERROR() \ + zend_error(E_RECOVERABLE_ERROR, "Closure object cannot have properties") + +typedef struct _zend_closure { + zend_object std; + zend_function func; +} zend_closure; + +/* non-static since it needs to be referenced */ +ZEND_API zend_class_entry *zend_ce_closure; +static zend_object_handlers closure_handlers; + +ZEND_METHOD(Closure, __invoke) /* {{{ */ +{ + zend_function *func = EG(current_execute_data)->function_state.function; + zval ***arguments; + zval *closure_result_ptr = NULL; + + arguments = emalloc(sizeof(zval**) * ZEND_NUM_ARGS()); + if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) { + efree(arguments); + zend_error(E_RECOVERABLE_ERROR, "Cannot get arguments for calling closure"); + RETVAL_FALSE; + } else if (call_user_function_ex(CG(function_table), NULL, this_ptr, &closure_result_ptr, ZEND_NUM_ARGS(), arguments, 1, NULL TSRMLS_CC) == FAILURE) { + RETVAL_FALSE; + } else if (closure_result_ptr) { + if (Z_ISREF_P(closure_result_ptr) && return_value_ptr) { + if (return_value) { + zval_ptr_dtor(&return_value); + } + *return_value_ptr = closure_result_ptr; + } else { + RETVAL_ZVAL(closure_result_ptr, 1, 1); + } + } + efree(arguments); + + /* destruct the function also, then - we have allocated it in get_method */ + efree(func->internal_function.function_name); + efree(func); +} +/* }}} */ + +static zend_function *zend_closure_get_constructor(zval *object TSRMLS_DC) /* {{{ */ +{ + zend_error(E_RECOVERABLE_ERROR, "Instantiation of 'Closure' is not allowed"); + return NULL; +} +/* }}} */ + +static int zend_closure_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ +{ + return (Z_OBJ_HANDLE_P(o1) != Z_OBJ_HANDLE_P(o2)); +} +/* }}} */ + +ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC) /* {{{ */ +{ + zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC); + zend_function *invoke = (zend_function*)emalloc(sizeof(zend_function)); + + invoke->common = closure->func.common; + invoke->type = ZEND_INTERNAL_FUNCTION; + invoke->internal_function.fn_flags = ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER; + invoke->internal_function.handler = ZEND_MN(Closure___invoke); + invoke->internal_function.module = 0; + invoke->internal_function.scope = zend_ce_closure; + invoke->internal_function.function_name = estrndup(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1); + return invoke; +} +/* }}} */ + +ZEND_API const zend_function *zend_get_closure_method_def(zval *obj TSRMLS_DC) /* {{{ */ +{ + zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC); + return &closure->func; +} +/* }}} */ + +static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len TSRMLS_DC) /* {{{ */ +{ + char *lc_name; + ALLOCA_FLAG(use_heap) + + lc_name = do_alloca(method_len + 1, use_heap); + zend_str_tolower_copy(lc_name, method_name, method_len); + if ((method_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && + memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0 + ) { + free_alloca(lc_name, use_heap); + return zend_get_closure_invoke_method(*object_ptr TSRMLS_CC); + } + free_alloca(lc_name, use_heap); + return NULL; +} +/* }}} */ + +static zval *zend_closure_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */ +{ + ZEND_CLOSURE_PROPERTY_ERROR(); + Z_ADDREF(EG(uninitialized_zval)); + return &EG(uninitialized_zval); +} +/* }}} */ + +static void zend_closure_write_property(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */ +{ + ZEND_CLOSURE_PROPERTY_ERROR(); +} +/* }}} */ + +static zval **zend_closure_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */ +{ + ZEND_CLOSURE_PROPERTY_ERROR(); + return NULL; +} +/* }}} */ + +static int zend_closure_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC) /* {{{ */ +{ + ZEND_CLOSURE_PROPERTY_ERROR(); + return 0; +} +/* }}} */ + +static void zend_closure_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */ +{ + ZEND_CLOSURE_PROPERTY_ERROR(); +} +/* }}} */ + +static void zend_closure_free_storage(void *object TSRMLS_DC) /* {{{ */ +{ + zend_closure *closure = (zend_closure *)object; + + zend_object_std_dtor(&closure->std TSRMLS_CC); + + if (closure->func.type == ZEND_USER_FUNCTION) { + zend_execute_data *ex = EG(current_execute_data); + while (ex) { + if (ex->op_array == &closure->func.op_array) { + zend_error(E_ERROR, "Cannot destroy active lambda function"); + } + ex = ex->prev_execute_data; + } + destroy_op_array(&closure->func.op_array TSRMLS_CC); + } + + efree(closure); +} +/* }}} */ + +static zend_object_value zend_closure_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ +{ + zend_closure *closure; + zend_object_value object; + + closure = emalloc(sizeof(zend_closure)); + memset(closure, 0, sizeof(zend_closure)); + + zend_object_std_init(&closure->std, class_type TSRMLS_CC); + + object.handle = zend_objects_store_put(closure, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) zend_closure_free_storage, NULL TSRMLS_CC); + object.handlers = &closure_handlers; + + return object; +} +/* }}} */ + +int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC) /* {{{ */ +{ + zend_closure *closure; + + if (Z_TYPE_P(obj) != IS_OBJECT) { + return FAILURE; + } + + closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC); + *fptr_ptr = &closure->func; + + if (zobj_ptr) { + *zobj_ptr = NULL; + } + *ce_ptr = NULL; + return SUCCESS; +} +/* }}} */ + +static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */ +{ + zend_closure *closure = (zend_closure *)zend_object_store_get_object(object TSRMLS_CC); + HashTable *rv; + zval *val; + struct _zend_arg_info *arg_info = closure->func.common.arg_info; + + *is_temp = 1; + ALLOC_HASHTABLE(rv); + zend_hash_init(rv, 1, NULL, ZVAL_PTR_DTOR, 0); + if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) { + HashTable *static_variables = closure->func.op_array.static_variables; + MAKE_STD_ZVAL(val); + array_init(val); + zend_hash_copy(Z_ARRVAL_P(val), static_variables, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval*)); + zend_symtable_update(rv, "static", sizeof("static"), (void *) &val, sizeof(zval *), NULL); + } + + if (arg_info) { + zend_uint i, required = closure->func.common.required_num_args; + + MAKE_STD_ZVAL(val); + array_init(val); + + for (i = 0; i < closure->func.common.num_args; i++) { + char *name, *info; + int name_len, info_len; + if (arg_info->name) { + name_len = zend_spprintf(&name, 0, "%s$%s", + arg_info->pass_by_reference ? "&" : "", + arg_info->name); + } else { + name_len = zend_spprintf(&name, 0, "%s$param%d", + arg_info->pass_by_reference ? "&" : "", + i + 1); + } + info_len = zend_spprintf(&info, 0, "%s", + i >= required ? "" : ""); + add_assoc_stringl_ex(val, name, name_len + 1, info, info_len, 0); + efree(name); + arg_info++; + } + zend_symtable_update(rv, "parameter", sizeof("parameter"), (void *) &val, sizeof(zval *), NULL); + } + return rv; +} +/* }}} */ + +/* {{{ proto Closure::__construct() + Private constructor preventing instantiation */ +ZEND_METHOD(Closure, __construct) +{ + zend_error(E_RECOVERABLE_ERROR, "Instantiation of 'Closure' is not allowed"); +} +/* }}} */ + +static const zend_function_entry closure_functions[] = { + ZEND_ME(Closure, __construct, NULL, ZEND_ACC_PRIVATE) + {NULL, NULL, NULL} +}; + +void zend_register_closure_ce(TSRMLS_D) /* {{{ */ +{ + zend_class_entry ce; + + INIT_CLASS_ENTRY(ce, "Closure", closure_functions); + zend_ce_closure = zend_register_internal_class(&ce TSRMLS_CC); + zend_ce_closure->ce_flags |= ZEND_ACC_FINAL_CLASS; + zend_ce_closure->create_object = zend_closure_new; + zend_ce_closure->serialize = zend_class_serialize_deny; + zend_ce_closure->unserialize = zend_class_unserialize_deny; + + memcpy(&closure_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + closure_handlers.get_constructor = zend_closure_get_constructor; + closure_handlers.get_method = zend_closure_get_method; + closure_handlers.write_property = zend_closure_write_property; + closure_handlers.read_property = zend_closure_read_property; + 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.clone_obj = NULL; + closure_handlers.get_debug_info = zend_closure_get_debug_info; + closure_handlers.get_closure = zend_closure_get_closure; +} +/* }}} */ + +static int zval_copy_static_var(zval **p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */ +{ + HashTable *target = va_arg(args, HashTable*); + zend_bool is_ref; + + if (Z_TYPE_PP(p) & (IS_LEXICAL_VAR|IS_LEXICAL_REF)) { + is_ref = Z_TYPE_PP(p) & IS_LEXICAL_REF; + + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + if (zend_hash_quick_find(EG(active_symbol_table), key->arKey, key->nKeyLength, key->h, (void **) &p) == FAILURE) { + if (is_ref) { + zval *tmp; + + ALLOC_INIT_ZVAL(tmp); + Z_SET_ISREF_P(tmp); + zend_hash_quick_add(EG(active_symbol_table), key->arKey, key->nKeyLength, key->h, &tmp, sizeof(zval*), (void**)&p); + } else { + p = &EG(uninitialized_zval_ptr); + zend_error(E_NOTICE,"Undefined variable: %s", key->arKey); + } + } else { + if (is_ref) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(p); + } else if (Z_ISREF_PP(p)) { + SEPARATE_ZVAL(p); + } + } + } + if (zend_hash_quick_add(target, key->arKey, key->nKeyLength, key->h, p, sizeof(zval*), NULL) == SUCCESS) { + Z_ADDREF_PP(p); + } + return ZEND_HASH_APPLY_KEEP; +} +/* }}} */ + +ZEND_API void zend_create_closure(zval *res, zend_function *func TSRMLS_DC) /* {{{ */ +{ + zend_closure *closure; + + object_init_ex(res, zend_ce_closure); + + closure = (zend_closure *)zend_object_store_get_object(res TSRMLS_CC); + + closure->func = *func; + + if (closure->func.type == ZEND_USER_FUNCTION) { + if (closure->func.op_array.static_variables) { + HashTable *static_variables = closure->func.op_array.static_variables; + + ALLOC_HASHTABLE(closure->func.op_array.static_variables); + zend_hash_init(closure->func.op_array.static_variables, zend_hash_num_elements(static_variables), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_apply_with_arguments(static_variables TSRMLS_CC, (apply_func_args_t)zval_copy_static_var, 1, closure->func.op_array.static_variables); + } + (*closure->func.op_array.refcount)++; + } + + closure->func.common.scope = NULL; +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/Zend/zend_closures.h b/Zend/zend_closures.h new file mode 100644 index 000000000..79d28f087 --- /dev/null +++ b/Zend/zend_closures.h @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2009 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: Christian Seiler | + | Dmitry Stogov | + +----------------------------------------------------------------------+ +*/ + +/* $Id: zend_closures.h,v 1.1.2.8 2009/01/26 22:54:19 cseiler Exp $ */ + +#ifndef ZEND_CLOSURES_H +#define ZEND_CLOSURES_H + +BEGIN_EXTERN_C() + +#define ZEND_INVOKE_FUNC_NAME "__invoke" + +void zend_register_closure_ce(TSRMLS_D); + +extern ZEND_API zend_class_entry *zend_ce_closure; + +ZEND_API void zend_create_closure(zval *res, zend_function *op_array TSRMLS_DC); +ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC); +ZEND_API const zend_function *zend_get_closure_method_def(zval *obj TSRMLS_DC); + +END_EXTERN_C() + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 5c88d09ba..ae1487818 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.54 2009/01/26 21:27:41 dsp Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.103 2009/03/10 10:01:44 dmitry Exp $ */ #include #include "zend.h" @@ -26,6 +26,7 @@ #include "zend_llist.h" #include "zend_API.h" #include "zend_exceptions.h" +#include "tsrm_virtual_cwd.h" #ifdef ZEND_MULTIBYTE #include "zend_multibyte.h" @@ -34,7 +35,6 @@ ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename TSRMLS_DC); - #ifndef ZTS ZEND_API zend_compiler_globals compiler_globals; ZEND_API zend_executor_globals executor_globals; @@ -69,13 +69,13 @@ static void zend_destroy_property_info_internal(zend_property_info *property_inf free(property_info->name); } -static void build_runtime_defined_function_key(zval *result, char *name, int name_length TSRMLS_DC) +static void build_runtime_defined_function_key(zval *result, const char *name, int name_length TSRMLS_DC) { char char_pos_buf[32]; uint char_pos_len; char *filename; - char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(_yy_last_accepting_cpos)); + char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(yy_text)); if (CG(active_op_array)->filename) { filename = CG(active_op_array)->filename; } else { @@ -85,15 +85,15 @@ static void build_runtime_defined_function_key(zval *result, char *name, int nam /* NULL, name length, filename length, last accepting char position length */ result->value.str.len = 1+name_length+strlen(filename)+char_pos_len; #ifdef ZEND_MULTIBYTE - /* must be binary safe */ - result->value.str.val = (char *) safe_emalloc(result->value.str.len, 1, 1); - result->value.str.val[0] = '\0'; - sprintf(result->value.str.val+1, "%s%s%s", name, filename, char_pos_buf); + /* must be binary safe */ + result->value.str.val = (char *) safe_emalloc(result->value.str.len, 1, 1); + result->value.str.val[0] = '\0'; + sprintf(result->value.str.val+1, "%s%s%s", name, filename, char_pos_buf); #else zend_spprintf(&result->value.str.val, 0, "%c%s%s%s", '\0', name, filename, char_pos_buf); #endif /* ZEND_MULTIBYTE */ result->type = IS_STRING; - result->refcount = 1; + Z_SET_REFCOUNT_P(result, 1); } @@ -104,7 +104,7 @@ int zend_auto_global_arm(zend_auto_global *auto_global TSRMLS_DC) } -ZEND_API int zend_auto_global_disable_jit(char *varname, zend_uint varname_length TSRMLS_DC) +ZEND_API int zend_auto_global_disable_jit(const char *varname, zend_uint varname_length TSRMLS_DC) { zend_auto_global *auto_global; @@ -135,11 +135,16 @@ void zend_init_compiler_data_structures(TSRMLS_D) zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0); zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0); zend_stack_init(&CG(list_stack)); - CG(handle_op_arrays) = 1; CG(in_compilation) = 0; CG(start_lineno) = 0; + CG(current_namespace) = NULL; + CG(in_namespace) = 0; + CG(has_bracketed_namespaces) = 0; + CG(current_import) = NULL; init_compiler_declarables(TSRMLS_C); zend_hash_apply(CG(auto_globals), (apply_func_t) zend_auto_global_arm TSRMLS_CC); + zend_stack_init(&CG(labels_stack)); + CG(labels) = NULL; #ifdef ZEND_MULTIBYTE CG(script_encoding_list) = NULL; @@ -152,13 +157,21 @@ void zend_init_compiler_data_structures(TSRMLS_D) } +ZEND_API void file_handle_dtor(zend_file_handle *fh) +{ + TSRMLS_FETCH(); + + zend_file_handle_dtor(fh TSRMLS_CC); +} + + void init_compiler(TSRMLS_D) { CG(active_op_array) = NULL; zend_init_compiler_data_structures(TSRMLS_C); zend_init_rsrc_list(TSRMLS_C); zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0); - zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_file_handle_dtor, 0); + zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) file_handle_dtor, 0); CG(unclean_shutdown) = 0; } @@ -174,6 +187,7 @@ void shutdown_compiler(TSRMLS_D) zend_stack_destroy(&CG(list_stack)); zend_hash_destroy(&CG(filenames_table)); zend_llist_destroy(&CG(open_files)); + zend_stack_destroy(&CG(labels_stack)); #ifdef ZEND_MULTIBYTE if (CG(script_encoding_list)) { @@ -183,7 +197,7 @@ void shutdown_compiler(TSRMLS_D) } -ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC) +ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC) { char **pp, *p; int length = strlen(new_compiled_filename); @@ -255,7 +269,7 @@ static int lookup_cv(zend_op_array *op_array, char* name, int name_len) } -void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC) +void zend_do_binary_op(zend_uchar op, znode *result, const znode *op1, const znode *op2 TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -268,7 +282,7 @@ void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRM } -void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC) +void zend_do_unary_op(zend_uchar op, znode *result, const znode *op1 TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -283,14 +297,14 @@ void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC) #define MAKE_NOP(opline) { opline->opcode = ZEND_NOP; memset(&opline->result,0,sizeof(znode)); memset(&opline->op1,0,sizeof(znode)); memset(&opline->op2,0,sizeof(znode)); opline->result.op_type=opline->op1.op_type=opline->op2.op_type=IS_UNUSED; } -static void zend_do_op_data(zend_op *data_op, znode *value TSRMLS_DC) +static void zend_do_op_data(zend_op *data_op, const znode *value TSRMLS_DC) { data_op->opcode = ZEND_OP_DATA; data_op->op1 = *value; SET_UNUSED(data_op->op2); } -void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC) +void zend_do_binary_assign_op(zend_uchar op, znode *result, const znode *op1, const znode *op2 TSRMLS_DC) { int last_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -338,16 +352,20 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar zend_op *opline_ptr; zend_llist *fetch_list_ptr; - if (varname->op_type == IS_CONST && varname->u.constant.type == IS_STRING && - !zend_is_auto_global(varname->u.constant.value.str.val, varname->u.constant.value.str.len TSRMLS_CC) && - !(varname->u.constant.value.str.len == (sizeof("this")-1) && - !memcmp(varname->u.constant.value.str.val, "this", sizeof("this"))) && - (CG(active_op_array)->last == 0 || - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)) { - result->op_type = IS_CV; - result->u.var = lookup_cv(CG(active_op_array), varname->u.constant.value.str.val, varname->u.constant.value.str.len); - result->u.EA.type = 0; - return; + if (varname->op_type == IS_CONST) { + if (Z_TYPE(varname->u.constant) != IS_STRING) { + convert_to_string(&varname->u.constant); + } + if (!zend_is_auto_global(varname->u.constant.value.str.val, varname->u.constant.value.str.len TSRMLS_CC) && + !(varname->u.constant.value.str.len == (sizeof("this")-1) && + !memcmp(varname->u.constant.value.str.val, "this", sizeof("this"))) && + (CG(active_op_array)->last == 0 || + CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)) { + result->op_type = IS_CV; + result->u.var = lookup_cv(CG(active_op_array), varname->u.constant.value.str.val, varname->u.constant.value.str.len); + result->u.EA.type = 0; + return; + } } if (bp) { @@ -384,13 +402,15 @@ void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC) fetch_simple_variable_ex(result, varname, bp, ZEND_FETCH_W TSRMLS_CC); } -void zend_do_fetch_static_member(znode *result, znode *class_znode TSRMLS_DC) +void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) { + znode class_node; zend_llist *fetch_list_ptr; zend_llist_element *le; zend_op *opline_ptr; zend_op opline; + zend_do_fetch_class(&class_node, class_name TSRMLS_CC); zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); if (result->op_type == IS_CV) { init_op(&opline TSRMLS_CC); @@ -404,7 +424,7 @@ void zend_do_fetch_static_member(znode *result, znode *class_znode TSRMLS_DC) opline.op1.u.constant.value.str.val = estrdup(CG(active_op_array)->vars[result->u.var].name); opline.op1.u.constant.value.str.len = CG(active_op_array)->vars[result->u.var].name_len; SET_UNUSED(opline.op2); - opline.op2 = *class_znode; + opline.op2 = class_node; opline.op2.u.EA.type = ZEND_FETCH_STATIC_MEMBER; *result = opline.result; @@ -424,13 +444,13 @@ void zend_do_fetch_static_member(znode *result, znode *class_znode TSRMLS_DC) opline.op1.u.constant.value.str.val = estrdup(CG(active_op_array)->vars[opline_ptr->op1.u.var].name); opline.op1.u.constant.value.str.len = CG(active_op_array)->vars[opline_ptr->op1.u.var].name_len; SET_UNUSED(opline.op2); - opline.op2 = *class_znode; + opline.op2 = class_node; opline.op2.u.EA.type = ZEND_FETCH_STATIC_MEMBER; opline_ptr->op1 = opline.result; zend_llist_prepend_element(fetch_list_ptr, &opline); } else { - opline_ptr->op2 = *class_znode; + opline_ptr->op2 = class_node; opline_ptr->op2.u.EA.type = ZEND_FETCH_STATIC_MEMBER; } } @@ -444,7 +464,7 @@ void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC } -void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC) +void fetch_array_dim(znode *result, const znode *parent, const znode *dim TSRMLS_DC) { zend_op opline; zend_llist *fetch_list_ptr; @@ -464,16 +484,16 @@ void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC) } -void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC) +void fetch_string_offset(znode *result, const znode *parent, const znode *offset TSRMLS_DC) { #ifdef ilia_0 - zend_error(E_STRICT, "Usage of {} to access string offsets is deprecated and will be removed in PHP 6"); + zend_error(E_DEPRECATED, "Usage of {} to access string offsets is deprecated and will be removed in PHP 6"); #endif fetch_array_dim(result, parent, offset TSRMLS_CC); } -void zend_do_print(znode *result, znode *arg TSRMLS_DC) +void zend_do_print(znode *result, const znode *arg TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -486,7 +506,7 @@ void zend_do_print(znode *result, znode *arg TSRMLS_DC) } -void zend_do_echo(znode *arg TSRMLS_DC) +void zend_do_echo(const znode *arg TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -495,7 +515,7 @@ void zend_do_echo(znode *arg TSRMLS_DC) SET_UNUSED(opline->op2); } -void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body TSRMLS_DC) +void zend_do_abstract_method(const znode *function_name, znode *modifiers, const znode *body TSRMLS_DC) { char *method_type; @@ -527,7 +547,7 @@ void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body } } -static zend_bool opline_is_fetch_this(zend_op *opline TSRMLS_DC) +static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) { if ((opline->opcode == ZEND_FETCH_W) && (opline->op1.op_type == IS_CONST) && (opline->op1.u.constant.type == IS_STRING) @@ -539,7 +559,7 @@ static zend_bool opline_is_fetch_this(zend_op *opline TSRMLS_DC) } } -void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) +void zend_do_assign(znode *result, znode *variable, const znode *value TSRMLS_DC) { int last_op_number; zend_op *opline; @@ -571,12 +591,16 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) } } - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); + zend_do_end_variable_parse(variable, BP_VAR_W, 0 TSRMLS_CC); last_op_number = get_next_op_number(CG(active_op_array)); opline = get_next_op(CG(active_op_array) TSRMLS_CC); - if (variable->op_type == IS_VAR) { + if (variable->op_type == IS_CV) { + if (variable->u.var == CG(active_op_array)->this_var) { + zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); + } + } else if (variable->op_type == IS_VAR) { int n = 0; while (last_op_number - n > 0) { @@ -588,10 +612,13 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) last_op->result.u.var == variable->u.var) { if (last_op->opcode == ZEND_FETCH_OBJ_W) { if (n > 0) { + int opline_no = (opline-CG(active_op_array)->opcodes)/sizeof(*opline); *opline = *last_op; MAKE_NOP(last_op); - last_op = opline; + /* last_op = opline; */ opline = get_next_op(CG(active_op_array) TSRMLS_CC); + /* get_next_op can realloc, we need to move last_op */ + last_op = &CG(active_op_array)->opcodes[opline_no]; } last_op->opcode = ZEND_ASSIGN_OBJ; zend_do_op_data(opline, value TSRMLS_CC); @@ -600,10 +627,14 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) return; } else if (last_op->opcode == ZEND_FETCH_DIM_W) { if (n > 0) { + int opline_no = (opline-CG(active_op_array)->opcodes)/sizeof(*opline); *opline = *last_op; MAKE_NOP(last_op); - last_op = opline; + /* last_op = opline; */ + /* TBFixed: this can realloc opcodes, leaving last_op pointing wrong */ opline = get_next_op(CG(active_op_array) TSRMLS_CC); + /* get_next_op can realloc, we need to move last_op */ + last_op = &CG(active_op_array)->opcodes[opline_no]; } last_op->opcode = ZEND_ASSIGN_DIM; zend_do_op_data(opline, value TSRMLS_CC); @@ -632,27 +663,33 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) *result = opline->result; } -static inline zend_bool zend_is_function_or_method_call(znode *variable) +static inline zend_bool zend_is_function_or_method_call(const znode *variable) { zend_uint type = variable->u.EA.type; return ((type & ZEND_PARSED_METHOD_CALL) || (type == ZEND_PARSED_FUNCTION_CALL)); } -void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC) +void zend_do_assign_ref(znode *result, const znode *lvar, const znode *rvar TSRMLS_DC) { - int last_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - if (last_op_number > 0) { - zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1]; + zend_op *opline; - if (lvar->op_type == IS_VAR && - opline_is_fetch_this(last_op TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); - } - } + if (lvar->op_type == IS_CV) { + if (lvar->u.var == CG(active_op_array)->this_var) { + zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); + } + } else if (lvar->op_type == IS_VAR) { + int last_op_number = get_next_op_number(CG(active_op_array)); + + if (last_op_number > 0) { + opline = &CG(active_op_array)->opcodes[last_op_number-1]; + if (opline_is_fetch_this(opline TSRMLS_CC)) { + zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); + } + } + } + opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_ASSIGN_REF; if (zend_is_function_or_method_call(rvar)) { opline->extended_value = ZEND_RETURNS_FUNCTION; @@ -702,7 +739,7 @@ static inline void do_end_loop(int cont_addr, int has_loop_var TSRMLS_DC) } -void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC) +void zend_do_while_cond(const znode *expr, znode *close_bracket_token TSRMLS_DC) { int while_cond_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -717,7 +754,7 @@ void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC) } -void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC) +void zend_do_while_end(const znode *while_token, const znode *close_bracket_token TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -736,7 +773,7 @@ void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC) } -void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC) +void zend_do_for_cond(const znode *expr, znode *second_semicolon_token TSRMLS_DC) { int for_cond_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -748,7 +785,7 @@ void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC) } -void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC) +void zend_do_for_before_statement(const znode *cond_start, const znode *second_semicolon_token TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -764,7 +801,7 @@ void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_tok } -void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC) +void zend_do_for_end(const znode *second_semicolon_token TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -780,7 +817,7 @@ void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC) } -void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC) +void zend_do_pre_incdec(znode *result, const znode *op1, zend_uchar op TSRMLS_DC) { int last_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline; @@ -809,7 +846,7 @@ void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC) } -void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC) +void zend_do_post_incdec(znode *result, const znode *op1, zend_uchar op TSRMLS_DC) { int last_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline; @@ -836,7 +873,7 @@ void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC) } -void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC) +void zend_do_if_cond(const znode *cond, znode *closing_bracket_token TSRMLS_DC) { int if_cond_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -849,7 +886,7 @@ void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC) } -void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC) +void zend_do_if_after_statement(const znode *closing_bracket_token, unsigned char initialize TSRMLS_DC) { int if_end_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -887,7 +924,7 @@ void zend_do_if_end(TSRMLS_D) DEC_BPC(CG(active_op_array)); } -void zend_check_writable_variable(znode *variable) +void zend_check_writable_variable(const znode *variable) { zend_uint type = variable->u.EA.type; @@ -908,11 +945,13 @@ void zend_do_begin_variable_parse(TSRMLS_D) } -void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC) +void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS_DC) { zend_llist *fetch_list_ptr; zend_llist_element *le; - zend_op *opline, *opline_ptr=NULL; + zend_op *opline = NULL; + zend_op *opline_ptr; + zend_uint this_var = -1; zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); @@ -923,12 +962,36 @@ void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC) if (le) { opline_ptr = (zend_op *)le->data; if (opline_is_fetch_this(opline_ptr TSRMLS_CC)) { - CG(active_op_array)->uses_this = 1; + /* convert to FETCH_?(this) into IS_CV */ + if (CG(active_op_array)->last == 0 || + CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE) { + + this_var = opline_ptr->result.u.var; + if (CG(active_op_array)->this_var == -1) { + CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), Z_STRVAL(opline_ptr->op1.u.constant), Z_STRLEN(opline_ptr->op1.u.constant)); + } else { + efree(Z_STRVAL(opline_ptr->op1.u.constant)); + } + le = le->next; + if (variable->op_type == IS_VAR && + variable->u.var == this_var) { + variable->op_type = IS_CV; + variable->u.var = CG(active_op_array)->this_var; + } + } else if (CG(active_op_array)->this_var == -1) { + CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), estrndup("this", sizeof("this")-1), sizeof("this")-1); + } } - while (1) { + while (le) { + opline_ptr = (zend_op *)le->data; opline = get_next_op(CG(active_op_array) TSRMLS_CC); memcpy(opline, opline_ptr, sizeof(zend_op)); + if (opline->op1.op_type == IS_VAR && + opline->op1.u.var == this_var) { + opline->op1.op_type = IS_CV; + opline->op1.u.var = CG(active_op_array)->this_var; + } switch (type) { case BP_VAR_R: if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) { @@ -959,8 +1022,9 @@ void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC) break; } le = le->next; - if (le == NULL) break; - opline_ptr = (zend_op *)le->data; + } + if (opline && type == BP_VAR_W && arg_offset) { + opline->extended_value = ZEND_FETCH_MAKE_REF; } } zend_llist_destroy(fetch_list_ptr); @@ -968,20 +1032,7 @@ void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC) } -void zend_do_init_string(znode *result TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_INIT_STRING; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC) +void zend_do_add_string(znode *result, const znode *op1, znode *op2 TSRMLS_DC) { zend_op *opline; @@ -1000,45 +1051,34 @@ void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC) efree(Z_STRVAL(op2->u.constant)); return; } - opline->op1 = *op1; + + if (op1) { + opline->op1 = *op1; + opline->result = *op1; + } else { + SET_UNUSED(opline->op1); + opline->result.op_type = IS_TMP_VAR; + opline->result.u.var = get_temporary_variable(CG(active_op_array)); + } opline->op2 = *op2; - opline->op2.op_type = IS_CONST; - opline->result = opline->op1; *result = opline->result; } -void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC) +void zend_do_add_variable(znode *result, const znode *op1, const znode *op2 TSRMLS_DC) { - zend_op *opline; + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - if (op1->op_type == IS_CONST) { - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_INIT_STRING; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); + opline->opcode = ZEND_ADD_VAR; - if (Z_STRLEN(op1->u.constant)>0) { - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_ADD_STRING; - opline->result = *result; - opline->op1 = *result; - opline->op2 = *op1; - opline->result = opline->op1; - } else { - zval_dtor(&op1->u.constant); - } + if (op1) { + opline->op1 = *op1; + opline->result = *op1; } else { - *result = *op1; + SET_UNUSED(opline->op1); + opline->result.op_type = IS_TMP_VAR; + opline->result.u.var = get_temporary_variable(CG(active_op_array)); } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_ADD_VAR; - opline->result = *result; - opline->op1 = *result; opline->op2 = *op2; *result = opline->result; } @@ -1086,13 +1126,24 @@ void zend_do_free(znode *op1 TSRMLS_DC) } -int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier) +int zend_do_verify_access_types(const znode *current_access_type, const znode *new_modifier) { if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_PPP_MASK) - && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_PPP_MASK) - && ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_PPP_MASK) != (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_PPP_MASK))) { + && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_PPP_MASK)) { zend_error(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed"); } + if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_ABSTRACT) + && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_ABSTRACT)) { + zend_error(E_COMPILE_ERROR, "Multiple abstract modifiers are not allowed"); + } + if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_STATIC) + && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_STATIC)) { + zend_error(E_COMPILE_ERROR, "Multiple static modifiers are not allowed"); + } + if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_FINAL) + && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_FINAL)) { + zend_error(E_COMPILE_ERROR, "Multiple final modifiers are not allowed"); + } if (((Z_LVAL(current_access_type->u.constant) | Z_LVAL(new_modifier->u.constant)) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) { zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member"); } @@ -1145,9 +1196,6 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n op_array.line_start = zend_get_compiled_lineno(TSRMLS_C); if (is_method) { - char *short_class_name = CG(active_class_entry)->name; - int short_class_name_length = CG(active_class_entry)->name_length; - if (zend_hash_add(&CG(active_class_entry)->function_table, lcname, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) { zend_op_array *child_op_array, *parent_op_array; if (CG(active_class_entry)->parent @@ -1169,12 +1217,53 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n fn_flags |= ZEND_ACC_PUBLIC; } - if (!(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) { - short_class_name = do_alloca_with_limit(short_class_name_length + 1, use_heap); - zend_str_tolower_copy(short_class_name, CG(active_class_entry)->name, short_class_name_length); + if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { + if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __call() must have public visibility and can not be static"); + } + } else if ((name_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) { + if ((fn_flags & (ZEND_ACC_PPP_MASK ^ ZEND_ACC_PUBLIC)) || (fn_flags & ZEND_ACC_STATIC) == 0) { + zend_error(E_WARNING, "The magic method __callStatic() must have public visibility and be static"); + } + } else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __get() must have public visibility and can not be static"); + } + } else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __set() must have public visibility and can not be static"); + } + } else if ((name_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __unset() must have public visibility and can not be static"); + } + } else if ((name_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __isset() must have public visibility and can not be static"); + } + } else if ((name_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __toString() must have public visibility and can not be static"); + } + } + } else { + char *short_class_name; + int short_class_name_length; + char *short_class_lcname; + + if ((short_class_name = zend_memrchr(CG(active_class_entry)->name, '\\', CG(active_class_entry)->name_length))) { + short_class_name_length = CG(active_class_entry)->name_length - (short_class_name - CG(active_class_entry)->name) - 1; + ++short_class_name; + } else { + short_class_name = CG(active_class_entry)->name; + short_class_name_length = CG(active_class_entry)->name_length; + } + short_class_lcname = do_alloca(short_class_name_length + 1, use_heap); + zend_str_tolower_copy(short_class_lcname, short_class_name, short_class_name_length); /* Improve after RC: cache the lowercase class name */ - if ((short_class_name_length == name_len) && (!memcmp(short_class_name, lcname, name_len))) { + if ((short_class_name_length == name_len) && (!memcmp(short_class_lcname, lcname, name_len))) { if (CG(active_class_entry)->constructor) { zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name); } else { @@ -1185,32 +1274,68 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name); } CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array); - } else if ((name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) { + } else if ((name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1))) { CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array); - } else if ((name_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) { + } else if ((name_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1))) { CG(active_class_entry)->clone = (zend_function *) CG(active_op_array); - } else if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) { + } else if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __call() must have public visibility and can not be static"); + } CG(active_class_entry)->__call = (zend_function *) CG(active_op_array); - } else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) { + } else if ((name_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) { + if ((fn_flags & (ZEND_ACC_PPP_MASK ^ ZEND_ACC_PUBLIC)) || (fn_flags & ZEND_ACC_STATIC) == 0) { + zend_error(E_WARNING, "The magic method __callStatic() must have public visibility and be static"); + } + CG(active_class_entry)->__callstatic = (zend_function *) CG(active_op_array); + } else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __get() must have public visibility and can not be static"); + } CG(active_class_entry)->__get = (zend_function *) CG(active_op_array); - } else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) { + } else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __set() must have public visibility and can not be static"); + } CG(active_class_entry)->__set = (zend_function *) CG(active_op_array); - } else if ((name_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)))) { + } else if ((name_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __unset() must have public visibility and can not be static"); + } CG(active_class_entry)->__unset = (zend_function *) CG(active_op_array); - } else if ((name_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)))) { + } else if ((name_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __isset() must have public visibility and can not be static"); + } CG(active_class_entry)->__isset = (zend_function *) CG(active_op_array); - } else if ((name_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)))) { + } else if ((name_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) { + if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { + zend_error(E_WARNING, "The magic method __toString() must have public visibility and can not be static"); + } CG(active_class_entry)->__tostring = (zend_function *) CG(active_op_array); } else if (!(fn_flags & ZEND_ACC_STATIC)) { CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC; } - free_alloca_with_limit(short_class_name, use_heap); + free_alloca(short_class_lcname, use_heap); } efree(lcname); } else { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); + if (CG(current_namespace)) { + /* Prefix function name with current namespcae name */ + znode tmp; + + tmp.u.constant = *CG(current_namespace); + zval_copy_ctor(&tmp.u.constant); + zend_do_build_namespace_name(&tmp, &tmp, function_name TSRMLS_CC); + op_array.function_name = Z_STRVAL(tmp.u.constant); + efree(lcname); + name_len = Z_STRLEN(tmp.u.constant); + lcname = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), name_len); + } + opline->opcode = ZEND_DECLARE_FUNCTION; opline->op1.op_type = IS_CONST; build_runtime_defined_function_key(&opline->op1.u.constant, lcname, name_len TSRMLS_CC); @@ -1218,12 +1343,12 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n opline->op2.u.constant.type = IS_STRING; opline->op2.u.constant.value.str.val = lcname; opline->op2.u.constant.value.str.len = name_len; - opline->op2.u.constant.refcount = 1; + Z_SET_REFCOUNT(opline->op2.u.constant, 1); opline->extended_value = ZEND_DECLARE_FUNCTION; zend_hash_update(CG(function_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); } - if (CG(extended_info)) { + if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_EXT_NOP; @@ -1259,8 +1384,35 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n CG(doc_comment) = NULL; CG(doc_comment_len) = 0; } + + zend_stack_push(&CG(labels_stack), (void *) &CG(labels), sizeof(HashTable*)); + CG(labels) = NULL; +} + +void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference TSRMLS_DC) +{ + znode function_name; + zend_op_array *current_op_array = CG(active_op_array); + int current_op_number = get_next_op_number(CG(active_op_array)); + zend_op *current_op; + + function_name.op_type = IS_CONST; + ZVAL_STRINGL(&function_name.u.constant, "{closure}", sizeof("{closure}")-1, 1); + + zend_do_begin_function_declaration(function_token, &function_name, 0, return_reference, NULL TSRMLS_CC); + + result->op_type = IS_TMP_VAR; + result->u.var = get_temporary_variable(current_op_array); + + current_op = ¤t_op_array->opcodes[current_op_number]; + current_op->opcode = ZEND_DECLARE_LAMBDA_FUNCTION; + zval_dtor(¤t_op->op2.u.constant); + ZVAL_LONG(¤t_op->op2.u.constant, zend_hash_func(Z_STRVAL(current_op->op1.u.constant), Z_STRLEN(current_op->op1.u.constant))); + current_op->result = *result; + CG(active_op_array)->fn_flags |= ZEND_ACC_CLOSURE; } + void zend_do_handle_exception(TSRMLS_D) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -1271,16 +1423,16 @@ void zend_do_handle_exception(TSRMLS_D) } -void zend_do_end_function_declaration(znode *function_token TSRMLS_DC) +void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) { char lcname[16]; int name_len; zend_do_extended_info(TSRMLS_C); zend_do_return(NULL, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); pass_two(CG(active_op_array) TSRMLS_CC); + zend_release_labels(TSRMLS_C); if (CG(active_class_entry)) { zend_check_magic_method_implementation(CG(active_class_entry), (zend_function*)CG(active_op_array), E_COMPILE_ERROR TSRMLS_CC); @@ -1305,12 +1457,26 @@ void zend_do_end_function_declaration(znode *function_token TSRMLS_DC) } -void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, znode *varname, zend_uchar pass_by_reference TSRMLS_DC) +void zend_do_receive_arg(zend_uchar op, const znode *var, const znode *offset, const znode *initialization, znode *class_type, const znode *varname, zend_uchar pass_by_reference TSRMLS_DC) { zend_op *opline; zend_arg_info *cur_arg_info; - if (CG(active_op_array)->scope && + if (class_type->op_type == IS_CONST && + Z_TYPE(class_type->u.constant) == IS_STRING && + Z_STRLEN(class_type->u.constant) == 0) { + /* Usage of namespace as class name not in namespace */ + zval_dtor(&class_type->u.constant); + zend_error(E_COMPILE_ERROR, "Cannot use 'namespace' as a class name"); + return; + } + + if (var->op_type == IS_CV && + var->u.var == CG(active_op_array)->this_var && + (CG(active_op_array)->fn_flags & ZEND_ACC_STATIC) == 0) { + zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); + } else if (var->op_type == IS_VAR && + CG(active_op_array)->scope && ((CG(active_op_array)->fn_flags & ZEND_ACC_STATIC) == 0) && (Z_TYPE(varname->u.constant) == IS_STRING) && (Z_STRLEN(varname->u.constant) == sizeof("this")-1) && @@ -1336,10 +1502,15 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia cur_arg_info->array_type_hint = 0; cur_arg_info->allow_null = 1; cur_arg_info->pass_by_reference = pass_by_reference; + cur_arg_info->class_name = NULL; + cur_arg_info->class_name_len = 0; if (class_type->op_type != IS_UNUSED) { cur_arg_info->allow_null = 0; if (class_type->u.constant.type == IS_STRING) { + if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant))) { + zend_resolve_class_name(class_type, &opline->extended_value, 1 TSRMLS_CC); + } cur_arg_info->class_name = class_type->u.constant.value.str.val; cur_arg_info->class_name_len = class_type->u.constant.value.str.len; if (op == ZEND_RECV_INIT) { @@ -1361,42 +1532,41 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia } } } - } else { - cur_arg_info->class_name = NULL; - cur_arg_info->class_name_len = 0; } opline->result.u.EA.type |= EXT_TYPE_UNUSED; } -int zend_do_begin_function_call(znode *function_name TSRMLS_DC) +int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace TSRMLS_DC) { zend_function *function; char *lcname; - + char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', Z_STRLEN(function_name->u.constant)); + + zend_resolve_non_class_name(function_name, check_namespace TSRMLS_CC); + + if (check_namespace && CG(current_namespace) && !is_compound) { + /* We assume we call function from the current namespace + if it is not prefixed. */ + + /* In run-time PHP will check for function with full name and + internal function with short name */ + zend_do_begin_dynamic_function_call(function_name, 1 TSRMLS_CC); + return 1; + } + lcname = zend_str_tolower_dup(function_name->u.constant.value.str.val, function_name->u.constant.value.str.len); - if (zend_hash_find(CG(function_table), lcname, function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) { - zend_do_begin_dynamic_function_call(function_name TSRMLS_CC); - efree(lcname); - return 1; /* Dynamic */ - } + if ((zend_hash_find(CG(function_table), lcname, function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) || + ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS) && + (function->type == ZEND_INTERNAL_FUNCTION))) { + zend_do_begin_dynamic_function_call(function_name, 0 TSRMLS_CC); + efree(lcname); + return 1; /* Dynamic */ + } efree(function_name->u.constant.value.str.val); function_name->u.constant.value.str.val = lcname; - switch (function->type) { - case ZEND_USER_FUNCTION: { - zend_op_array *op_array = (zend_op_array *) function; - - zend_stack_push(&CG(function_call_stack), (void *) &op_array, sizeof(zend_function *)); - } - break; - case ZEND_INTERNAL_FUNCTION: { - zend_internal_function *internal_function = (zend_internal_function *) function; - - zend_stack_push(&CG(function_call_stack), (void *) &internal_function, sizeof(zend_function *)); - } - break; - } + zend_stack_push(&CG(function_call_stack), (void *) &function, sizeof(zend_function *)); zend_do_extended_fcall_begin(TSRMLS_C); return 0; } @@ -1409,7 +1579,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) int last_op_number; unsigned char *ptr = NULL; - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); + zend_do_end_variable_parse(left_bracket, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_variable_parse(TSRMLS_C); last_op_number = get_next_op_number(CG(active_op_array))-1; @@ -1422,13 +1592,22 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) if (last_op->opcode == ZEND_FETCH_OBJ_R) { last_op->opcode = ZEND_INIT_METHOD_CALL; + SET_UNUSED(last_op->result); Z_LVAL(left_bracket->u.constant) = ZEND_INIT_FCALL_BY_NAME; } else { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_INIT_FCALL_BY_NAME; opline->op2 = *left_bracket; - opline->extended_value = 0; - SET_UNUSED(opline->op1); + if (opline->op2.op_type == IS_CONST) { + opline->op1.op_type = IS_CONST; + Z_TYPE(opline->op1.u.constant) = IS_STRING; + Z_STRVAL(opline->op1.u.constant) = zend_str_tolower_dup(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)); + Z_STRLEN(opline->op1.u.constant) = Z_STRLEN(opline->op2.u.constant); + opline->extended_value = zend_hash_func(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant) + 1); + } else { + opline->extended_value = 0; + SET_UNUSED(opline->op1); + } } zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); @@ -1436,7 +1615,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) } -void zend_do_clone(znode *result, znode *expr TSRMLS_DC) +void zend_do_clone(znode *result, const znode *expr TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -1449,28 +1628,196 @@ void zend_do_clone(znode *result, znode *expr TSRMLS_DC) } -void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC) +void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRMLS_DC) { unsigned char *ptr = NULL; - zend_op *opline; + zend_op *opline, *opline2; opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_INIT_FCALL_BY_NAME; - opline->op2 = *function_name; - opline->extended_value = 0; - - SET_UNUSED(opline->op1); + if (ns_call) { + char *slash; + int prefix_len, name_len; + /* In run-time PHP will check for function with full name and + internal function with short name */ + opline->opcode = ZEND_INIT_NS_FCALL_BY_NAME; + opline->op2 = *function_name; + opline->extended_value = 0; + opline->op1.op_type = IS_CONST; + Z_TYPE(opline->op1.u.constant) = IS_STRING; + Z_STRVAL(opline->op1.u.constant) = zend_str_tolower_dup(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)); + Z_STRLEN(opline->op1.u.constant) = Z_STRLEN(opline->op2.u.constant); + opline->extended_value = zend_hash_func(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant) + 1); + slash = zend_memrchr(Z_STRVAL(opline->op1.u.constant), '\\', Z_STRLEN(opline->op1.u.constant)); + prefix_len = slash-Z_STRVAL(opline->op1.u.constant)+1; + name_len = Z_STRLEN(opline->op1.u.constant)-prefix_len; + opline2 = get_next_op(CG(active_op_array) TSRMLS_CC); + opline2->opcode = ZEND_OP_DATA; + opline2->op1.op_type = IS_CONST; + Z_TYPE(opline2->op1.u.constant) = IS_LONG; + if(!slash) { + zend_error(E_CORE_ERROR, "Namespaced name %s should contain slash", Z_STRVAL(opline->op1.u.constant)); + } + /* this is the length of namespace prefix */ + Z_LVAL(opline2->op1.u.constant) = prefix_len; + /* this is the hash of the non-prefixed part, lowercased */ + opline2->extended_value = zend_hash_func(slash+1, name_len+1); + SET_UNUSED(opline2->op2); + } else { + opline->opcode = ZEND_INIT_FCALL_BY_NAME; + opline->op2 = *function_name; + if (opline->op2.op_type == IS_CONST) { + opline->op1.op_type = IS_CONST; + Z_TYPE(opline->op1.u.constant) = IS_STRING; + Z_STRVAL(opline->op1.u.constant) = zend_str_tolower_dup(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)); + Z_STRLEN(opline->op1.u.constant) = Z_STRLEN(opline->op2.u.constant); + opline->extended_value = zend_hash_func(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant) + 1); + } else { + opline->extended_value = 0; + SET_UNUSED(opline->op1); + } + } zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); zend_do_extended_fcall_begin(TSRMLS_C); } +void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace TSRMLS_DC) +{ + znode tmp; + int len; + zval **ns; + char *lcname, *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRLEN(element_name->u.constant)); + + if (Z_STRVAL(element_name->u.constant)[0] == '\\') { + /* name starts with \ so it is known and unambiguos, nothing to do here but shorten it */ + memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+1, Z_STRLEN(element_name->u.constant)); + --Z_STRLEN(element_name->u.constant); + return; + } + + if(!check_namespace) { + return; + } + + if (compound && CG(current_import)) { + len = compound - Z_STRVAL(element_name->u.constant); + lcname = zend_str_tolower_dup(Z_STRVAL(element_name->u.constant), len); + /* Check if first part of compound name is an import name */ + if (zend_hash_find(CG(current_import), lcname, len+1, (void**)&ns) == SUCCESS) { + /* Substitute import name */ + tmp.op_type = IS_CONST; + tmp.u.constant = **ns; + zval_copy_ctor(&tmp.u.constant); + len += 1; + Z_STRLEN(element_name->u.constant) -= len; + memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRLEN(element_name->u.constant)+1); + zend_do_build_namespace_name(&tmp, &tmp, element_name TSRMLS_CC); + *element_name = tmp; + efree(lcname); + return; + } + efree(lcname); + } + + if (CG(current_namespace)) { + tmp = *element_name; + Z_STRLEN(tmp.u.constant) = sizeof("\\")-1 + Z_STRLEN(element_name->u.constant) + Z_STRLEN_P(CG(current_namespace)); + Z_STRVAL(tmp.u.constant) = (char *) emalloc(Z_STRLEN(tmp.u.constant)+1); + memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace))); + memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace))]), "\\", sizeof("\\")-1); + memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRLEN(element_name->u.constant)+1); + STR_FREE(Z_STRVAL(element_name->u.constant)); + *element_name = tmp; + } +} + +void zend_resolve_class_name(znode *class_name, ulong *fetch_type, int check_ns_name TSRMLS_DC) +{ + char *compound; + char *lcname; + zval **ns; + znode tmp; + int len; + + compound = memchr(Z_STRVAL(class_name->u.constant), '\\', Z_STRLEN(class_name->u.constant)); + if (compound) { + /* This is a compound class name that contains namespace prefix */ + if (Z_STRVAL(class_name->u.constant)[0] == '\\') { + /* The STRING name has "\" prefix */ + Z_STRLEN(class_name->u.constant) -= 1; + memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant)+1); + Z_STRVAL(class_name->u.constant) = erealloc( + Z_STRVAL(class_name->u.constant), + Z_STRLEN(class_name->u.constant) + 1); + + if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { + zend_error(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant)); + } + } else { + if (CG(current_import)) { + len = compound - Z_STRVAL(class_name->u.constant); + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), len); + /* Check if first part of compound name is an import name */ + if (zend_hash_find(CG(current_import), lcname, len+1, (void**)&ns) == SUCCESS) { + /* Substitute import name */ + tmp.op_type = IS_CONST; + tmp.u.constant = **ns; + zval_copy_ctor(&tmp.u.constant); + len += 1; + Z_STRLEN(class_name->u.constant) -= len; + memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+len, Z_STRLEN(class_name->u.constant)+1); + zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); + *class_name = tmp; + efree(lcname); + return; + } + efree(lcname); + } + /* Here name is not prefixed with \ and not imported */ + if (CG(current_namespace)) { + tmp.op_type = IS_CONST; + tmp.u.constant = *CG(current_namespace); + zval_copy_ctor(&tmp.u.constant); + zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); + *class_name = tmp; + } + } + } else if (CG(current_import) || CG(current_namespace)) { + /* this is a plain name (without \) */ + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); + + if (CG(current_import) && + zend_hash_find(CG(current_import), lcname, Z_STRLEN(class_name->u.constant)+1, (void**)&ns) == SUCCESS) { + /* The given name is an import name. Substitute it. */ + zval_dtor(&class_name->u.constant); + class_name->u.constant = **ns; + zval_copy_ctor(&class_name->u.constant); + } else if (CG(current_namespace)) { + /* plain name, no import - prepend current namespace to it */ + tmp.op_type = IS_CONST; + tmp.u.constant = *CG(current_namespace); + zval_copy_ctor(&tmp.u.constant); + zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); + *class_name = tmp; + } + efree(lcname); + } +} void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) { long fetch_class_op_number; zend_op *opline; + if (class_name->op_type == IS_CONST && + Z_TYPE(class_name->u.constant) == IS_STRING && + Z_STRLEN(class_name->u.constant) == 0) { + /* Usage of namespace as class name not in namespace */ + zval_dtor(&class_name->u.constant); + zend_error(E_COMPILE_ERROR, "Cannot use 'namespace' as a class name"); + return; + } + fetch_class_op_number = get_next_op_number(CG(active_op_array)); opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -1485,11 +1832,13 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) switch (fetch_type) { case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: + case ZEND_FETCH_CLASS_STATIC: SET_UNUSED(opline->op2); opline->extended_value = fetch_type; zval_dtor(&class_name->u.constant); break; default: + zend_resolve_class_name(class_name, &opline->extended_value, 0 TSRMLS_CC); opline->op2 = *class_name; break; } @@ -1498,57 +1847,179 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) } opline->result.u.var = get_temporary_variable(CG(active_op_array)); opline->result.u.EA.type = opline->extended_value; - opline->result.op_type = IS_CONST; /* FIXME: Hack so that INIT_FCALL_BY_NAME still knows this is a class */ + opline->result.op_type = IS_VAR; /* FIXME: Hack so that INIT_FCALL_BY_NAME still knows this is a class */ *result = opline->result; } +void zend_do_label(znode *label TSRMLS_DC) /* {{{ */ +{ + zend_op_array *oparray = CG(active_op_array); + zend_label dest; + + if (!CG(labels)) { + ALLOC_HASHTABLE(CG(labels)); + zend_hash_init(CG(labels), 4, NULL, NULL, 0); + } + + dest.brk_cont = oparray->current_brk_cont; + dest.opline_num = get_next_op_number(oparray); + + if (zend_hash_add(CG(labels), Z_STRVAL(label->u.constant), Z_STRLEN(label->u.constant) + 1, (void**)&dest, sizeof(zend_label), NULL) == FAILURE) { + zend_error(E_COMPILE_ERROR, "Label '%s' already defined", Z_STRVAL(label->u.constant)); + } + + /* Done with label now */ + zval_dtor(&label->u.constant); +} +/* }}} */ + +void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 TSRMLS_DC) /* {{{ */ +{ + zend_label *dest; + long current, distance; + + if (CG(labels) == NULL || + zend_hash_find(CG(labels), Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void**)&dest) == FAILURE) { + + if (pass2) { + CG(in_compilation) = 1; + CG(active_op_array) = op_array; + CG(zend_lineno) = opline->lineno; + zend_error(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL(opline->op2.u.constant)); + } else { + /* Label is not defined. Delay to pass 2. */ + INC_BPC(op_array); + return; + } + } + + opline->op1.u.opline_num = dest->opline_num; + zval_dtor(&opline->op2.u.constant); + + /* Check that we are not moving into loop or switch */ + current = opline->extended_value; + for (distance = 0; current != dest->brk_cont; distance++) { + if (current == -1) { + if (pass2) { + CG(in_compilation) = 1; + CG(active_op_array) = op_array; + CG(zend_lineno) = opline->lineno; + } + zend_error(E_COMPILE_ERROR, "'goto' into loop or switch statement is disallowed"); + } + current = op_array->brk_cont_array[current].parent; + } + + if (distance == 0) { + /* Nothing to break out of, optimize to ZEND_JMP */ + opline->opcode = ZEND_JMP; + opline->extended_value = 0; + SET_UNUSED(opline->op2); + } else { + /* Set real break distance */ + ZVAL_LONG(&opline->op2.u.constant, distance); + } + + if (pass2) { + DEC_BPC(op_array); + } +} +/* }}} */ + +void zend_do_goto(const znode *label TSRMLS_DC) /* {{{ */ +{ + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + opline->opcode = ZEND_GOTO; + opline->extended_value = CG(active_op_array)->current_brk_cont; + SET_UNUSED(opline->op1); + opline->op2 = *label; + zend_resolve_goto_label(CG(active_op_array), opline, 0 TSRMLS_CC); +} +/* }}} */ + +void zend_release_labels(TSRMLS_D) /* {{{ */ +{ + if (CG(labels)) { + zend_hash_destroy(CG(labels)); + FREE_HASHTABLE(CG(labels)); + } + if (!zend_stack_is_empty(&CG(labels_stack))) { + HashTable **pht; + + zend_stack_top(&CG(labels_stack), (void**)&pht); + CG(labels) = *pht; + zend_stack_del_top(&CG(labels_stack)); + } else { + CG(labels) = NULL; + } +} +/* }}} */ -void zend_do_fetch_class_name(znode *result, znode *class_name_entry, znode *class_name TSRMLS_DC) +void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_class_member TSRMLS_DC) { zend_uint length; if (!result) { - result = class_name_entry; + result = prefix; } else { - *result = *class_name_entry; + *result = *prefix; } - length = sizeof("::")-1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len; - result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], class_name->u.constant.value.str.val, class_name->u.constant.value.str.len+1); - STR_FREE(class_name->u.constant.value.str.val); - result->u.constant.value.str.len = length; + if (is_class_member) { + length = sizeof("::")-1 + result->u.constant.value.str.len + name->u.constant.value.str.len; + result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1); + memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1); + memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], name->u.constant.value.str.val, name->u.constant.value.str.len+1); + STR_FREE(name->u.constant.value.str.val); + result->u.constant.value.str.len = length; + } else { + length = sizeof("\\")-1 + result->u.constant.value.str.len + name->u.constant.value.str.len; + result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1); + memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "\\", sizeof("\\")-1); + memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("\\")-1], name->u.constant.value.str.val, name->u.constant.value.str.len+1); + STR_FREE(name->u.constant.value.str.val); + result->u.constant.value.str.len = length; + } } -void zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC) +int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC) { + znode class_node; unsigned char *ptr = NULL; - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; - opline->op1 = *class_name; - opline->op2 = *method_name; + zend_op *opline; + ulong fetch_type = 0; - if (opline->op2.op_type == IS_CONST) { - char *lcname = zend_str_tolower_dup(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)); - if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(opline->op2.u.constant) && + if (method_name->op_type == IS_CONST) { + char *lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRLEN(method_name->u.constant)); + if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(method_name->u.constant) && memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) { - zval_dtor(&opline->op2.u.constant); - SET_UNUSED(opline->op2); - efree(lcname); - } else { - efree(opline->op2.u.constant.value.str.val); - opline->op2.u.constant.value.str.val = lcname; + zval_dtor(&method_name->u.constant); + SET_UNUSED(*method_name); } + efree(lcname); + } + + if (class_name->op_type == IS_CONST && + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { + fetch_type = ZEND_FETCH_CLASS_GLOBAL; + zend_resolve_class_name(class_name, &fetch_type, 1 TSRMLS_CC); + class_node = *class_name; + } else { + zend_do_fetch_class(&class_node, class_name TSRMLS_CC); } + opline = get_next_op(CG(active_op_array) TSRMLS_CC); + opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; + opline->op1 = class_node; + opline->op2 = *method_name; zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); zend_do_extended_fcall_begin(TSRMLS_C); + return 1; /* Dynamic */ } -void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC) +void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC) { zend_op *opline; @@ -1563,6 +2034,7 @@ void zend_do_end_function_call(znode *function_name, znode *result, znode *argum if (!is_method && !is_dynamic_fcall && function_name->op_type==IS_CONST) { opline->opcode = ZEND_DO_FCALL; opline->op1 = *function_name; + ZVAL_LONG(&opline->op2.u.constant, zend_hash_func(Z_STRVAL(function_name->u.constant), Z_STRLEN(function_name->u.constant) + 1)); } else { opline->opcode = ZEND_DO_FCALL_BY_NAME; SET_UNUSED(opline->op1); @@ -1595,13 +2067,13 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) function_ptr->common.function_name && function_ptr->common.type == ZEND_USER_FUNCTION && !ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) { - zend_error(E_COMPILE_WARNING, + zend_error(E_DEPRECATED, "Call-time pass-by-reference has been deprecated; " "If you would like to pass it by reference, modify the declaration of %s(). " "If you would like to enable call-time pass-by-reference, you can set " "allow_call_time_pass_reference to true in your INI file", function_ptr->common.function_name); } else { - zend_error(E_COMPILE_WARNING, "Call-time pass-by-reference has been deprecated"); + zend_error(E_DEPRECATED, "Call-time pass-by-reference has been deprecated"); } } @@ -1649,17 +2121,17 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) if (original_op == ZEND_SEND_VAR) { switch (op) { case ZEND_SEND_VAR_NO_REF: - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); + zend_do_end_variable_parse(param, BP_VAR_R, 0 TSRMLS_CC); break; case ZEND_SEND_VAR: if (function_ptr) { - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); + zend_do_end_variable_parse(param, BP_VAR_R, 0 TSRMLS_CC); } else { - zend_do_end_variable_parse(BP_VAR_FUNC_ARG, offset TSRMLS_CC); + zend_do_end_variable_parse(param, BP_VAR_FUNC_ARG, offset TSRMLS_CC); } break; case ZEND_SEND_REF: - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); + zend_do_end_variable_parse(param, BP_VAR_W, 0 TSRMLS_CC); break; } } @@ -1686,7 +2158,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) } -static int generate_free_switch_expr(zend_switch_entry *switch_entry TSRMLS_DC) +static int generate_free_switch_expr(const zend_switch_entry *switch_entry TSRMLS_DC) { zend_op *opline; @@ -1696,14 +2168,14 @@ static int generate_free_switch_expr(zend_switch_entry *switch_entry TSRMLS_DC) opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_SWITCH_FREE; + opline->opcode = (switch_entry->cond.op_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE; opline->op1 = switch_entry->cond; SET_UNUSED(opline->op2); opline->extended_value = 0; return 0; } -static int generate_free_foreach_copy(zend_op *foreach_copy TSRMLS_DC) +static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) { zend_op *opline; @@ -1714,7 +2186,7 @@ static int generate_free_foreach_copy(zend_op *foreach_copy TSRMLS_DC) opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_SWITCH_FREE; + opline->opcode = (foreach_copy->result.op_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE; opline->op1 = foreach_copy->result; SET_UNUSED(opline->op2); opline->extended_value = 1; @@ -1722,7 +2194,7 @@ static int generate_free_foreach_copy(zend_op *foreach_copy TSRMLS_DC) if (foreach_copy->op1.op_type != IS_UNUSED) { opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_SWITCH_FREE; + opline->opcode = (foreach_copy->op1.op_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE; opline->op1 = foreach_copy->op1; SET_UNUSED(opline->op2); opline->extended_value = 0; @@ -1734,15 +2206,18 @@ static int generate_free_foreach_copy(zend_op *foreach_copy TSRMLS_DC) void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) { zend_op *opline; + int start_op_number, end_op_number; if (do_end_vparse) { if (CG(active_op_array)->return_reference && !zend_is_function_or_method_call(expr)) { - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); + zend_do_end_variable_parse(expr, BP_VAR_W, 0 TSRMLS_CC); } else { - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); + zend_do_end_variable_parse(expr, BP_VAR_R, 0 TSRMLS_CC); } } + start_op_number = get_next_op_number(CG(active_op_array)); + #ifdef ZTS zend_stack_apply_with_argument(&CG(switch_cond_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_switch_expr TSRMLS_CC); zend_stack_apply_with_argument(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_foreach_copy TSRMLS_CC); @@ -1751,6 +2226,12 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) zend_stack_apply(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_foreach_copy); #endif + end_op_number = get_next_op_number(CG(active_op_array)); + while (start_op_number < end_op_number) { + CG(active_op_array)->opcodes[start_op_number].op1.u.EA.type = EXT_TYPE_FREE_ON_RETURN; + start_op_number++; + } + opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_RETURN; @@ -1791,7 +2272,7 @@ void zend_do_first_catch(znode *open_parentheses TSRMLS_DC) } -void zend_initialize_try_catch_element(znode *try_token TSRMLS_DC) +void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC) { int jmp_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -1812,7 +2293,7 @@ void zend_initialize_try_catch_element(znode *try_token TSRMLS_DC) } -void zend_do_mark_last_catch(znode *first_catch, znode *last_additional_catch TSRMLS_DC) +void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additional_catch TSRMLS_DC) { CG(active_op_array)->last--; zend_do_if_end(TSRMLS_C); @@ -1834,11 +2315,15 @@ void zend_do_try(znode *try_token TSRMLS_DC) } -void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC) +void zend_do_begin_catch(znode *try_token, znode *class_name, const znode *catch_var, znode *first_catch TSRMLS_DC) { - long catch_op_number = get_next_op_number(CG(active_op_array)); + long catch_op_number; zend_op *opline; + znode catch_class; + zend_do_fetch_class(&catch_class, class_name TSRMLS_CC); + + catch_op_number = get_next_op_number(CG(active_op_array)); if (catch_op_number > 0) { opline = &CG(active_op_array)->opcodes[catch_op_number-1]; if (opline->opcode == ZEND_FETCH_CLASS) { @@ -1846,17 +2331,23 @@ void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, } } + if (first_catch) { + first_catch->u.opline_num = catch_op_number; + } + opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_CATCH; - opline->op1 = *catch_class; + opline->op1 = catch_class; /* SET_UNUSED(opline->op1); */ /* FIXME: Define IS_CLASS or something like that */ - opline->op2 = *catch_var; + opline->op2.op_type = IS_CV; + opline->op2.u.var = lookup_cv(CG(active_op_array), catch_var->u.constant.value.str.val, catch_var->u.constant.value.str.len); + opline->op2.u.EA.type = 0; opline->op1.u.EA.type = 0; /* 1 means it's the last catch in the block */ try_token->u.opline_num = catch_op_number; } -void zend_do_end_catch(znode *try_token TSRMLS_DC) +void zend_do_end_catch(const znode *try_token TSRMLS_DC) { int jmp_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -1873,7 +2364,7 @@ void zend_do_end_catch(znode *try_token TSRMLS_DC) CG(active_op_array)->opcodes[try_token->u.opline_num].extended_value = get_next_op_number(CG(active_op_array)); } -void zend_do_throw(znode *expr TSRMLS_DC) +void zend_do_throw(const znode *expr TSRMLS_DC) { zend_op *opline; @@ -1933,6 +2424,9 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) if (!ce->__call) { ce->__call = ce->parent->__call; } + if (!ce->__callstatic) { + ce->__callstatic = ce->parent->__callstatic; + } if (!ce->__tostring) { ce->__tostring = ce->parent->__tostring; } @@ -1970,10 +2464,11 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) lc_class_name = zend_str_tolower_dup(ce->name, ce->name_length); if (!zend_hash_exists(&ce->function_table, lc_class_name, ce->name_length+1)) { lc_parent_class_name = zend_str_tolower_dup(ce->parent->name, ce->parent->name_length); - if (zend_hash_find(&ce->parent->function_table, lc_parent_class_name, ce->parent->name_length+1, (void **)&function)==SUCCESS) { + if (!zend_hash_exists(&ce->function_table, lc_parent_class_name, ce->parent->name_length+1) && + zend_hash_find(&ce->parent->function_table, lc_parent_class_name, ce->parent->name_length+1, (void **)&function)==SUCCESS) { if (function->common.fn_flags & ZEND_ACC_CTOR) { /* inherit parent's constructor */ - zend_hash_update(&ce->function_table, lc_class_name, ce->name_length+1, function, sizeof(zend_function), NULL); + zend_hash_update(&ce->function_table, lc_parent_class_name, ce->parent->name_length+1, function, sizeof(zend_function), NULL); function_add_ref(function); } } @@ -2010,7 +2505,7 @@ static void do_inherit_method(zend_function *function) } -static zend_bool zend_do_perform_implementation_check(zend_function *fe, zend_function *proto) +static zend_bool zend_do_perform_implementation_check(const zend_function *fe, const zend_function *proto) { zend_uint i; @@ -2025,7 +2520,7 @@ static zend_bool zend_do_perform_implementation_check(zend_function *fe, zend_fu } /* check number of arguments */ - if (proto->common.required_num_args != fe->common.required_num_args + if (proto->common.required_num_args < fe->common.required_num_args || proto->common.num_args > fe->common.num_args) { return 0; } @@ -2046,7 +2541,14 @@ static zend_bool zend_do_perform_implementation_check(zend_function *fe, zend_fu } if (fe->common.arg_info[i].class_name && strcasecmp(fe->common.arg_info[i].class_name, proto->common.arg_info[i].class_name)!=0) { - return 0; + char *colon; + + if (fe->common.type != ZEND_USER_FUNCTION || + strchr(proto->common.arg_info[i].class_name, '\\') != NULL || + (colon = zend_memrchr(fe->common.arg_info[i].class_name, '\\', fe->common.arg_info[i].class_name_len)) == NULL || + strcasecmp(colon+1, proto->common.arg_info[i].class_name) != 0) { + return 0; + } } if (fe->common.arg_info[i].array_type_hint != proto->common.arg_info[i].array_type_hint) { /* Only one has an array type hint and the other one doesn't */ @@ -2068,7 +2570,7 @@ static zend_bool zend_do_perform_implementation_check(zend_function *fe, zend_fu } -static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_function *parent, zend_hash_key *hash_key, zend_class_entry *child_ce) +static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_function *parent, const zend_hash_key *hash_key, zend_class_entry *child_ce) { zend_uint child_flags; zend_uint parent_flags = parent->common.fn_flags; @@ -2148,7 +2650,7 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f } -static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_property_info *parent_info, zend_hash_key *hash_key, zend_class_entry *ce) +static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_property_info *parent_info, const zend_hash_key *hash_key, zend_class_entry *ce) { zend_property_info *child_info; zend_class_entry *parent_ce = ce->parent; @@ -2189,8 +2691,8 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro zval **pvalue; if (zend_hash_quick_find(&parent_ce->default_properties, parent_info->name, parent_info->name_length+1, parent_info->h, (void **) &pvalue) == SUCCESS) { - (*pvalue)->refcount++; - zend_hash_del(&ce->default_properties, child_info->name, child_info->name_length+1); + Z_ADDREF_PP(pvalue); + zend_hash_quick_del(&ce->default_properties, child_info->name, child_info->name_length+1, parent_info->h); zend_hash_quick_update(&ce->default_properties, parent_info->name, parent_info->name_length+1, parent_info->h, pvalue, sizeof(zval *), NULL); } } @@ -2213,18 +2715,6 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro ht = &parent_ce->default_static_members; } if (zend_hash_find(ht, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) { - zval **new_prop; - if (zend_hash_find(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) { - if (Z_TYPE_PP(new_prop) != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) { - char *prop_name, *tmp; - zend_unmangle_property_name(child_info->name, child_info->name_length, &tmp, &prop_name); - - zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %s::$%s in class %s", - parent_ce->name, prop_name, ce->name); - } - } - (*prop)->refcount++; - zend_hash_update(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL); zend_hash_del(&ce->default_static_members, prot_name, prot_name_length+1); } } else { @@ -2251,7 +2741,7 @@ static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry } -ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) +ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface TSRMLS_DC) { /* expects interface to be contained in ce's interface list already */ zend_uint i, ce_num, if_num = iface->num_interfaces; @@ -2287,14 +2777,14 @@ ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, zend_class_entry } } -static int inherit_static_prop(zval **p, int num_args, va_list args, zend_hash_key *key) +static int inherit_static_prop(zval **p TSRMLS_DC, int num_args, va_list args, const zend_hash_key *key) { HashTable *target = va_arg(args, HashTable*); if (!zend_hash_quick_exists(target, key->arKey, key->nKeyLength, key->h)) { SEPARATE_ZVAL_TO_MAKE_IS_REF(p); if (zend_hash_quick_add(target, key->arKey, key->nKeyLength, key->h, p, sizeof(zval*), NULL) == SUCCESS) { - (*p)->refcount++; + Z_ADDREF_PP(p); } } return ZEND_HASH_APPLY_KEEP; @@ -2311,6 +2801,14 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent } ce->parent = parent_ce; + /* Copy serialize/unserialize callbacks */ + if (!ce->serialize) { + ce->serialize = parent_ce->serialize; + } + if (!ce->unserialize) { + ce->unserialize = parent_ce->unserialize; + } + /* Inherit interfaces */ zend_do_inherit_interfaces(ce, parent_ce TSRMLS_CC); @@ -2319,9 +2817,9 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent if (parent_ce->type != ce->type) { /* User class extends internal class */ zend_update_class_constants(parent_ce TSRMLS_CC); - zend_hash_apply_with_arguments(CE_STATIC_MEMBERS(parent_ce), (apply_func_args_t)inherit_static_prop, 1, &ce->default_static_members); + zend_hash_apply_with_arguments(CE_STATIC_MEMBERS(parent_ce) TSRMLS_CC, (apply_func_args_t)inherit_static_prop, 1, &ce->default_static_members); } else { - zend_hash_apply_with_arguments(&parent_ce->default_static_members, (apply_func_args_t)inherit_static_prop, 1, &ce->default_static_members TSRMLS_CC); + zend_hash_apply_with_arguments(&parent_ce->default_static_members TSRMLS_CC, (apply_func_args_t)inherit_static_prop, 1, &ce->default_static_members); } zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal : zend_duplicate_property_info), sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce); @@ -2331,13 +2829,14 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS && ce->type == ZEND_INTERNAL_CLASS) { ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; - } else { + } else if (!(ce->ce_flags & ZEND_ACC_IMPLEMENT_INTERFACES)) { + /* The verification will be done in runtime by ZEND_VERIFY_ABSTRACT_CLASS */ zend_verify_abstract_class(ce TSRMLS_CC); } } -static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zval **parent_constant, zend_hash_key *hash_key, zend_class_entry *iface) +static zend_bool do_inherit_constant_check(HashTable *child_constants_table, const zval **parent_constant, const zend_hash_key *hash_key, const zend_class_entry *iface) { zval **old_constant; @@ -2420,7 +2919,7 @@ ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, zend_b } -ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC) +ZEND_API zend_class_entry *do_bind_class(const zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC) { zend_class_entry *ce, **pce; @@ -2443,7 +2942,7 @@ ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *class_table } return NULL; } else { - if (!(ce->ce_flags & ZEND_ACC_INTERFACE)) { + if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLEMENT_INTERFACES))) { zend_verify_abstract_class(ce TSRMLS_CC); } return ce; @@ -2451,7 +2950,7 @@ ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *class_table } -ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC) +ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC) { zend_class_entry *ce, **pce; int found_ce; @@ -2499,7 +2998,6 @@ void zend_do_early_binding(TSRMLS_D) { zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; HashTable *table; - zend_bool is_abstract_class = 0; while (opline->opcode == ZEND_TICKS && opline > CG(active_op_array)->opcodes) { opline--; @@ -2513,57 +3011,44 @@ void zend_do_early_binding(TSRMLS_D) table = CG(function_table); break; case ZEND_DECLARE_CLASS: + if (do_bind_class(opline, CG(class_table), 1 TSRMLS_CC) == NULL) { + return; + } + table = CG(class_table); + break; case ZEND_DECLARE_INHERITED_CLASS: - is_abstract_class = 1; - /* break missing intentionally */ - case ZEND_VERIFY_ABSTRACT_CLASS: { - zend_op *verify_abstract_class_op = opline; - - if (!is_abstract_class) { - opline--; - } - if (opline->opcode == ZEND_DECLARE_CLASS) { - if (do_bind_class(opline, CG(class_table), 1 TSRMLS_CC) == NULL) { - return; - } - } else if (opline->opcode == ZEND_DECLARE_INHERITED_CLASS) { - zval *parent_name = &(opline-1)->op2.u.constant; - zend_class_entry **pce; - - if (zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRLEN_P(parent_name), &pce TSRMLS_CC) == FAILURE) { - return; - } - if (do_bind_inherited_class(opline, CG(class_table), *pce, 1 TSRMLS_CC) == NULL) { - return; - } - /* clear unnecessary ZEND_FETCH_CLASS opcode */ - if (opline > CG(active_op_array)->opcodes && - (opline-1)->opcode == ZEND_FETCH_CLASS) { - zend_op *fetch_class_opline = opline-1; - - zval_dtor(&fetch_class_opline->op2.u.constant); - fetch_class_opline->opcode = ZEND_NOP; - memset(&fetch_class_opline->op1, 0, sizeof(znode)); - memset(&fetch_class_opline->op2, 0, sizeof(znode)); - SET_UNUSED(fetch_class_opline->op1); - SET_UNUSED(fetch_class_opline->op2); - SET_UNUSED(fetch_class_opline->result); + { + zend_op *fetch_class_opline = opline-1; + zval *parent_name = &fetch_class_opline->op2.u.constant; + zend_class_entry **pce; + + if ((zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRLEN_P(parent_name), &pce TSRMLS_CC) == FAILURE) || + ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES) && + ((*pce)->type == ZEND_INTERNAL_CLASS))) { + if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) { + zend_uint *opline_num = &CG(active_op_array)->early_binding; + + while (*opline_num != -1) { + opline_num = &CG(active_op_array)->opcodes[*opline_num].result.u.opline_num; + } + *opline_num = opline - CG(active_op_array)->opcodes; + opline->opcode = ZEND_DECLARE_INHERITED_CLASS_DELAYED; + opline->result.op_type = IS_UNUSED; + opline->result.u.opline_num = -1; } - } else { - /* We currently don't early-bind classes that implement interfaces */ return; } - table = CG(class_table); - if (!is_abstract_class) { - /* clear the verify_abstract_class op */ - init_op(verify_abstract_class_op TSRMLS_CC); - SET_UNUSED(verify_abstract_class_op->op1); - SET_UNUSED(verify_abstract_class_op->op2); - verify_abstract_class_op->opcode = ZEND_NOP; + if (do_bind_inherited_class(opline, CG(class_table), *pce, 1 TSRMLS_CC) == NULL) { + return; } - } + /* clear unnecessary ZEND_FETCH_CLASS opcode */ + zval_dtor(&fetch_class_opline->op2.u.constant); + MAKE_NOP(fetch_class_opline); - break; + table = CG(class_table); + break; + } + case ZEND_VERIFY_ABSTRACT_CLASS: case ZEND_ADD_INTERFACE: /* We currently don't early-bind classes that implement interfaces */ return; @@ -2575,13 +3060,26 @@ void zend_do_early_binding(TSRMLS_D) zend_hash_del(table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len); zval_dtor(&opline->op1.u.constant); zval_dtor(&opline->op2.u.constant); - opline->opcode = ZEND_NOP; - memset(&opline->op1, 0, sizeof(znode)); - memset(&opline->op2, 0, sizeof(znode)); - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); + MAKE_NOP(opline); } +ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC) +{ + if (op_array->early_binding != -1) { + zend_bool orig_in_compilation = CG(in_compilation); + zend_uint opline_num = op_array->early_binding; + zend_class_entry **pce; + + CG(in_compilation) = 1; + while (opline_num != -1) { + if (zend_lookup_class(Z_STRVAL(op_array->opcodes[opline_num-1].op2.u.constant), Z_STRLEN(op_array->opcodes[opline_num-1].op2.u.constant), &pce TSRMLS_CC) == SUCCESS) { + do_bind_inherited_class(&op_array->opcodes[opline_num], EG(class_table), *pce, 1 TSRMLS_CC); + } + opline_num = op_array->opcodes[opline_num].result.u.opline_num; + } + CG(in_compilation) = orig_in_compilation; + } +} void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC) { @@ -2604,7 +3102,7 @@ void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC) } -void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC) +void zend_do_boolean_or_end(znode *result, const znode *expr1, const znode *expr2, znode *op_token TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2639,7 +3137,7 @@ void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC) } -void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC) +void zend_do_boolean_and_end(znode *result, const znode *expr1, const znode *expr2, const znode *op_token TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2660,7 +3158,7 @@ void zend_do_do_while_begin(TSRMLS_D) } -void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC) +void zend_do_do_while_end(const znode *do_token, const znode *expr_open_bracket, const znode *expr TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2675,7 +3173,7 @@ void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr } -void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC) +void zend_do_brk_cont(zend_uchar op, const znode *expr TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2693,7 +3191,7 @@ void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC) } -void zend_do_switch_cond(znode *cond TSRMLS_DC) +void zend_do_switch_cond(const znode *cond TSRMLS_DC) { zend_switch_entry switch_entry; @@ -2709,7 +3207,7 @@ void zend_do_switch_cond(znode *cond TSRMLS_DC) -void zend_do_switch_end(znode *case_list TSRMLS_DC) +void zend_do_switch_end(const znode *case_list TSRMLS_DC) { zend_op *opline; zend_switch_entry *switch_entry_ptr; @@ -2738,7 +3236,7 @@ void zend_do_switch_end(znode *case_list TSRMLS_DC) if (switch_entry_ptr->cond.op_type==IS_VAR || switch_entry_ptr->cond.op_type==IS_TMP_VAR) { /* emit free for the switch condition*/ opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_SWITCH_FREE; + opline->opcode = (switch_entry_ptr->cond.op_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE; opline->op1 = switch_entry_ptr->cond; SET_UNUSED(opline->op2); } @@ -2752,7 +3250,7 @@ void zend_do_switch_end(znode *case_list TSRMLS_DC) } -void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC) +void zend_do_case_before_statement(const znode *case_list, znode *case_token, const znode *case_expr TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); int next_op_number; @@ -2789,7 +3287,7 @@ void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *c } -void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC) +void zend_do_case_after_statement(znode *result, const znode *case_token TSRMLS_DC) { int next_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2811,7 +3309,7 @@ void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC) -void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC) +void zend_do_default_before_statement(const znode *case_list, znode *default_token TSRMLS_DC) { int next_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2834,12 +3332,14 @@ void zend_do_default_before_statement(znode *case_list, znode *default_token TSR } -void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC) +void zend_do_begin_class_declaration(const znode *class_token, znode *class_name, const znode *parent_class_name TSRMLS_DC) { zend_op *opline; int doing_inheritance = 0; zend_class_entry *new_class_entry; char *lcname; + int error = 0; + zval **ns_name; if (CG(active_class_entry)) { zend_error(E_COMPILE_ERROR, "Class declarations may not be nested"); @@ -2853,6 +3353,34 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod zend_error(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", class_name->u.constant.value.str.val); } + /* Class name must not conflict with import names */ + if (CG(current_import) && + zend_hash_find(CG(current_import), lcname, Z_STRLEN(class_name->u.constant)+1, (void**)&ns_name) == SUCCESS) { + error = 1; + } + + if (CG(current_namespace)) { + /* Prefix class name with name of current namespace */ + znode tmp; + + tmp.u.constant = *CG(current_namespace); + zval_copy_ctor(&tmp.u.constant); + zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); + class_name = &tmp; + efree(lcname); + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); + } + + if (error) { + char *tmp = zend_str_tolower_dup(Z_STRVAL_PP(ns_name), Z_STRLEN_PP(ns_name)); + + if (Z_STRLEN_PP(ns_name) != Z_STRLEN(class_name->u.constant) || + memcmp(tmp, lcname, Z_STRLEN(class_name->u.constant))) { + zend_error(E_COMPILE_ERROR, "Cannot declare class %s because the name is already in use", Z_STRVAL(class_name->u.constant)); + } + efree(tmp); + } + new_class_entry = emalloc(sizeof(zend_class_entry)); new_class_entry->type = ZEND_USER_CLASS; new_class_entry->name = class_name->u.constant.value.str.val; @@ -2871,6 +3399,9 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod case ZEND_FETCH_CLASS_PARENT: zend_error(E_COMPILE_ERROR, "Cannot use 'parent' as class name as it is reserved"); break; + case ZEND_FETCH_CLASS_STATIC: + zend_error(E_COMPILE_ERROR, "Cannot use 'static' as class name as it is reserved"); + break; default: break; } @@ -2883,7 +3414,7 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod opline->op2.op_type = IS_CONST; opline->op2.u.constant.type = IS_STRING; - opline->op2.u.constant.refcount = 1; + Z_SET_REFCOUNT(opline->op2.u.constant, 1); if (doing_inheritance) { opline->extended_value = parent_class_name->u.var; @@ -2899,7 +3430,7 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod CG(active_class_entry) = new_class_entry; opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_CONST; + opline->result.op_type = IS_VAR; CG(implementing_class) = opline->result; if (CG(doc_comment)) { @@ -2921,7 +3452,7 @@ static void do_verify_abstract_class(TSRMLS_D) } -void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRMLS_DC) +void zend_do_end_class_declaration(const znode *class_token, const znode *parent_token TSRMLS_DC) { zend_class_entry *ce = CG(active_class_entry); @@ -2956,45 +3487,43 @@ void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRML } } /* Inherit interfaces; reset number to zero, we need it for above check and - * will restore it during actual implementation. */ + * will restore it during actual implementation. + * The ZEND_ACC_IMPLEMENT_INTERFACES flag disables double call to + * zend_verify_abstract_class() */ if (ce->num_interfaces > 0) { ce->interfaces = NULL; ce->num_interfaces = 0; + ce->ce_flags |= ZEND_ACC_IMPLEMENT_INTERFACES; } CG(active_class_entry) = NULL; } -void zend_do_implements_interface(znode *interface_znode TSRMLS_DC) +void zend_do_implements_interface(znode *interface_name TSRMLS_DC) { zend_op *opline; - switch (interface_znode->u.EA.type) { + switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRLEN(interface_name->u.constant))) { case ZEND_FETCH_CLASS_SELF: - zend_error(E_COMPILE_ERROR, "Cannot use 'self' as interface name as it is reserved"); - break; case ZEND_FETCH_CLASS_PARENT: - zend_error(E_COMPILE_ERROR, "Cannot use 'parent' as interface name as it is reserved"); + case ZEND_FETCH_CLASS_STATIC: + zend_error(E_COMPILE_ERROR, "Cannot use '%s' as interface name as it is reserved", Z_STRVAL(interface_name->u.constant)); break; default: - if (CG(active_op_array)->last > 0) { - opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; - if (opline->opcode == ZEND_FETCH_CLASS) { - opline->extended_value = ZEND_FETCH_CLASS_INTERFACE; - } - } break; } opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_ADD_INTERFACE; opline->op1 = CG(implementing_class); - opline->op2 = *interface_znode; - opline->extended_value = CG(active_class_entry)->num_interfaces++; + zend_resolve_class_name(interface_name, &opline->extended_value, 0 TSRMLS_CC); + opline->extended_value = (opline->extended_value & ~ZEND_FETCH_CLASS_MASK) | ZEND_FETCH_CLASS_INTERFACE; + opline->op2 = *interface_name; + CG(active_class_entry)->num_interfaces++; } -ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal) +ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal) { char *prop_name; int prop_name_length; @@ -3044,7 +3573,7 @@ ZEND_API int zend_unmangle_property_name(char *mangled_property, int len, char * return SUCCESS; } -void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC) +void zend_do_declare_property(const znode *var_name, const znode *value, zend_uint access_type TSRMLS_DC) { zval *property; zend_property_info *existing_property_info; @@ -3090,7 +3619,7 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty } -void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC) +void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_DC) { zval *property; @@ -3110,19 +3639,20 @@ void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC) -void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC) +void zend_do_fetch_property(znode *result, znode *object, const znode *property TSRMLS_DC) { zend_op opline; zend_llist *fetch_list_ptr; - zend_op *opline_ptr=NULL; zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - if (fetch_list_ptr->count == 1) { - zend_llist_element *le; - - le = fetch_list_ptr->head; - opline_ptr = (zend_op *) le->data; + if (object->op_type == IS_CV) { + if (object->u.var == CG(active_op_array)->this_var) { + SET_UNUSED(*object); /* this means $this for objects */ + } + } else if (fetch_list_ptr->count == 1) { + zend_llist_element *le = fetch_list_ptr->head; + zend_op *opline_ptr = (zend_op *) le->data; if (opline_is_fetch_this(opline_ptr TSRMLS_CC)) { efree(Z_STRVAL(opline_ptr->op1.u.constant)); @@ -3173,8 +3703,7 @@ void zend_do_halt_compiler_register(TSRMLS_D) int len, clen; cfilename = zend_get_compiled_filename(TSRMLS_C); clen = strlen(cfilename); - zend_mangle_property_name(&name, &len, haltoff, - sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0); + zend_mangle_property_name(&name, &len, haltoff, sizeof(haltoff) - 1, cfilename, clen, 0); zend_register_long_constant(name, len+1, zend_get_scanned_file_offset(TSRMLS_C), CONST_CS, 0 TSRMLS_CC); pefree(name, 0); } @@ -3213,7 +3742,7 @@ void zend_do_declare_implicit_property(TSRMLS_D) } -void zend_do_push_object(znode *object TSRMLS_DC) +void zend_do_push_object(const znode *object TSRMLS_DC) { zend_stack_push(&CG(object_stack), object, sizeof(znode)); } @@ -3248,7 +3777,7 @@ void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC) } -void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC) +void zend_do_end_new_object(znode *result, const znode *new_token, const znode *argument_list TSRMLS_DC) { znode ctor_result; @@ -3259,23 +3788,54 @@ void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_lis *result = CG(active_op_array)->opcodes[new_token->u.opline_num].result; } -static int zend_constant_ct_subst(znode *result, zval *const_name TSRMLS_DC) +static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal_constants_substitution TSRMLS_DC) /* {{{ */ { zend_constant *c = NULL; - if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)+1, (void **) &c) == FAILURE) { + if (Z_STRVAL_P(const_name)[0] == '\\') { + if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name), (void **) &c) == FAILURE) { + char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name)-1); + + if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name), (void **) &c)==SUCCESS) { + if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) { + efree(lookup_name); + return c; + } + } + efree(lookup_name); + return NULL; + } + } else if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)+1, (void **) &c) == FAILURE) { char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)); if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name)+1, (void **) &c)==SUCCESS) { - if ((c->flags & CONST_CS) && memcmp(c->name, Z_STRVAL_P(const_name), Z_STRLEN_P(const_name))!=0) { - c = NULL; + if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) { + efree(lookup_name); + return c; } - } else { - c = NULL; } efree(lookup_name); + return NULL; + } + if (c->flags & CONST_CT_SUBST) { + return c; + } + if (all_internal_constants_substitution && + (c->flags & CONST_PERSISTENT) && + !(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION) && + Z_TYPE(c->value) != IS_CONSTANT && + Z_TYPE(c->value) != IS_CONSTANT_ARRAY) { + return c; } - if (c && (c->flags & CONST_CT_SUBST)) { + return NULL; +} +/* }}} */ + +static int zend_constant_ct_subst(znode *result, zval *const_name, int all_internal_constants_substitution TSRMLS_DC) /* {{{ */ +{ + zend_constant *c = zend_get_ct_const(const_name, all_internal_constants_substitution TSRMLS_CC); + + if (c) { zval_dtor(const_name); result->op_type = IS_CONST; result->u.constant = c->value; @@ -3285,46 +3845,103 @@ static int zend_constant_ct_subst(znode *result, zval *const_name TSRMLS_DC) } return 0; } +/* }}} */ -void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC) +void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC) /* {{{ */ { - switch (mode) { - case ZEND_CT: - if (constant_container) { - zend_do_fetch_class_name(NULL, constant_container, constant_name TSRMLS_CC); + znode tmp; + zend_op *opline; + int type; + char *compound; + ulong fetch_type = 0; + + if (constant_container) { + switch (mode) { + case ZEND_CT: + /* this is a class constant */ + type = zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant)); + + if (ZEND_FETCH_CLASS_STATIC == type) { + zend_error(E_ERROR, "\"static::\" is not allowed in compile-time constants"); + } else if (ZEND_FETCH_CLASS_DEFAULT == type) { + zend_resolve_class_name(constant_container, &fetch_type, 1 TSRMLS_CC); + } + zend_do_build_full_name(NULL, constant_container, constant_name, 1 TSRMLS_CC); *result = *constant_container; - result->u.constant.type = IS_CONSTANT; - } else if (!zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) { - *result = *constant_name; - result->u.constant.type = IS_CONSTANT; - } - break; - case ZEND_RT: - if (constant_container || - !zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - + result->u.constant.type = IS_CONSTANT | fetch_type; + break; + case ZEND_RT: + if (constant_container->op_type == IS_CONST && + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant))) { + zend_resolve_class_name(constant_container, &fetch_type, 1 TSRMLS_CC); + } else { + zend_do_fetch_class(&tmp, constant_container TSRMLS_CC); + constant_container = &tmp; + } + opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_FETCH_CONSTANT; opline->result.op_type = IS_TMP_VAR; opline->result.u.var = get_temporary_variable(CG(active_op_array)); - if (constant_container) { - opline->op1 = *constant_container; - } else { - SET_UNUSED(opline->op1); - } + opline->op1 = *constant_container; opline->op2 = *constant_name; *result = opline->result; + break; + } + return; + } + /* namespace constant */ + /* only one that did not contain \ from the start can be converted to string if unknown */ + switch (mode) { + case ZEND_CT: + compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); + /* this is a namespace constant, or an unprefixed constant */ + + if (zend_constant_ct_subst(result, &constant_name->u.constant, 0 TSRMLS_CC)) { + break; } + + zend_resolve_non_class_name(constant_name, check_namespace TSRMLS_CC); + + if(!compound) { + fetch_type |= IS_CONSTANT_UNQUALIFIED; + } + + *result = *constant_name; + result->u.constant.type = IS_CONSTANT | fetch_type; + break; + case ZEND_RT: + compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); + + zend_resolve_non_class_name(constant_name, check_namespace TSRMLS_CC); + + if(zend_constant_ct_subst(result, &constant_name->u.constant, 1 TSRMLS_CC)) { + break; + } + + opline = get_next_op(CG(active_op_array) TSRMLS_CC); + opline->opcode = ZEND_FETCH_CONSTANT; + opline->result.op_type = IS_TMP_VAR; + opline->result.u.var = get_temporary_variable(CG(active_op_array)); + *result = opline->result; + SET_UNUSED(opline->op1); + if(compound) { + /* the name is unambiguous */ + opline->extended_value = 0; + } else { + opline->extended_value = IS_CONSTANT_UNQUALIFIED; + } + opline->op2 = *constant_name; break; } } -void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC) +void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); switch (cmd->op_type) { + case IS_CONST: case IS_TMP_VAR: opline->opcode = ZEND_SEND_VAL; break; @@ -3349,12 +3966,13 @@ void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC) opline->op1.op_type = IS_CONST; opline->extended_value = 1; SET_UNUSED(opline->op2); + ZVAL_LONG(&opline->op2.u.constant, zend_hash_func("shell_exec", sizeof("shell_exec"))); *result = opline->result; } -void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC) +void zend_do_init_array(znode *result, const znode *expr, const znode *offset, zend_bool is_ref TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -3377,7 +3995,7 @@ void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ } -void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC) +void zend_do_add_array_element(znode *result, const znode *expr, const znode *offset, zend_bool is_ref TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -3394,18 +4012,23 @@ void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_b -void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr) +void zend_do_add_static_array_element(znode *result, znode *offset, const znode *expr) { zval *element; ALLOC_ZVAL(element); *element = expr->u.constant; if (offset) { - switch (offset->u.constant.type) { + switch (offset->u.constant.type & IS_CONSTANT_TYPE_MASK) { case IS_CONSTANT: /* Ugly hack to denote that this value has a constant index */ Z_TYPE_P(element) |= IS_CONSTANT_INDEX; - /* break missing intentionally */ + Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3); + Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant); + Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0; + zend_symtable_update(result->u.constant.value.ht, Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL); + zval_dtor(&offset->u.constant); + break; case IS_STRING: zend_symtable_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); @@ -3430,7 +4053,7 @@ void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr) } -void zend_do_add_list_element(znode *element TSRMLS_DC) +void zend_do_add_list_element(const znode *element TSRMLS_DC) { list_llist_element lle; @@ -3534,7 +4157,7 @@ void zend_do_list_end(znode *result, znode *expr TSRMLS_DC) } } -void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC) +void zend_do_fetch_static_variable(znode *varname, const znode *static_assignment, int fetch_type TSRMLS_DC) { zval *tmp; zend_op *opline; @@ -3554,14 +4177,20 @@ void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int } zend_hash_update(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1, &tmp, sizeof(zval *), NULL); + if (varname->op_type == IS_CONST) { + if (Z_TYPE(varname->u.constant) != IS_STRING) { + convert_to_string(&varname->u.constant); + } + } + opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */ + opline->opcode = (fetch_type == ZEND_FETCH_LEXICAL) ? ZEND_FETCH_R : ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */ opline->result.op_type = IS_VAR; opline->result.u.EA.type = 0; opline->result.u.var = get_temporary_variable(CG(active_op_array)); opline->op1 = *varname; SET_UNUSED(opline->op2); - opline->op2.u.EA.type = fetch_type; + opline->op2.u.EA.type = ZEND_FETCH_STATIC; result = opline->result; if (varname->op_type == IS_CONST) { @@ -3569,18 +4198,51 @@ void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int } fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */ - zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC); + if (fetch_type == ZEND_FETCH_LEXICAL) { + znode dummy; + + zend_do_begin_variable_parse(TSRMLS_C); + zend_do_assign(&dummy, &lval, &result TSRMLS_CC); + zend_do_free(&dummy TSRMLS_CC); + } else { + zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC); + } CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; /* zval_dtor(&varname->u.constant); */ } -void zend_do_fetch_global_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC) +void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC) +{ + znode value; + + if (Z_STRLEN(varname->u.constant) == sizeof("this") - 1 && + memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1) == 0) { + zend_error(E_COMPILE_ERROR, "Cannot use $this as lexical variable"); + return; + } + + value.op_type = IS_CONST; + ZVAL_NULL(&value.u.constant); + Z_TYPE(value.u.constant) |= is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR; + Z_SET_REFCOUNT_P(&value.u.constant, 1); + Z_UNSET_ISREF_P(&value.u.constant); + + zend_do_fetch_static_variable(varname, &value, is_ref ? ZEND_FETCH_STATIC : ZEND_FETCH_LEXICAL TSRMLS_CC); +} + +void zend_do_fetch_global_variable(znode *varname, const znode *static_assignment, int fetch_type TSRMLS_DC) { zend_op *opline; znode lval; znode result; + if (varname->op_type == IS_CONST) { + if (Z_TYPE(varname->u.constant) != IS_STRING) { + convert_to_string(&varname->u.constant); + } + } + opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */ opline->result.op_type = IS_VAR; @@ -3601,7 +4263,7 @@ void zend_do_fetch_global_variable(znode *varname, znode *static_assignment, int } -void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC) +void zend_do_cast(znode *result, const znode *expr, int type TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -3615,7 +4277,7 @@ void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC) } -void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC) +void zend_do_include_or_eval(int type, znode *result, const znode *op1 TSRMLS_DC) { zend_do_extended_fcall_begin(TSRMLS_C); { @@ -3633,11 +4295,11 @@ void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC) } -void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC) +void zend_do_indirect_references(znode *result, const znode *num_references, znode *variable TSRMLS_DC) { int i; - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); + zend_do_end_variable_parse(variable, BP_VAR_R, 0 TSRMLS_CC); for (i=1; iu.constant.value.lval; i++) { fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R TSRMLS_CC); *variable = *result; @@ -3647,7 +4309,7 @@ void zend_do_indirect_references(znode *result, znode *num_references, znode *va } -void zend_do_unset(znode *variable TSRMLS_DC) +void zend_do_unset(const znode *variable TSRMLS_DC) { zend_op *last_op; @@ -3656,13 +4318,11 @@ void zend_do_unset(znode *variable TSRMLS_DC) if (variable->op_type == IS_CV) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_UNSET_VAR; - opline->op1.op_type = IS_CONST; - opline->op1.u.constant.type = IS_STRING; - opline->op1.u.constant.value.str.len = CG(active_op_array)->vars[variable->u.var].name_len; - opline->op1.u.constant.value.str.val = estrdup(CG(active_op_array)->vars[variable->u.var].name); + opline->op1 = *variable; SET_UNUSED(opline->op2); opline->op2.u.EA.type = ZEND_FETCH_LOCAL; SET_UNUSED(opline->result); + opline->extended_value = ZEND_QUICK_SET; } else { last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1]; @@ -3686,20 +4346,18 @@ void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC { zend_op *last_op; - zend_do_end_variable_parse(BP_VAR_IS, 0 TSRMLS_CC); + zend_do_end_variable_parse(variable, BP_VAR_IS, 0 TSRMLS_CC); zend_check_writable_variable(variable); if (variable->op_type == IS_CV) { last_op = get_next_op(CG(active_op_array) TSRMLS_CC); last_op->opcode = ZEND_ISSET_ISEMPTY_VAR; - last_op->op1.op_type = IS_CONST; - last_op->op1.u.constant.type = IS_STRING; - last_op->op1.u.constant.value.str.len = CG(active_op_array)->vars[variable->u.var].name_len; - last_op->op1.u.constant.value.str.val = estrdup(CG(active_op_array)->vars[variable->u.var].name); + last_op->op1 = *variable; SET_UNUSED(last_op->op2); last_op->op2.u.EA.type = ZEND_FETCH_LOCAL; last_op->result.u.var = get_temporary_variable(CG(active_op_array)); + last_op->extended_value = ZEND_QUICK_SET; } else { last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1]; @@ -3714,15 +4372,16 @@ void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC last_op->opcode = ZEND_ISSET_ISEMPTY_PROP_OBJ; break; } + last_op->extended_value = 0; } last_op->result.op_type = IS_TMP_VAR; - last_op->extended_value = type; + last_op->extended_value |= type; *result = last_op->result; } -void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC) +void zend_do_instanceof(znode *result, const znode *expr, const znode *class_znode, int type TSRMLS_DC) { int last_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline; @@ -3765,7 +4424,7 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno } /* save the location of FETCH_W instruction(s) */ open_brackets_token->u.opline_num = get_next_op_number(CG(active_op_array)); - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); + zend_do_end_variable_parse(array, BP_VAR_W, 0 TSRMLS_CC); if (CG(active_op_array)->last > 0 && CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode == ZEND_FETCH_OBJ_W) { /* Only lock the container if we are fetching from a real container and not $this */ @@ -3822,7 +4481,7 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno } -void zend_do_foreach_cont(znode *foreach_token, znode *open_brackets_token, znode *as_token, znode *value, znode *key TSRMLS_DC) +void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token, const znode *as_token, znode *value, znode *key TSRMLS_DC) { zend_op *opline; znode dummy, value_node; @@ -3875,8 +4534,8 @@ void zend_do_foreach_cont(znode *foreach_token, znode *open_brackets_token, znod value_node = opline->result; if (assign_by_ref) { + zend_do_end_variable_parse(value, BP_VAR_W, 0 TSRMLS_CC); /* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */ - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC); } else { zend_do_assign(&dummy, value, &value_node TSRMLS_CC); @@ -3901,7 +4560,7 @@ void zend_do_foreach_cont(znode *foreach_token, znode *open_brackets_token, znod } -void zend_do_foreach_end(znode *foreach_token, znode *as_token TSRMLS_DC) +void zend_do_foreach_end(const znode *foreach_token, const znode *as_token TSRMLS_DC) { zend_op *container_ptr; zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -3935,14 +4594,38 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "ticks", sizeof("ticks")-1)) { convert_to_long(&val->u.constant); CG(declarables).ticks = val->u.constant; + + zend_error(E_DEPRECATED, "Ticks is deprecated and will be removed in PHP 6"); #ifdef ZEND_MULTIBYTE } else if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "encoding", sizeof("encoding")-1)) { zend_encoding *new_encoding, *old_encoding; zend_encoding_filter old_input_filter; - if (Z_TYPE(val->u.constant) == IS_CONSTANT) { + if ((Z_TYPE(val->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_error(E_COMPILE_ERROR, "Cannot use constants as encoding"); } + + /* + * Check that the pragma comes before any opcodes. If the compilation + * got as far as this, the previous portion of the script must have been + * parseable according to the .ini script_encoding setting. We still + * want to tell them to put declare() at the top. + */ + { + int num = CG(active_op_array)->last; + /* ignore ZEND_EXT_STMT and ZEND_TICKS */ + while (num > 0 && + (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT || + CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) { + --num; + } + + if (num > 0 || CG(encoding_declared)) { + zend_error(E_COMPILE_ERROR, "Encoding declaration pragma must be the very first statement in the script"); + } + } + CG(encoding_declared) = 1; + convert_to_string(&val->u.constant); new_encoding = zend_multibyte_fetch_encoding(val->u.constant.value.str.val); if (!new_encoding) { @@ -3960,15 +4643,21 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) } } efree(val->u.constant.value.str.val); +#else /* !ZEND_MULTIBYTE */ + } else if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "encoding", sizeof("encoding")-1)) { + /* Do not generate any kind of warning for encoding declares */ + /* zend_error(E_COMPILE_WARNING, "Declare encoding [%s] not supported", val->u.constant.value.str.val); */ + zval_dtor(&val->u.constant); #endif /* ZEND_MULTIBYTE */ } else { + zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", var->u.constant.value.str.val); zval_dtor(&val->u.constant); } zval_dtor(&var->u.constant); } -void zend_do_declare_end(znode *declare_token TSRMLS_DC) +void zend_do_declare_end(const znode *declare_token TSRMLS_DC) { zend_declarables *declarables; @@ -3980,7 +4669,7 @@ void zend_do_declare_end(znode *declare_token TSRMLS_DC) } -void zend_do_exit(znode *result, znode *message TSRMLS_DC) +void zend_do_exit(znode *result, const znode *message TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -4006,7 +4695,7 @@ void zend_do_begin_silence(znode *strudel_token TSRMLS_DC) } -void zend_do_end_silence(znode *strudel_token TSRMLS_DC) +void zend_do_end_silence(const znode *strudel_token TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -4016,7 +4705,44 @@ void zend_do_end_silence(znode *strudel_token TSRMLS_DC) } -void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC) +void zend_do_jmp_set(const znode *value, znode *jmp_token, znode *colon_token TSRMLS_DC) +{ + int op_number = get_next_op_number(CG(active_op_array)); + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + opline->opcode = ZEND_JMP_SET; + opline->result.op_type = IS_TMP_VAR; + opline->result.u.var = get_temporary_variable(CG(active_op_array)); + opline->op1 = *value; + SET_UNUSED(opline->op2); + + *colon_token = opline->result; + + jmp_token->u.opline_num = op_number; + + INC_BPC(CG(active_op_array)); +} + + +void zend_do_jmp_set_else(znode *result, const znode *false_value, const znode *jmp_token, const znode *colon_token TSRMLS_DC) +{ + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + opline->opcode = ZEND_QM_ASSIGN; + opline->extended_value = 0; + opline->result = *colon_token; + opline->op1 = *false_value; + SET_UNUSED(opline->op2); + + *result = opline->result; + + CG(active_op_array)->opcodes[jmp_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); + + DEC_BPC(CG(active_op_array)); +} + + +void zend_do_begin_qm_op(const znode *cond, znode *qm_token TSRMLS_DC) { int jmpz_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline; @@ -4033,7 +4759,7 @@ void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC) } -void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC) +void zend_do_qm_true(const znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -4055,7 +4781,7 @@ void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRM } -void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC) +void zend_do_qm_false(znode *result, const znode *false_value, const znode *qm_token, const znode *colon_token TSRMLS_DC) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -4076,7 +4802,7 @@ void zend_do_extended_info(TSRMLS_D) { zend_op *opline; - if (!CG(extended_info)) { + if (!(CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO)) { return; } @@ -4092,7 +4818,7 @@ void zend_do_extended_fcall_begin(TSRMLS_D) { zend_op *opline; - if (!CG(extended_info)) { + if (!(CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO)) { return; } @@ -4108,7 +4834,7 @@ void zend_do_extended_fcall_end(TSRMLS_D) { zend_op *opline; - if (!CG(extended_info)) { + if (!(CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO)) { return; } @@ -4138,7 +4864,7 @@ void zend_auto_global_dtor(zend_auto_global *auto_global) } -zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC) +zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC) { zend_auto_global *auto_global; @@ -4152,7 +4878,7 @@ zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC) } -int zend_register_auto_global(char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC) +int zend_register_auto_global(const char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC) { zend_auto_global auto_global; @@ -4187,6 +4913,9 @@ again: if (LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-1] != '>') { CG(increment_lineno) = 1; } + if (CG(has_bracketed_namespaces) && !CG(in_namespace)) { + goto again; + } retval = ';'; /* implicit ; */ break; case T_OPEN_TAG_WITH_ECHO: @@ -4195,8 +4924,6 @@ again: case T_END_HEREDOC: efree(Z_STRVAL(zendlval->u.constant)); break; - case EOF: - return EOF; } INIT_PZVAL(&zendlval->u.constant); @@ -4250,11 +4977,13 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify ce->__unset = NULL; ce->__isset = NULL; ce->__call = NULL; + ce->__callstatic = NULL; ce->__tostring = NULL; ce->create_object = NULL; ce->get_iterator = NULL; ce->iterator_funcs.funcs = NULL; ce->interface_gets_implemented = NULL; + ce->get_static_method = NULL; ce->parent = NULL; ce->num_interfaces = 0; ce->interfaces = NULL; @@ -4268,20 +4997,23 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify } -int zend_get_class_fetch_type(char *class_name, uint class_name_len) +int zend_get_class_fetch_type(const char *class_name, uint class_name_len) { if ((class_name_len == sizeof("self")-1) && - !memcmp(class_name, "self", sizeof("self"))) { + !memcmp(class_name, "self", sizeof("self")-1)) { return ZEND_FETCH_CLASS_SELF; } else if ((class_name_len == sizeof("parent")-1) && - !memcmp(class_name, "parent", sizeof("parent"))) { + !memcmp(class_name, "parent", sizeof("parent")-1)) { return ZEND_FETCH_CLASS_PARENT; + } else if ((class_name_len == sizeof("static")-1) && + !memcmp(class_name, "static", sizeof("static")-1)) { + return ZEND_FETCH_CLASS_STATIC; } else { return ZEND_FETCH_CLASS_DEFAULT; } } -ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len) +ZEND_API char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len) { if (name_len) { *name_len = op_array->vars[var].name_len; @@ -4289,6 +5021,342 @@ ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uin return op_array->vars[var].name; } +void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRMLS_DC) /* {{{ */ +{ + if (prefix) { + *result = *prefix; + if (Z_TYPE(result->u.constant) == IS_STRING && + Z_STRLEN(result->u.constant) == 0) { + /* namespace\ */ + if (CG(current_namespace)) { + znode tmp; + + zval_dtor(&result->u.constant); + tmp.op_type = IS_CONST; + tmp.u.constant = *CG(current_namespace); + zval_copy_ctor(&tmp.u.constant); + zend_do_build_namespace_name(result, NULL, &tmp TSRMLS_CC); + } + } + } else { + result->op_type = IS_CONST; + Z_TYPE(result->u.constant) = IS_STRING; + Z_STRVAL(result->u.constant) = NULL; + Z_STRLEN(result->u.constant) = 0; + } + /* prefix = result */ + zend_do_build_full_name(NULL, result, name, 0 TSRMLS_CC); +} +/* }}} */ + +void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC) /* {{{ */ +{ + char *lcname; + + /* handle mixed syntax declaration or nested namespaces */ + if (!CG(has_bracketed_namespaces)) { + if (CG(current_namespace)) { + /* previous namespace declarations were unbracketed */ + if (with_bracket) { + zend_error(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations"); + } + } + } else { + /* previous namespace declarations were bracketed */ + if (!with_bracket) { + zend_error(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations"); + } else if (CG(current_namespace) || CG(in_namespace)) { + zend_error(E_COMPILE_ERROR, "Namespace declarations cannot be nested"); + } + } + + if (((!with_bracket && !CG(current_namespace)) || (with_bracket && !CG(has_bracketed_namespaces))) && CG(active_op_array)->last > 0) { + /* ignore ZEND_EXT_STMT and ZEND_TICKS */ + int num = CG(active_op_array)->last; + while (num > 0 && + (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT || + CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) { + --num; + } + if (num > 0) { + zend_error(E_COMPILE_ERROR, "Namespace declaration statement has to be the very first statement in the script"); + } + } + + CG(in_namespace) = 1; + if (with_bracket) { + CG(has_bracketed_namespaces) = 1; + } + + if (name) { + lcname = zend_str_tolower_dup(Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)); + if (((Z_STRLEN(name->u.constant) == sizeof("self")-1) && + !memcmp(lcname, "self", sizeof("self")-1)) || + ((Z_STRLEN(name->u.constant) == sizeof("parent")-1) && + !memcmp(lcname, "parent", sizeof("parent")-1))) { + zend_error(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", Z_STRVAL(name->u.constant)); + } + efree(lcname); + + if (CG(current_namespace)) { + zval_dtor(CG(current_namespace)); + } else { + ALLOC_ZVAL(CG(current_namespace)); + } + *CG(current_namespace) = name->u.constant; + } else { + if (CG(current_namespace)) { + zval_dtor(CG(current_namespace)); + FREE_ZVAL(CG(current_namespace)); + CG(current_namespace) = NULL; + } + } + + if (CG(current_import)) { + zend_hash_destroy(CG(current_import)); + efree(CG(current_import)); + CG(current_import) = NULL; + } +} +/* }}} */ + +void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */ +{ + char *lcname; + zval *name, *ns, tmp; + zend_bool warn = 0; + zend_class_entry **pce; + + if (!CG(current_import)) { + CG(current_import) = emalloc(sizeof(HashTable)); + zend_hash_init(CG(current_import), 0, NULL, ZVAL_PTR_DTOR, 0); + } + + ALLOC_ZVAL(ns); + *ns = ns_name->u.constant; + if (new_name) { + name = &new_name->u.constant; + } else { + char *p; + + /* The form "use A\B" is eqivalent to "use A\B as B". + So we extract the last part of compound name to use as a new_name */ + name = &tmp; + p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRLEN_P(ns)); + if (p) { + ZVAL_STRING(name, p+1, 1); + } else { + *name = *ns; + zval_copy_ctor(name); + warn = !is_global && !CG(current_namespace); + } + } + + lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + + if (((Z_STRLEN_P(name) == sizeof("self")-1) && + !memcmp(lcname, "self", sizeof("self")-1)) || + ((Z_STRLEN_P(name) == sizeof("parent")-1) && + !memcmp(lcname, "parent", sizeof("parent")-1))) { + zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name)); + } + + if (CG(current_namespace)) { + /* Prefix import name with current namespace name to avoid conflicts with classes */ + char *ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) + 1); + + zend_str_tolower_copy(ns_name, Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace))); + ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\'; + memcpy(ns_name+Z_STRLEN_P(CG(current_namespace))+1, lcname, Z_STRLEN_P(name)+1); + if (zend_hash_exists(CG(class_table), ns_name, Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) { + char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + + if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) || + memcmp(tmp, ns_name, Z_STRLEN_P(ns))) { + zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + efree(tmp); + } + efree(ns_name); + } else if (zend_hash_find(CG(class_table), lcname, Z_STRLEN_P(name)+1, (void**)&pce) == SUCCESS && + (*pce)->type == ZEND_USER_CLASS && + (*pce)->filename == CG(compiled_filename)) { + char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + + if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) || + memcmp(tmp, lcname, Z_STRLEN_P(ns))) { + zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + efree(tmp); + } + + if (zend_hash_add(CG(current_import), lcname, Z_STRLEN_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) { + zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + if (warn) { + zend_error(E_WARNING, "The use statement with non-compound name '%s' has no effect", Z_STRVAL_P(name)); + } + efree(lcname); + zval_dtor(name); +} +/* }}} */ + +void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ +{ + zend_op *opline; + + if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) { + zend_error(E_COMPILE_ERROR, "Arrays are not allowed as constants"); + } + + if (zend_get_ct_const(&name->u.constant, 0 TSRMLS_CC)) { + zend_error(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant)); + } + + if (CG(current_namespace)) { + /* Prefix constant name with name of current namespace, lowercased */ + znode tmp; + + tmp.op_type = IS_CONST; + tmp.u.constant = *CG(current_namespace); + Z_STRVAL(tmp.u.constant) = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), Z_STRLEN(tmp.u.constant)); + zend_do_build_namespace_name(&tmp, &tmp, name TSRMLS_CC); + *name = tmp; + } + + opline = get_next_op(CG(active_op_array) TSRMLS_CC); + opline->opcode = ZEND_DECLARE_CONST; + SET_UNUSED(opline->result); + opline->op1 = *name; + opline->op2 = *value; +} +/* }}} */ + +void zend_verify_namespace(TSRMLS_D) /* {{{ */ +{ + if (CG(has_bracketed_namespaces) && !CG(in_namespace)) { + zend_error(E_COMPILE_ERROR, "No code may exist outside of namespace {}"); + } +} +/* }}} */ + +void zend_do_end_namespace(TSRMLS_D) /* {{{ */ +{ + CG(in_namespace) = 0; + if (CG(current_namespace)) { + zval_dtor(CG(current_namespace)); + FREE_ZVAL(CG(current_namespace)); + CG(current_namespace) = NULL; + } + if (CG(current_import)) { + zend_hash_destroy(CG(current_import)); + efree(CG(current_import)); + CG(current_import) = NULL; + } +} +/* }}} */ + +void zend_do_end_compilation(TSRMLS_D) /* {{{ */ +{ + CG(has_bracketed_namespaces) = 0; + zend_do_end_namespace(TSRMLS_C); +} +/* }}} */ + +/* {{{ zend_dirname + Returns directory name component of path */ +ZEND_API size_t zend_dirname(char *path, size_t len) +{ + register char *end = path + len - 1; + unsigned int len_adjust = 0; + +#ifdef PHP_WIN32 + /* Note that on Win32 CWD is per drive (heritage from CP/M). + * This means dirname("c:foo") maps to "c:." or "c:" - which means CWD on C: drive. + */ + if ((2 <= len) && isalpha((int)((unsigned char *)path)[0]) && (':' == path[1])) { + /* Skip over the drive spec (if any) so as not to change */ + path += 2; + len_adjust += 2; + if (2 == len) { + /* Return "c:" on Win32 for dirname("c:"). + * It would be more consistent to return "c:." + * but that would require making the string *longer*. + */ + return len; + } + } +#elif defined(NETWARE) + /* + * Find the first occurence of : from the left + * move the path pointer to the position just after : + * increment the len_adjust to the length of path till colon character(inclusive) + * If there is no character beyond : simple return len + */ + char *colonpos = NULL; + colonpos = strchr(path, ':'); + if (colonpos != NULL) { + len_adjust = ((colonpos - path) + 1); + path += len_adjust; + if (len_adjust == len) { + return len; + } + } +#endif + + if (len == 0) { + /* Illegal use of this function */ + return 0; + } + + /* Strip trailing slashes */ + while (end >= path && IS_SLASH_P(end)) { + end--; + } + if (end < path) { + /* The path only contained slashes */ + path[0] = DEFAULT_SLASH; + path[1] = '\0'; + return 1 + len_adjust; + } + + /* Strip filename */ + while (end >= path && !IS_SLASH_P(end)) { + end--; + } + if (end < path) { + /* No slash found, therefore return '.' */ +#ifdef NETWARE + if (len_adjust == 0) { + path[0] = '.'; + path[1] = '\0'; + return 1; /* only one character */ + } else { + path[0] = '\0'; + return len_adjust; + } +#else + path[0] = '.'; + path[1] = '\0'; + return 1 + len_adjust; +#endif + } + + /* Strip slashes which came before the file name */ + while (end >= path && IS_SLASH_P(end)) { + end--; + } + if (end < path) { + path[0] = DEFAULT_SLASH; + path[1] = '\0'; + return 1 + len_adjust; + } + *(end+1) = '\0'; + + return (size_t)(end + 1 - path) + len_adjust; +} +/* }}} */ + /* * Local variables: * tab-width: 4 diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index fed2b78d3..0227c5582 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.316.2.8.2.16 2009/01/21 10:15:46 dmitry Exp $ */ +/* $Id: zend_compile.h,v 1.316.2.8.2.12.2.39 2009/01/26 22:54:20 cseiler Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -73,7 +73,8 @@ typedef struct _zend_execute_data zend_execute_data; #define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data TSRMLS_DC #define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data TSRMLS_CC -typedef int (*opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS); +typedef int (*user_opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS); +typedef int (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS); extern ZEND_API opcode_handler_t *zend_opcode_handlers; @@ -95,6 +96,10 @@ typedef struct _zend_brk_cont_element { int parent; } zend_brk_cont_element; +typedef struct _zend_label { + int brk_cont; + zend_uint opline_num; +} zend_label; typedef struct _zend_try_catch_element { zend_uint try_op; @@ -143,6 +148,14 @@ typedef struct _zend_try_catch_element { /* deprecation flag */ #define ZEND_ACC_DEPRECATED 0x40000 +/* class implement interface(s) flag */ +#define ZEND_ACC_IMPLEMENT_INTERFACES 0x80000 + +#define ZEND_ACC_CLOSURE 0x100000 + +/* function flag for internal user call handlers __call, __callstatic */ +#define ZEND_ACC_CALL_VIA_HANDLER 0x200000 + char *zend_visibility_string(zend_uint fn_flags); @@ -158,9 +171,9 @@ typedef struct _zend_property_info { typedef struct _zend_arg_info { - char *name; + const char *name; zend_uint name_len; - char *class_name; + const char *class_name; zend_uint class_name_len; zend_bool array_type_hint; zend_bool allow_null; @@ -189,6 +202,8 @@ struct _zend_op_array { unsigned char return_reference; /* END of common elements */ + zend_bool done_pass_two; + zend_uint *refcount; zend_op *opcodes; @@ -200,8 +215,8 @@ struct _zend_op_array { zend_uint T; zend_brk_cont_element *brk_cont_array; - zend_uint last_brk_cont; - zend_uint current_brk_cont; + int last_brk_cont; + int current_brk_cont; zend_try_catch_element *try_catch_array; int last_try_catch; @@ -212,14 +227,14 @@ struct _zend_op_array { zend_op *start_op; int backpatch_count; - zend_bool done_pass_two; - zend_bool uses_this; + zend_uint this_var; char *filename; zend_uint line_start; zend_uint line_end; char *doc_comment; zend_uint doc_comment_len; + zend_uint early_binding; /* the linked list of delayed declarations */ void *reserved[ZEND_MAX_RESERVED_RESOURCES]; }; @@ -270,9 +285,8 @@ typedef union _zend_function { typedef struct _zend_function_state { - HashTable *function_symbol_table; zend_function *function; - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; + void **arguments; } zend_function_state; @@ -295,14 +309,21 @@ struct _zend_execute_data { struct _zend_op *opline; zend_function_state function_state; zend_function *fbc; /* Function Being Called */ + zend_class_entry *called_scope; zend_op_array *op_array; zval *object; union _temp_variable *Ts; zval ***CVs; - zend_bool original_in_execution; HashTable *symbol_table; struct _zend_execute_data *prev_execute_data; zval *old_error_reporting; + zend_bool nested; + zval **original_return_value; + zend_class_entry *current_scope; + zend_class_entry *current_called_scope; + zval *current_this; + zval *current_object; + struct _zend_op *call_opline; }; #define EX(element) execute_data.element @@ -314,7 +335,8 @@ struct _zend_execute_data { #define IS_UNUSED (1<<3) /* Unused variable */ #define IS_CV (1<<4) /* Compiled variable */ -#define EXT_TYPE_UNUSED (1<<0) +#define EXT_TYPE_UNUSED (1<<0) +#define EXT_TYPE_FREE_ON_RETURN (2<<0) #include "zend_globals.h" @@ -331,13 +353,15 @@ ZEND_API int lex_scan(zval *zendlval TSRMLS_DC); void startup_scanner(TSRMLS_D); void shutdown_scanner(TSRMLS_D); -ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC); +ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC); ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC); ZEND_API char *zend_get_compiled_filename(TSRMLS_D); ZEND_API int zend_get_compiled_lineno(TSRMLS_D); -ZEND_API int zend_get_scanned_file_offset(TSRMLS_D); +ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D); -ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len); +void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace TSRMLS_DC); +void zend_resolve_class_name(znode *class_name, ulong *fetch_type, int check_ns_name TSRMLS_DC); +ZEND_API char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len); #ifdef ZTS const char *zend_get_zendtext(TSRMLS_D); @@ -346,155 +370,162 @@ int zend_get_zendleng(TSRMLS_D); /* parser-driven code generators */ -void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC); -void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC); -void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC); -void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC); -void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC); +void zend_do_binary_op(zend_uchar op, znode *result, const znode *op1, const znode *op2 TSRMLS_DC); +void zend_do_unary_op(zend_uchar op, znode *result, const znode *op1 TSRMLS_DC); +void zend_do_binary_assign_op(zend_uchar op, znode *result, const znode *op1, const znode *op2 TSRMLS_DC); +void zend_do_assign(znode *result, znode *variable, const znode *value TSRMLS_DC); +void zend_do_assign_ref(znode *result, const znode *lvar, const znode *rvar TSRMLS_DC); void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC); void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC); -void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC); -void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC); -void zend_do_fetch_global_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC); +void zend_do_indirect_references(znode *result, const znode *num_references, znode *variable TSRMLS_DC); +void zend_do_fetch_static_variable(znode *varname, const znode *static_assignment, int fetch_type TSRMLS_DC); +void zend_do_fetch_global_variable(znode *varname, const znode *static_assignment, int fetch_type TSRMLS_DC); void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC); -void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC); -void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC); +void fetch_array_dim(znode *result, const znode *parent, const znode *dim TSRMLS_DC); +void fetch_string_offset(znode *result, const znode *parent, const znode *offset TSRMLS_DC); void zend_do_fetch_static_member(znode *result, znode *class_znode TSRMLS_DC); -void zend_do_print(znode *result, znode *arg TSRMLS_DC); -void zend_do_echo(znode *arg TSRMLS_DC); -typedef int (*unary_op_type)(zval *, zval *); +void zend_do_print(znode *result, const znode *arg TSRMLS_DC); +void zend_do_echo(const znode *arg TSRMLS_DC); +typedef int (*unary_op_type)(zval *, zval * TSRMLS_DC); +typedef int (*binary_op_type)(zval *, zval *, zval * TSRMLS_DC); ZEND_API unary_op_type get_unary_op(int opcode); -ZEND_API void *get_binary_op(int opcode); +ZEND_API binary_op_type get_binary_op(int opcode); -void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC); -void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC); +void zend_do_while_cond(const znode *expr, znode *close_bracket_token TSRMLS_DC); +void zend_do_while_end(const znode *while_token, const znode *close_bracket_token TSRMLS_DC); void zend_do_do_while_begin(TSRMLS_D); -void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC); +void zend_do_do_while_end(const znode *do_token, const znode *expr_open_bracket, const znode *expr TSRMLS_DC); -void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC); -void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC); +void zend_do_if_cond(const znode *cond, znode *closing_bracket_token TSRMLS_DC); +void zend_do_if_after_statement(const znode *closing_bracket_token, unsigned char initialize TSRMLS_DC); void zend_do_if_end(TSRMLS_D); -void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC); -void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC); -void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC); +void zend_do_for_cond(const znode *expr, znode *second_semicolon_token TSRMLS_DC); +void zend_do_for_before_statement(const znode *cond_start, const znode *second_semicolon_token TSRMLS_DC); +void zend_do_for_end(const znode *second_semicolon_token TSRMLS_DC); -void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC); -void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC); +void zend_do_pre_incdec(znode *result, const znode *op1, zend_uchar op TSRMLS_DC); +void zend_do_post_incdec(znode *result, const znode *op1, zend_uchar op TSRMLS_DC); void zend_do_begin_variable_parse(TSRMLS_D); -void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC); +void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS_DC); -void zend_check_writable_variable(znode *variable); +void zend_check_writable_variable(const znode *variable); void zend_do_free(znode *op1 TSRMLS_DC); -void zend_do_init_string(znode *result TSRMLS_DC); -void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC); -void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC); +void zend_do_add_string(znode *result, const znode *op1, znode *op2 TSRMLS_DC); +void zend_do_add_variable(znode *result, const znode *op1, const znode *op2 TSRMLS_DC); -int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier); +int zend_do_verify_access_types(const znode *current_access_type, const znode *new_modifier); void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC); -void zend_do_end_function_declaration(znode *function_token TSRMLS_DC); -void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, znode *varname, zend_bool pass_by_reference TSRMLS_DC); -int zend_do_begin_function_call(znode *function_name TSRMLS_DC); +void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC); +void zend_do_receive_arg(zend_uchar op, const znode *var, const znode *offset, const znode *initialization, znode *class_type, const znode *varname, zend_bool pass_by_reference TSRMLS_DC); +int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace TSRMLS_DC); void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC); -void zend_do_clone(znode *result, znode *expr TSRMLS_DC); -void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC); +void zend_do_clone(znode *result, const znode *expr TSRMLS_DC); +void zend_do_begin_dynamic_function_call(znode *function_name, int prefix_len TSRMLS_DC); void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC); -void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name TSRMLS_DC); -void zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC); -void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); +void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_class_member TSRMLS_DC); +int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC); +void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); void zend_do_handle_exception(TSRMLS_D); +void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference TSRMLS_DC); +void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC); + void zend_do_try(znode *try_token TSRMLS_DC); -void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC); -void zend_do_end_catch(znode *try_token TSRMLS_DC); -void zend_do_throw(znode *expr TSRMLS_DC); +void zend_do_begin_catch(znode *try_token, znode *catch_class, const znode *catch_var, znode *first_catch TSRMLS_DC); +void zend_do_end_catch(const znode *try_token TSRMLS_DC); +void zend_do_throw(const znode *expr TSRMLS_DC); ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, zend_bool compile_time); -ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC); -ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC); -ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC); +ZEND_API zend_class_entry *do_bind_class(const zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC); +ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC); +ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface TSRMLS_DC); ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC); void zend_do_implements_interface(znode *interface_znode TSRMLS_DC); ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC); void zend_do_early_binding(TSRMLS_D); +ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC); void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC); void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC); -void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC); +void zend_do_boolean_or_end(znode *result, const znode *expr1, const znode *expr2, znode *op_token TSRMLS_DC); void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC); -void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC); +void zend_do_boolean_and_end(znode *result, const znode *expr1, const znode *expr2, const znode *op_token TSRMLS_DC); -void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC); +void zend_do_brk_cont(zend_uchar op, const znode *expr TSRMLS_DC); -void zend_do_switch_cond(znode *cond TSRMLS_DC); -void zend_do_switch_end(znode *case_list TSRMLS_DC); -void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC); -void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC); -void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC); +void zend_do_switch_cond(const znode *cond TSRMLS_DC); +void zend_do_switch_end(const znode *case_list TSRMLS_DC); +void zend_do_case_before_statement(const znode *case_list, znode *case_token, const znode *case_expr TSRMLS_DC); +void zend_do_case_after_statement(znode *result, const znode *case_token TSRMLS_DC); +void zend_do_default_before_statement(const znode *case_list, znode *default_token TSRMLS_DC); -void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC); -void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRMLS_DC); -void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC); +void zend_do_begin_class_declaration(const znode *class_token, znode *class_name, const znode *parent_class_name TSRMLS_DC); +void zend_do_end_class_declaration(const znode *class_token, const znode *parent_token TSRMLS_DC); +void zend_do_declare_property(const znode *var_name, const znode *value, zend_uint access_type TSRMLS_DC); void zend_do_declare_implicit_property(TSRMLS_D); -void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC); +void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_DC); -void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC); +void zend_do_fetch_property(znode *result, znode *object, const znode *property TSRMLS_DC); void zend_do_halt_compiler_register(TSRMLS_D); -void zend_do_push_object(znode *object TSRMLS_DC); +void zend_do_push_object(const znode *object TSRMLS_DC); void zend_do_pop_object(znode *object TSRMLS_DC); void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC); -void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC); +void zend_do_end_new_object(znode *result, const znode *new_token, const znode *argument_list TSRMLS_DC); -void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC); +void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC); -void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC); +void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC); -void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC); -void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC); -void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr); +void zend_do_init_array(znode *result, const znode *expr, const znode *offset, zend_bool is_ref TSRMLS_DC); +void zend_do_add_array_element(znode *result, const znode *expr, const znode *offset, zend_bool is_ref TSRMLS_DC); +void zend_do_add_static_array_element(znode *result, znode *offset, const znode *expr); void zend_do_list_init(TSRMLS_D); void zend_do_list_end(znode *result, znode *expr TSRMLS_DC); -void zend_do_add_list_element(znode *element TSRMLS_DC); +void zend_do_add_list_element(const znode *element TSRMLS_DC); void zend_do_new_list_begin(TSRMLS_D); void zend_do_new_list_end(TSRMLS_D); -void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC); -void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC); +void zend_do_cast(znode *result, const znode *expr, int type TSRMLS_DC); +void zend_do_include_or_eval(int type, znode *result, const znode *op1 TSRMLS_DC); -void zend_do_unset(znode *variable TSRMLS_DC); +void zend_do_unset(const znode *variable TSRMLS_DC); void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC); -void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC); +void zend_do_instanceof(znode *result, const znode *expr, const znode *class_znode, int type TSRMLS_DC); void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, znode *array, znode *as_token, int variable TSRMLS_DC); -void zend_do_foreach_cont(znode *foreach_token, znode *open_brackets_token, znode *as_token, znode *value, znode *key TSRMLS_DC); -void zend_do_foreach_end(znode *foreach_token, znode *as_token TSRMLS_DC); +void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token, const znode *as_token, znode *value, znode *key TSRMLS_DC); +void zend_do_foreach_end(const znode *foreach_token, const znode *as_token TSRMLS_DC); void zend_do_declare_begin(TSRMLS_D); void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC); -void zend_do_declare_end(znode *declare_token TSRMLS_DC); +void zend_do_declare_end(const znode *declare_token TSRMLS_DC); -void zend_do_exit(znode *result, znode *message TSRMLS_DC); +void zend_do_exit(znode *result, const znode *message TSRMLS_DC); void zend_do_begin_silence(znode *strudel_token TSRMLS_DC); -void zend_do_end_silence(znode *strudel_token TSRMLS_DC); +void zend_do_end_silence(const znode *strudel_token TSRMLS_DC); -void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC); -void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC); -void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC); +void zend_do_jmp_set(const znode *value, znode *jmp_token, znode *colon_token TSRMLS_DC); +void zend_do_jmp_set_else(znode *result, const znode *false_value, const znode *jmp_token, const znode *colon_token TSRMLS_DC); + +void zend_do_begin_qm_op(const znode *cond, znode *qm_token TSRMLS_DC); +void zend_do_qm_true(const znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC); +void zend_do_qm_false(znode *result, const znode *false_value, const znode *qm_token, const znode *colon_token TSRMLS_DC); void zend_do_extended_info(TSRMLS_D); void zend_do_extended_fcall_begin(TSRMLS_D); @@ -502,7 +533,20 @@ void zend_do_extended_fcall_end(TSRMLS_D); void zend_do_ticks(TSRMLS_D); -void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body TSRMLS_DC); +void zend_do_abstract_method(const znode *function_name, znode *modifiers, const znode *body TSRMLS_DC); + +void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC); +void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRMLS_DC); +void zend_do_begin_namespace(const znode *name, zend_bool with_brackets TSRMLS_DC); +void zend_do_end_namespace(TSRMLS_D); +void zend_verify_namespace(TSRMLS_D); +void zend_do_use(znode *name, znode *new_name, int is_global TSRMLS_DC); +void zend_do_end_compilation(TSRMLS_D); + +void zend_do_label(znode *label TSRMLS_DC); +void zend_do_goto(const znode *label TSRMLS_DC); +void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 TSRMLS_DC); +void zend_release_labels(TSRMLS_D); ZEND_API void function_add_ref(zend_function *function); @@ -518,7 +562,6 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC); ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC); ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC); ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC); -ZEND_API void zend_file_handle_dtor(zend_file_handle *fh); ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC); ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC); ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC); @@ -528,7 +571,7 @@ ZEND_API void zend_function_dtor(zend_function *function); ZEND_API void destroy_zend_class(zend_class_entry **pce); void zend_class_add_ref(zend_class_entry **ce); -ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal); +ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal); ZEND_API int zend_unmangle_property_name(char *mangled_property, int mangled_property_len, char **prop_name, char **class_name); #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor @@ -542,12 +585,12 @@ void print_op_array(zend_op_array *op_array, int optimizations); int pass_two(zend_op_array *op_array TSRMLS_DC); zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array); void zend_do_first_catch(znode *open_parentheses TSRMLS_DC); -void zend_initialize_try_catch_element(znode *try_token TSRMLS_DC); -void zend_do_mark_last_catch(znode *first_catch, znode *last_additional_catch TSRMLS_DC); +void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC); +void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additional_catch TSRMLS_DC); ZEND_API zend_bool zend_is_compiling(TSRMLS_D); -ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC); +ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC); -int zend_get_class_fetch_type(char *class_name, uint class_name_len); +int zend_get_class_fetch_type(const char *class_name, uint class_name_len); typedef zend_bool (*zend_auto_global_callback)(char *name, uint name_len TSRMLS_DC); typedef struct _zend_auto_global { @@ -558,9 +601,10 @@ typedef struct _zend_auto_global { } zend_auto_global; void zend_auto_global_dtor(zend_auto_global *auto_global); -ZEND_API int zend_register_auto_global(char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC); -ZEND_API zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC); -ZEND_API int zend_auto_global_disable_jit(char *varname, zend_uint varname_length TSRMLS_DC); +ZEND_API int zend_register_auto_global(const char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC); +ZEND_API zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC); +ZEND_API int zend_auto_global_disable_jit(const char *varname, zend_uint varname_length TSRMLS_DC); +ZEND_API size_t zend_dirname(char *path, size_t len); int zendlex(znode *zendlval TSRMLS_DC); @@ -580,7 +624,8 @@ int zendlex(znode *zendlval TSRMLS_DC); #define ZEND_FETCH_LOCAL 1 #define ZEND_FETCH_STATIC 2 #define ZEND_FETCH_STATIC_MEMBER 3 -#define ZEND_FETCH_GLOBAL_LOCK 4 +#define ZEND_FETCH_GLOBAL_LOCK 4 +#define ZEND_FETCH_LEXICAL 5 /* class fetches */ @@ -591,7 +636,10 @@ int zendlex(znode *zendlval TSRMLS_DC); #define ZEND_FETCH_CLASS_GLOBAL 4 #define ZEND_FETCH_CLASS_AUTO 5 #define ZEND_FETCH_CLASS_INTERFACE 6 +#define ZEND_FETCH_CLASS_STATIC 7 +#define ZEND_FETCH_CLASS_MASK 0x0f #define ZEND_FETCH_CLASS_NO_AUTOLOAD 0x80 +#define ZEND_FETCH_CLASS_SILENT 0x0100 /* variable parsing type (compile-time) */ #define ZEND_PARSED_MEMBER (1<<0) @@ -633,20 +681,15 @@ int zendlex(znode *zendlval TSRMLS_DC); #define ZEND_ISSET (1<<0) #define ZEND_ISEMPTY (1<<1) +#define ZEND_ISSET_ISEMPTY_MASK (ZEND_ISSET | ZEND_ISEMPTY) +#define ZEND_QUICK_SET (1<<2) #define ZEND_CT (1<<0) #define ZEND_RT (1<<1) - -#define ZEND_HANDLE_FILENAME 0 -#define ZEND_HANDLE_FD 1 -#define ZEND_HANDLE_FP 2 -#define ZEND_HANDLE_STDIOSTREAM 3 -#define ZEND_HANDLE_FSTREAM 4 -#define ZEND_HANDLE_STREAM 5 - #define ZEND_FETCH_STANDARD 0 -#define ZEND_FETCH_ADD_LOCK 1 +#define ZEND_FETCH_ADD_LOCK (1<<0) +#define ZEND_FETCH_MAKE_REF (1<<1) #define ZEND_FE_FETCH_BYREF 1 #define ZEND_FE_FETCH_WITH_KEY 2 @@ -699,9 +742,39 @@ END_EXTERN_C() #define ZEND_UNSET_FUNC_NAME "__unset" #define ZEND_ISSET_FUNC_NAME "__isset" #define ZEND_CALL_FUNC_NAME "__call" +#define ZEND_CALLSTATIC_FUNC_NAME "__callstatic" #define ZEND_TOSTRING_FUNC_NAME "__tostring" #define ZEND_AUTOLOAD_FUNC_NAME "__autoload" +/* The following constants may be combined in CG(compiler_options) + * to change the default compiler behavior */ + +/* generate extended debug information */ +#define ZEND_COMPILE_EXTENDED_INFO (1<<0) + +/* call op_array handler of extendions */ +#define ZEND_COMPILE_HANDLE_OP_ARRAY (1<<1) + +/* generate ZEND_DO_FCALL_BY_NAME for internal functions instead of ZEND_DO_FCALL */ +#define ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS (1<<2) + +/* don't perform early binding for classes inherited form internal ones; + * in namespaces assume that internal class that doesn't exist at compile-time + * may apper in run-time */ +#define ZEND_COMPILE_IGNORE_INTERNAL_CLASSES (1<<3) + +/* generate ZEND_DECLARE_INHERITED_CLASS_DELAYED opcode to delay early binding */ +#define ZEND_COMPILE_DELAYED_BINDING (1<<4) + +/* disable constant substitution at compile-time */ +#define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION (1<<5) + +/* The default value for CG(compiler_options) */ +#define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY + +/* The default value for CG(compiler_options) during eval() */ +#define ZEND_COMPILE_DEFAULT_FOR_EVAL 0 + #endif /* ZEND_COMPILE_H */ /* diff --git a/Zend/zend_config.nw.h b/Zend/zend_config.nw.h index 0ff7ebb1d..5e734dd50 100644 --- a/Zend/zend_config.nw.h +++ b/Zend/zend_config.nw.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_config.nw.h,v 1.8.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_config.nw.h,v 1.8.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_CONFIG_NW_H #define ZEND_CONFIG_NW_H diff --git a/Zend/zend_config.w32.h b/Zend/zend_config.w32.h index a71dce3f5..fce122b31 100644 --- a/Zend/zend_config.w32.h +++ b/Zend/zend_config.w32.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_config.w32.h,v 1.39.2.2.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_config.w32.h,v 1.39.2.2.2.2.2.3 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_CONFIG_W32_H #define ZEND_CONFIG_W32_H @@ -48,7 +48,9 @@ typedef unsigned int uint; #define istdiostream stdiostream #define snprintf _snprintf +#if _MSC_VER < 1500 #define vsnprintf _vsnprintf +#endif #define strcasecmp(s1, s2) stricmp(s1, s2) #define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) #define zend_isinf(a) ((_fpclass(a) == _FPCLASS_PINF) || (_fpclass(a) == _FPCLASS_NINF)) diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index fd090a323..6be167ec8 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.c,v 1.71.2.5.2.10 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_constants.c,v 1.71.2.5.2.7.2.17 2009/01/12 21:54:37 stas Exp $ */ #include "zend.h" #include "zend_constants.h" @@ -53,19 +53,19 @@ void zend_copy_constants(HashTable *target, HashTable *source) } -static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC) +static int clean_non_persistent_constant(const zend_constant *c TSRMLS_DC) { return (c->flags & CONST_PERSISTENT) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE; } -static int clean_non_persistent_constant_full(zend_constant *c TSRMLS_DC) +static int clean_non_persistent_constant_full(const zend_constant *c TSRMLS_DC) { return (c->flags & CONST_PERSISTENT) ? 0 : 1; } -static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC) +static int clean_module_constant(const zend_constant *c, int *module_number TSRMLS_DC) { if (c->module_number == *module_number) { return 1; @@ -101,6 +101,7 @@ void zend_register_standard_constants(TSRMLS_D) REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS); @@ -108,6 +109,7 @@ void zend_register_standard_constants(TSRMLS_D) REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); @@ -142,6 +144,12 @@ void zend_register_standard_constants(TSRMLS_D) c.value.value.lval = ZTS_V; c.value.type = IS_BOOL; zend_register_constant(&c TSRMLS_CC); + + c.name = zend_strndup(ZEND_STRL("ZEND_DEBUG_BUILD")); + c.name_len = sizeof("ZEND_DEBUG_BUILD"); + c.value.value.lval = ZEND_DEBUG; + c.value.type = IS_BOOL; + zend_register_constant(&c TSRMLS_CC); } } @@ -164,7 +172,7 @@ void clean_non_persistent_constants(TSRMLS_D) } -ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC) { zend_constant c; @@ -178,7 +186,7 @@ ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, } -ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC) { zend_constant c; @@ -192,7 +200,7 @@ ZEND_API void zend_register_double_constant(char *name, uint name_len, double dv } -ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC) { zend_constant c; @@ -207,28 +215,88 @@ ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *st } -ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC) { zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC); } -ZEND_API int zend_get_constant_ex(char *name, uint name_len, zval *result, zend_class_entry *scope TSRMLS_DC) +ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC) { zend_constant *c; int retval = 1; char *lookup_name; + + if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) { + lookup_name = zend_str_tolower_dup(name, name_len); + + if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) { + if (c->flags & CONST_CS) { + retval=0; + } + } else { + static char haltoff[] = "__COMPILER_HALT_OFFSET__"; + + if (!EG(in_execution)) { + retval = 0; + } else if (name_len == sizeof("__COMPILER_HALT_OFFSET__")-1 && + !memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) { + char *cfilename, *haltname; + int len, clen; + + cfilename = zend_get_executed_filename(TSRMLS_C); + clen = strlen(cfilename); + /* check for __COMPILER_HALT_OFFSET__ */ + zend_mangle_property_name(&haltname, &len, haltoff, + sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0); + if (zend_hash_find(EG(zend_constants), haltname, len+1, (void **) &c) == SUCCESS) { + retval = 1; + } else { + retval=0; + } + pefree(haltname, 0); + } else { + retval=0; + } + } + efree(lookup_name); + } + + if (retval) { + *result = c->value; + zval_copy_ctor(result); + Z_SET_REFCOUNT_P(result, 1); + Z_UNSET_ISREF_P(result); + } + + return retval; +} + +ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC) +{ + zend_constant *c; + int retval = 1; char *colon; + zend_class_entry *ce = NULL; + char *class_name; + zval **ret_constant; + + /* Skip leading \\ */ + if (name[0] == '\\') { + name += 1; + name_len -= 1; + } - if ((colon = memchr(name, ':', name_len)) && colon[1] == ':') { - /* class constant */ - zend_class_entry **ce = NULL; - int class_name_len = colon-name; + + if ((colon = zend_memrchr(name, ':', name_len)) && + colon > name && (*(colon - 1) == ':')) { + int class_name_len = colon - name - 1; int const_name_len = name_len - class_name_len - 2; - char *constant_name = colon+2; - zval **ret_constant; - char *class_name; + char *constant_name = colon + 1; + char *lcname; + class_name = estrndup(name, class_name_len); + lcname = zend_str_tolower_dup(class_name, class_name_len); if (!scope) { if (EG(in_execution)) { scope = EG(scope); @@ -236,42 +304,99 @@ ZEND_API int zend_get_constant_ex(char *name, uint name_len, zval *result, zend_ scope = CG(active_class_entry); } } - - class_name = estrndup(name, class_name_len); - if (class_name_len == sizeof("self")-1 && strcmp(class_name, "self") == 0) { + if (class_name_len == sizeof("self")-1 && + !memcmp(lcname, "self", sizeof("self")-1)) { if (scope) { - ce = &scope; + ce = scope; } else { zend_error(E_ERROR, "Cannot access self:: when no class scope is active"); retval = 0; } - } else if (class_name_len == sizeof("parent")-1 && strcmp(class_name, "parent") == 0) { - if (!scope) { + efree(lcname); + } else if (class_name_len == sizeof("parent")-1 && + !memcmp(lcname, "parent", sizeof("parent")-1)) { + if (!scope) { zend_error(E_ERROR, "Cannot access parent:: when no class scope is active"); - } else if (!scope->parent) { - zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent"); + } else if (!scope->parent) { + zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent"); } else { - ce = &scope->parent; + ce = scope->parent; } - } else { - if (zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC) != SUCCESS) { - retval = 0; + efree(lcname); + } else if (class_name_len == sizeof("static")-1 && + !memcmp(lcname, "static", sizeof("static")-1)) { + if (EG(called_scope)) { + ce = EG(called_scope); + } else { + zend_error(E_ERROR, "Cannot access static:: when no class scope is active"); } + efree(lcname); + } else { + efree(lcname); + ce = zend_fetch_class(class_name, class_name_len, flags TSRMLS_CC); } - if (retval && ce) { - if (zend_hash_find(&((*ce)->constants_table), constant_name, const_name_len+1, (void **) &ret_constant) != SUCCESS) { + if (zend_hash_find(&ce->constants_table, constant_name, const_name_len+1, (void **) &ret_constant) != SUCCESS) { retval = 0; + if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) { + zend_error(E_ERROR, "Undefined class constant '%s::%s'", class_name, constant_name); + } } - } else { - zend_error(E_ERROR, "Class '%s' not found", class_name); + } else if (!ce) { retval = 0; } efree(class_name); + goto finish; + } + /* non-class constant */ + if ((colon = zend_memrchr(name, '\\', name_len)) != NULL) { + /* compound constant name */ + int prefix_len = colon - name; + int const_name_len = name_len - prefix_len - 1; + char *constant_name = colon + 1; + char *lcname; + int found_const = 0; + + lcname = zend_str_tolower_dup(name, prefix_len); + /* Check for namespace constant */ + + /* Concatenate lowercase namespace name and constant name */ + lcname = erealloc(lcname, prefix_len + 1 + const_name_len + 1); + lcname[prefix_len] = '\\'; + memcpy(lcname + prefix_len + 1, constant_name, const_name_len + 1); + + if (zend_hash_find(EG(zend_constants), lcname, prefix_len + 1 + const_name_len + 1, (void **) &c) == SUCCESS) { + found_const = 1; + } else { + /* try lowercase */ + zend_str_tolower(lcname + prefix_len + 1, const_name_len); + if (zend_hash_find(EG(zend_constants), lcname, prefix_len + 1 + const_name_len + 1, (void **) &c) == SUCCESS) { + if ((c->flags & CONST_CS) == 0) { + found_const = 1; + } + } + } + efree(lcname); + if(found_const) { + *result = c->value; + zval_update_constant_ex(&result, (void*)1, NULL TSRMLS_CC); + zval_copy_ctor(result); + Z_SET_REFCOUNT_P(result, 1); + Z_UNSET_ISREF_P(result); + return 1; + } + /* name requires runtime resolution, need to check non-namespaced name */ + if ((flags & IS_CONSTANT_UNQUALIFIED) != 0) { + name = constant_name; + name_len = const_name_len; + return zend_get_constant(name, name_len, result TSRMLS_CC); + } + retval = 0; +finish: if (retval) { - zval_update_constant_ex(ret_constant, (void*)1, *ce TSRMLS_CC); + zval_update_constant_ex(ret_constant, (void*)1, ce TSRMLS_CC); *result = **ret_constant; zval_copy_ctor(result); INIT_PZVAL(result); @@ -280,52 +405,7 @@ ZEND_API int zend_get_constant_ex(char *name, uint name_len, zval *result, zend_ return retval; } - if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) { - lookup_name = estrndup(name, name_len); - zend_str_tolower(lookup_name, name_len); - - if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) { - if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) { - retval=0; - } - } else { - char haltoff[] = "__COMPILER_HALT_OFFSET__"; - if (!EG(in_execution)) { - retval = 0; - } else if (name_len == sizeof("__COMPILER_HALT_OFFSET__") - 1 && memcmp(haltoff, name, name_len) == 0) { - char *cfilename, *haltname; - int len, clen; - cfilename = zend_get_executed_filename(TSRMLS_C); - clen = strlen(cfilename); - /* check for __COMPILER_HALT_OFFSET__ */ - zend_mangle_property_name(&haltname, &len, haltoff, - sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0); - if (zend_hash_find(EG(zend_constants), haltname, len+1, (void **) &c) == SUCCESS) { - retval = 1; - } else { - retval=0; - } - pefree(haltname, 0); - } else { - retval = 0; - } - } - efree(lookup_name); - } - - if (retval) { - *result = c->value; - zval_copy_ctor(result); - result->refcount = 1; - result->is_ref = 0; - } - - return retval; -} - -ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) -{ - return zend_get_constant_ex(name, name_len, result, NULL TSRMLS_CC); + return zend_get_constant(name, name_len, result TSRMLS_CC); } ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) @@ -344,7 +424,14 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) zend_str_tolower(lowercase_name, c->name_len-1); name = lowercase_name; } else { - name = c->name; + char *slash = strrchr(c->name, '\\'); + if(slash) { + lowercase_name = estrndup(c->name, c->name_len-1); + zend_str_tolower(lowercase_name, slash-c->name); + name = lowercase_name; + } else { + name = c->name; + } } if ((strncmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) || diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index a9187f5f6..7c932e71e 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.h,v 1.31.2.2.2.5 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_constants.h,v 1.31.2.2.2.3.2.5 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_CONSTANTS_H #define ZEND_CONSTANTS_H @@ -43,6 +43,11 @@ typedef struct _zend_constant { #define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC) #define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), module_number TSRMLS_CC) +#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC) +#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags) zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (dval), (flags), module_number TSRMLS_CC) +#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags) zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (flags), module_number TSRMLS_CC) +#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags) zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (len), (flags), module_number TSRMLS_CC) + #define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC) #define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), 0 TSRMLS_CC) #define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), 0 TSRMLS_CC) @@ -55,12 +60,12 @@ int zend_startup_constants(TSRMLS_D); int zend_shutdown_constants(TSRMLS_D); void zend_register_standard_constants(TSRMLS_D); void clean_non_persistent_constants(TSRMLS_D); -ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC); -ZEND_API int zend_get_constant_ex(char *name, uint name_len, zval *result, zend_class_entry *scope TSRMLS_DC); -ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC); +ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC); +ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC); +ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC); ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC); void zend_copy_constants(HashTable *target, HashTable *sourc); void copy_zend_constant(zend_constant *c); diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c index 2cc46a5fb..875c0f080 100644 --- a/Zend/zend_default_classes.c +++ b/Zend/zend_default_classes.c @@ -17,13 +17,14 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_default_classes.c,v 1.59.2.2.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_default_classes.c,v 1.59.2.2.2.1.2.3 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" #include "zend_API.h" #include "zend_builtin_functions.h" #include "zend_interfaces.h" #include "zend_exceptions.h" +#include "zend_closures.h" ZEND_API void zend_register_default_classes(TSRMLS_D) @@ -31,6 +32,7 @@ ZEND_API void zend_register_default_classes(TSRMLS_D) zend_register_interfaces(TSRMLS_C); zend_register_default_exception(TSRMLS_C); zend_register_iterator_wrapper(TSRMLS_C); + zend_register_closure_ce(TSRMLS_C); } /* diff --git a/Zend/zend_dynamic_array.c b/Zend/zend_dynamic_array.c index 18e1ed348..627bc94d9 100644 --- a/Zend/zend_dynamic_array.c +++ b/Zend/zend_dynamic_array.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_dynamic_array.c,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_dynamic_array.c,v 1.13.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" diff --git a/Zend/zend_dynamic_array.h b/Zend/zend_dynamic_array.h index b34a7e7cc..45ad075a0 100644 --- a/Zend/zend_dynamic_array.h +++ b/Zend/zend_dynamic_array.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_dynamic_array.h,v 1.14.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_dynamic_array.h,v 1.14.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_DYNAMIC_ARRAY_H #define ZEND_DYNAMIC_ARRAY_H diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h index f3659d99c..e8e600994 100644 --- a/Zend/zend_errors.h +++ b/Zend/zend_errors.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_errors.h,v 1.18.2.1.2.7 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_errors.h,v 1.18.2.1.2.5.2.4 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_ERRORS_H #define ZEND_ERRORS_H @@ -35,8 +35,10 @@ #define E_USER_NOTICE (1<<10L) #define E_STRICT (1<<11L) #define E_RECOVERABLE_ERROR (1<<12L) +#define E_DEPRECATED (1<<13L) +#define E_USER_DEPRECATED (1<<14L) -#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) +#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) #define E_CORE (E_CORE_ERROR | E_CORE_WARNING) #endif /* ZEND_ERRORS_H */ diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index b53c227e3..769b91218 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -19,27 +19,76 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.c,v 1.79.2.6.2.11 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_exceptions.c,v 1.79.2.6.2.9.2.20 2009/01/02 13:14:49 helly Exp $ */ #include "zend.h" #include "zend_API.h" #include "zend_builtin_functions.h" #include "zend_interfaces.h" #include "zend_exceptions.h" +#include "zend_vm.h" zend_class_entry *default_exception_ce; zend_class_entry *error_exception_ce; static zend_object_handlers default_exception_handlers; ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); +void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC) +{ + zval *previous; + + if (exception == add_previous || !add_previous || !exception) { + return; + } + if (Z_TYPE_P(add_previous) != IS_OBJECT && !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) { + zend_error(E_ERROR, "Cannot set non exception as previous exception"); + return; + } + while (exception && exception != add_previous && Z_OBJ_HANDLE_P(exception) != Z_OBJ_HANDLE_P(add_previous)) { + previous = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 1 TSRMLS_CC); + if (Z_TYPE_P(previous) == IS_NULL) { + zend_update_property(default_exception_ce, exception, "previous", sizeof("previous")-1, add_previous TSRMLS_CC); + Z_DELREF_P(add_previous); + return; + } + exception = previous; + } +} + +void zend_exception_save(TSRMLS_D) /* {{{ */ +{ + if (EG(prev_exception)) { + zend_exception_set_previous(EG(exception), EG(prev_exception) TSRMLS_CC); + } + if (EG(exception)) { + EG(prev_exception) = EG(exception); + } + EG(exception) = NULL; +} +/* }}} */ + +void zend_exception_restore(TSRMLS_D) /* {{{ */ +{ + if (EG(prev_exception)) { + if (EG(exception)) { + zend_exception_set_previous(EG(exception), EG(prev_exception) TSRMLS_CC); + } else { + EG(exception) = EG(prev_exception); + } + EG(prev_exception) = NULL; + } +} +/* }}} */ + void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */ { if (exception != NULL) { - if (EG(exception)) { - /* FIXME: bail out? */ + zval *previous = EG(exception); + zend_exception_set_previous(exception, EG(exception) TSRMLS_CC); + EG(exception) = exception; + if (previous) { return; } - EG(exception) = exception; } if (!EG(current_execute_data)) { zend_error(E_ERROR, "Exception thrown without a stack frame"); @@ -55,12 +104,16 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */ return; } EG(opline_before_exception) = EG(current_execute_data)->opline; - EG(current_execute_data)->opline = &EG(active_op_array)->opcodes[EG(active_op_array)->last-1-1]; + EG(current_execute_data)->opline = EG(exception_op); } /* }}} */ ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */ { + if (EG(prev_exception)) { + zval_ptr_dtor(&EG(prev_exception)); + EG(prev_exception) = NULL; + } if (!EG(exception)) { return; } @@ -87,8 +140,8 @@ static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_t zend_hash_copy(object->properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); ALLOC_ZVAL(trace); - trace->is_ref = 0; - trace->refcount = 0; + Z_UNSET_ISREF_P(trace); + Z_SET_REFCOUNT_P(trace, 0); zend_fetch_debug_backtrace(trace, skip_top_traces, 0 TSRMLS_CC); zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC); @@ -120,17 +173,17 @@ ZEND_METHOD(exception, __clone) } /* }}} */ -/* {{{ proto Exception::__construct(string message, int code) +/* {{{ proto Exception::__construct(string message, int code [, Exception previous]) Exception constructor */ ZEND_METHOD(exception, __construct) { char *message = NULL; long code = 0; - zval *object; + zval *object, *previous = NULL; int argc = ZEND_NUM_ARGS(), message_len; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sl", &message, &message_len, &code) == FAILURE) { - zend_error(E_ERROR, "Wrong parameters for Exception([string $exception [, long $code ]])"); + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|slO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) { + zend_error(E_ERROR, "Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])"); } object = getThis(); @@ -142,20 +195,24 @@ ZEND_METHOD(exception, __construct) if (code) { zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC); } + + if (previous) { + zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC); + } } /* }}} */ -/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno]]) +/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]]) ErrorException constructor */ ZEND_METHOD(error_exception, __construct) { char *message = NULL, *filename = NULL; long code = 0, severity = E_ERROR, lineno; - zval *object; + zval *object, *previous = NULL; int argc = ZEND_NUM_ARGS(), message_len, filename_len; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sllsl", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno) == FAILURE) { - zend_error(E_ERROR, "Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno ]]]]])"); + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) { + zend_error(E_ERROR, "Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]])"); } object = getThis(); @@ -168,6 +225,10 @@ ZEND_METHOD(error_exception, __construct) zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC); } + if (previous) { + zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC); + } + zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC); if (argc >= 4) { @@ -181,8 +242,8 @@ ZEND_METHOD(error_exception, __construct) /* }}} */ #define DEFAULT_0_PARAMS \ - if (ZEND_NUM_ARGS() > 0) { \ - ZEND_WRONG_PARAM_COUNT(); \ + if (zend_parse_parameters_none() == FAILURE) { \ + return; \ } static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */ @@ -280,7 +341,7 @@ ZEND_METHOD(error_exception, getSeverity) /* }}} */ -static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { char **str; int *len; @@ -340,7 +401,6 @@ static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_k double dval = Z_DVAL_PP(arg); char *s_tmp; int l_tmp; - TSRMLS_FETCH(); s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */ @@ -357,7 +417,6 @@ static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_k char *class_name; zend_uint class_name_len; int dup; - TSRMLS_FETCH(); TRACE_APPEND_STR("Object("); @@ -378,7 +437,7 @@ static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_k } /* }}} */ -static int _build_trace_string(zval **frame, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { char *s_tmp, **str; int *len, *num; @@ -413,7 +472,7 @@ static int _build_trace_string(zval **frame, int num_args, va_list args, zend_ha TRACE_APPEND_CHR('('); if (zend_hash_find(ht, "args", sizeof("args"), (void**)&tmp) == SUCCESS) { int last_len = *len; - zend_hash_apply_with_arguments(Z_ARRVAL_PP(tmp), (apply_func_args_t)_build_trace_args, 2, str, len); + zend_hash_apply_with_arguments(Z_ARRVAL_PP(tmp) TSRMLS_CC, (apply_func_args_t)_build_trace_args, 2, str, len); if (last_len != *len) { *len -= 2; /* remove last ', ' */ } @@ -432,7 +491,7 @@ ZEND_METHOD(exception, getTraceAsString) int res_len = 0, *len = &res_len, num = 0; trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC); - zend_hash_apply_with_arguments(Z_ARRVAL_P(trace), (apply_func_args_t)_build_trace_string, 3, str, len, &num); + zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num); s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1); sprintf(s_tmp, "#%d {main}", num); @@ -444,6 +503,15 @@ ZEND_METHOD(exception, getTraceAsString) } /* }}} */ +/* {{{ proto string Exception::getPrevious() + Return previous Exception or NULL. */ +ZEND_METHOD(exception, getPrevious) +{ + zval *previous; + previous = zend_read_property(default_exception_ce, getThis(), "previous", sizeof("previous")-1, 1 TSRMLS_CC); + RETURN_ZVAL(previous, 1, 0); +} + int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */ { va_list arg; @@ -460,47 +528,60 @@ int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */ Obtain the string representation of the Exception object */ ZEND_METHOD(exception, __toString) { - zval message, file, line, *trace; - char *str; - int len; + zval message, file, line, *trace, *exception; + char *str = estrndup("", 0), *prev_str; + int len = 0; zend_fcall_info fci; zval fname; - _default_exception_get_entry(getThis(), "message", sizeof("message")-1, &message TSRMLS_CC); - _default_exception_get_entry(getThis(), "file", sizeof("file")-1, &file TSRMLS_CC); - _default_exception_get_entry(getThis(), "line", sizeof("line")-1, &line TSRMLS_CC); - - convert_to_string(&message); - convert_to_string(&file); - convert_to_long(&line); - - ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 0); - - fci.size = sizeof(fci); - fci.function_table = &Z_OBJCE_P(getThis())->function_table; - fci.function_name = &fname; - fci.symbol_table = NULL; - fci.object_pp = &getThis(); - fci.retval_ptr_ptr = &trace; - fci.param_count = 0; - fci.params = NULL; - fci.no_separation = 1; - - zend_call_function(&fci, NULL TSRMLS_CC); + exception = getThis(); + ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1); + + while (exception && Z_TYPE_P(exception) == IS_OBJECT) { + prev_str = str; + _default_exception_get_entry(exception, "message", sizeof("message")-1, &message TSRMLS_CC); + _default_exception_get_entry(exception, "file", sizeof("file")-1, &file TSRMLS_CC); + _default_exception_get_entry(exception, "line", sizeof("line")-1, &line TSRMLS_CC); + + convert_to_string(&message); + convert_to_string(&file); + convert_to_long(&line); + + fci.size = sizeof(fci); + fci.function_table = &Z_OBJCE_P(exception)->function_table; + fci.function_name = &fname; + fci.symbol_table = NULL; + fci.object_ptr = exception; + fci.retval_ptr_ptr = &trace; + fci.param_count = 0; + fci.params = NULL; + fci.no_separation = 1; + + zend_call_function(&fci, NULL TSRMLS_CC); + + if (Z_TYPE_P(trace) != IS_STRING) { + trace = NULL; + } - if (Z_TYPE_P(trace) != IS_STRING) { - trace = NULL; - } + if (Z_STRLEN(message) > 0) { + len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s%s%s", + Z_OBJCE_P(exception)->name, Z_STRVAL(message), Z_STRVAL(file), Z_LVAL(line), + (trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", + len ? "\n\nNext " : "", prev_str); + } else { + len = zend_spprintf(&str, 0, "exception '%s' in %s:%ld\nStack trace:\n%s%s%s", + Z_OBJCE_P(exception)->name, Z_STRVAL(file), Z_LVAL(line), + (trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", + len ? "\n\nNext " : "", prev_str); + } + efree(prev_str); + zval_dtor(&message); + zval_dtor(&file); + zval_dtor(&line); - if (Z_STRLEN(message) > 0) { - len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s", - Z_OBJCE_P(getThis())->name, Z_STRVAL(message), Z_STRVAL(file), Z_LVAL(line), - (trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n"); - } else { - len = zend_spprintf(&str, 0, "exception '%s' in %s:%ld\nStack trace:\n%s", - Z_OBJCE_P(getThis())->name, Z_STRVAL(file), Z_LVAL(line), - (trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n"); + exception = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 0 TSRMLS_CC); } + zval_dtor(&fname); /* We store the result in the private property string so we can access * the result in uncaught exception handlers without memleaks. */ @@ -510,10 +591,6 @@ ZEND_METHOD(exception, __toString) zval_ptr_dtor(&trace); } - zval_dtor(&message); - zval_dtor(&file); - zval_dtor(&line); - RETURN_STRINGL(str, len, 0); } /* }}} */ @@ -528,13 +605,13 @@ ZEND_METHOD(exception, __toString) * And never try to change the state of exceptions and never implement anything * that gives the user anything to accomplish this. */ -static 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 zend_function_entry default_exception_functions[] = { +const static 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, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) @@ -542,21 +619,22 @@ static zend_function_entry default_exception_functions[] = { 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) {NULL, NULL, NULL} }; -static 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 zend_function_entry error_exception_functions[] = { +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) {NULL, NULL, NULL} @@ -579,6 +657,7 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */ zend_declare_property_null(default_exception_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_null(default_exception_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_null(default_exception_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_null(default_exception_ce, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE TSRMLS_CC); INIT_CLASS_ENTRY(ce, "ErrorException", error_exception_functions); error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce, NULL TSRMLS_CC); @@ -660,8 +739,8 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f } /* }}} */ -/* This function doesn't return as it calls E_ERROR */ -ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) /* {{{ */ +/* This function doesn't return if it uses E_ERROR */ +ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {{{ */ { zend_class_entry *ce_exception = Z_OBJCE_P(exception); if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) { @@ -695,9 +774,9 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) /* {{{ */ file = zend_read_property(default_exception_ce, exception, "file", sizeof("file")-1, 1 TSRMLS_CC); line = zend_read_property(default_exception_ce, exception, "line", sizeof("line")-1, 1 TSRMLS_CC); - zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str)); + zend_error_va(severity, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str)); } else { - zend_error(E_ERROR, "Uncaught exception '%s'", ce_exception->name); + zend_error(severity, "Uncaught exception '%s'", ce_exception->name); } } /* }}} */ diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index f8755127b..bb21e734b 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -19,13 +19,17 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.h,v 1.21.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_exceptions.h,v 1.21.2.1.2.2.2.5 2009/01/02 13:14:49 helly Exp $ */ #ifndef ZEND_EXCEPTIONS_H #define ZEND_EXCEPTIONS_H BEGIN_EXTERN_C() +ZEND_API void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC); +ZEND_API void zend_exception_save(TSRMLS_D); +ZEND_API void zend_exception_restore(TSRMLS_D); + void zend_throw_exception_internal(zval *exception TSRMLS_DC); void zend_register_default_exception(TSRMLS_D); @@ -45,8 +49,8 @@ ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); -/* show an exception using zend_error(E_ERROR,...) */ -ZEND_API void zend_exception_error(zval *exception TSRMLS_DC); +/* show an exception using zend_error(severity,...), severity should be E_ERROR */ +ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC); /* do not export, in php it's available thru spprintf directly */ int zend_spprintf(char **message, int max_len, char *format, ...); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 382b472c5..e6096df74 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.716.2.12.2.32 2009/02/15 14:31:17 iliaa Exp $ */ +/* $Id: zend_execute.c,v 1.716.2.12.2.24.2.41 2009/03/18 14:15:28 dmitry Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -34,6 +34,7 @@ #include "zend_ini.h" #include "zend_exceptions.h" #include "zend_interfaces.h" +#include "zend_closures.h" #include "zend_vm.h" /* Virtual current working directory support */ @@ -53,9 +54,9 @@ typedef int (*incdec_t)(zval *); #define get_obj_zval_ptr_ptr(node, Ts, should_free, type) _get_obj_zval_ptr_ptr(node, Ts, should_free, type TSRMLS_CC) /* Prototypes */ -static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC); -static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC); -static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC); +static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC); +static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC); +static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC); #define RETURN_VALUE_USED(opline) (!((opline)->result.u.EA.type & EXT_TYPE_UNUSED)) @@ -64,33 +65,37 @@ static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_ #define TEMP_VAR_STACK_LIMIT 2000 -static inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free, int unref) +static zend_always_inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free, int unref TSRMLS_DC) { - if (!--z->refcount) { - z->refcount = 1; - z->is_ref = 0; + if (!Z_DELREF_P(z)) { + Z_SET_REFCOUNT_P(z, 1); + Z_UNSET_ISREF_P(z); should_free->var = z; /* should_free->is_var = 1; */ } else { should_free->var = 0; - if (unref && z->is_ref && z->refcount == 1) { - z->is_ref = 0; + if (unref && Z_ISREF_P(z) && Z_REFCOUNT_P(z) == 1) { + Z_UNSET_ISREF_P(z); } + GC_ZVAL_CHECK_POSSIBLE_ROOT(z); } } -static inline void zend_pzval_unlock_free_func(zval *z) +static zend_always_inline void zend_pzval_unlock_free_func(zval *z TSRMLS_DC) { - if (!--z->refcount) { - zval_dtor(z); - safe_free_zval_ptr(z); + if (!Z_DELREF_P(z)) { + if (z != &EG(uninitialized_zval)) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); + zval_dtor(z); + efree(z); + } } } -#define PZVAL_UNLOCK(z, f) zend_pzval_unlock_func(z, f, 1) -#define PZVAL_UNLOCK_EX(z, f, u) zend_pzval_unlock_func(z, f, u) -#define PZVAL_UNLOCK_FREE(z) zend_pzval_unlock_free_func(z) -#define PZVAL_LOCK(z) (z)->refcount++ +#define PZVAL_UNLOCK(z, f) zend_pzval_unlock_func(z, f, 1 TSRMLS_CC) +#define PZVAL_UNLOCK_EX(z, f, u) zend_pzval_unlock_func(z, f, u TSRMLS_CC) +#define PZVAL_UNLOCK_FREE(z) zend_pzval_unlock_free_func(z TSRMLS_CC) +#define PZVAL_LOCK(z) Z_ADDREF_P((z)) #define RETURN_VALUE_UNUSED(pzn) (((pzn)->u.EA.type & EXT_TYPE_UNUSED)) #define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!RETURN_VALUE_UNUSED(pzn)) { PZVAL_LOCK(pzv); } @@ -102,6 +107,10 @@ static inline void zend_pzval_unlock_free_func(zval *z) (ai).ptr = NULL; \ } +#define AI_SET_PTR(ai, val) \ + (ai).ptr = (val); \ + (ai).ptr_ptr = &((ai).ptr); + #define FREE_OP(should_free) \ if (should_free.var) { \ if ((zend_uintptr_t)should_free.var & 1L) { \ @@ -128,8 +137,8 @@ static inline void zend_pzval_unlock_free_func(zval *z) #define INIT_PZVAL_COPY(z,v) \ (z)->value = (v)->value; \ Z_TYPE_P(z) = Z_TYPE_P(v); \ - (z)->refcount = 1; \ - (z)->is_ref = 0; + Z_SET_REFCOUNT_P(z, 1); \ + Z_UNSET_ISREF_P(z); #define MAKE_REAL_ZVAL_PTR(val) \ do { \ @@ -137,8 +146,8 @@ static inline void zend_pzval_unlock_free_func(zval *z) ALLOC_ZVAL(_tmp); \ _tmp->value = (val)->value; \ Z_TYPE_P(_tmp) = Z_TYPE_P(val); \ - _tmp->refcount = 1; \ - _tmp->is_ref = 0; \ + Z_SET_REFCOUNT_P(_tmp, 1); \ + Z_UNSET_ISREF_P(_tmp); \ val = _tmp; \ } while (0) @@ -147,87 +156,107 @@ static inline void zend_pzval_unlock_free_func(zval *z) #define CV_OF(i) (EG(current_execute_data)->CVs[i]) #define CV_DEF_OF(i) (EG(active_op_array)->vars[i]) -ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var) +#define CTOR_CALL_BIT 0x1 +#define CTOR_USED_BIT 0x2 + +#define IS_CTOR_CALL(ce) (((zend_uintptr_t)(ce)) & CTOR_CALL_BIT) +#define IS_CTOR_USED(ce) (((zend_uintptr_t)(ce)) & CTOR_USED_BIT) + +#define ENCODE_CTOR(ce, used) \ + ((zend_class_entry*)(((zend_uintptr_t)(ce)) | CTOR_CALL_BIT | ((used) ? CTOR_USED_BIT : 0))) +#define DECODE_CTOR(ce) \ + ((zend_class_entry*)(((zend_uintptr_t)(ce)) & ~(CTOR_CALL_BIT|CTOR_USED_BIT))) + +ZEND_API zval** zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, zend_uint var) { return execute_data_ptr->CVs[var]; } -static inline void zend_get_cv_address(zend_compiled_variable *cv, zval ***ptr, temp_variable *Ts TSRMLS_DC) +static zend_always_inline zval *_get_zval_ptr_tmp(const znode *node, const temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &new_zval, sizeof(zval *), (void **)ptr); + return should_free->var = &T(node->u.var).tmp_var; } -static inline zval *_get_zval_ptr_tmp(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) +static zval *_get_zval_ptr_var_string_offset(const znode *node, const temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) { - return should_free->var = &T(node->u.var).tmp_var; + temp_variable *T = &T(node->u.var); + zval *str = T->str_offset.str; + zval *ptr; + + /* string offset */ + ALLOC_ZVAL(ptr); + T->str_offset.ptr = ptr; + should_free->var = ptr; + + if (T->str_offset.str->type != IS_STRING + || ((int)T->str_offset.offset < 0) + || (T->str_offset.str->value.str.len <= (int)T->str_offset.offset)) { + ptr->value.str.val = STR_EMPTY_ALLOC(); + ptr->value.str.len = 0; + } else { + ptr->value.str.val = estrndup(str->value.str.val + T->str_offset.offset, 1); + ptr->value.str.len = 1; + } + PZVAL_UNLOCK_FREE(str); + Z_SET_REFCOUNT_P(ptr, 1); + Z_SET_ISREF_P(ptr); + ptr->type = IS_STRING; + return ptr; } -static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) +static zend_always_inline zval *_get_zval_ptr_var(const znode *node, const temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) { zval *ptr = T(node->u.var).var.ptr; - if (ptr) { + if (EXPECTED(ptr != NULL)) { PZVAL_UNLOCK(ptr, should_free); return ptr; } else { - temp_variable *T = &T(node->u.var); - zval *str = T->str_offset.str; + return _get_zval_ptr_var_string_offset(node, Ts, should_free TSRMLS_CC); + } +} - /* string offset */ - ALLOC_ZVAL(ptr); - T->str_offset.ptr = ptr; - should_free->var = ptr; - - if (T->str_offset.str->type != IS_STRING - || ((int)T->str_offset.offset < 0) - || (T->str_offset.str->value.str.len <= (int)T->str_offset.offset)) { - zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset); - ptr->value.str.val = STR_EMPTY_ALLOC(); - ptr->value.str.len = 0; - } else { - char c = str->value.str.val[T->str_offset.offset]; +static zval **_get_zval_cv_lookup(zval ***ptr, zend_uint var, int type TSRMLS_DC) +{ + zend_compiled_variable *cv = &CV_DEF_OF(var); - ptr->value.str.val = estrndup(&c, 1); - ptr->value.str.len = 1; + if (!EG(active_symbol_table) || + zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) { + switch (type) { + case BP_VAR_R: + case BP_VAR_UNSET: + zend_error(E_NOTICE, "Undefined variable: %s", cv->name); + /* break missing intentionally */ + case BP_VAR_IS: + return &EG(uninitialized_zval_ptr); + break; + case BP_VAR_RW: + zend_error(E_NOTICE, "Undefined variable: %s", cv->name); + /* break missing intentionally */ + case BP_VAR_W: + Z_ADDREF(EG(uninitialized_zval)); + if (!EG(active_symbol_table)) { + *ptr = (zval**)EG(current_execute_data)->CVs + (EG(active_op_array)->last_var + var); + **ptr = &EG(uninitialized_zval); + } else { + zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **)ptr); + } + break; } - PZVAL_UNLOCK_FREE(str); - ptr->refcount=1; - ptr->is_ref=1; - ptr->type = IS_STRING; - return ptr; } + return *ptr; } -static inline zval *_get_zval_ptr_cv(znode *node, temp_variable *Ts, int type TSRMLS_DC) +static zend_always_inline zval *_get_zval_ptr_cv(const znode *node, const temp_variable *Ts, int type TSRMLS_DC) { zval ***ptr = &CV_OF(node->u.var); - if (!*ptr) { - zend_compiled_variable *cv = &CV_DEF_OF(node->u.var); - if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) { - switch (type) { - case BP_VAR_R: - case BP_VAR_UNSET: - zend_error(E_NOTICE, "Undefined variable: %s", cv->name); - /* break missing intentionally */ - case BP_VAR_IS: - return &EG(uninitialized_zval); - break; - case BP_VAR_RW: - zend_error(E_NOTICE, "Undefined variable: %s", cv->name); - /* break missing intentionally */ - case BP_VAR_W: - zend_get_cv_address(cv, ptr, Ts TSRMLS_CC); - break; - } - } + if (UNEXPECTED(*ptr == NULL)) { + return *_get_zval_cv_lookup(ptr, node->u.var, type TSRMLS_CC); } return **ptr; } -static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) +static inline zval *_get_zval_ptr(znode *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { /* should_free->is_var = 0; */ switch (node->op_type) { @@ -255,11 +284,11 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op * return NULL; } -static inline zval **_get_zval_ptr_ptr_var(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) +static zend_always_inline zval **_get_zval_ptr_ptr_var(const znode *node, const temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) { zval** ptr_ptr = T(node->u.var).var.ptr_ptr; - if (ptr_ptr) { + if (EXPECTED(ptr_ptr != NULL)) { PZVAL_UNLOCK(*ptr_ptr, should_free); } else { /* string offset */ @@ -268,34 +297,17 @@ static inline zval **_get_zval_ptr_ptr_var(znode *node, temp_variable *Ts, zend_ return ptr_ptr; } -static inline zval **_get_zval_ptr_ptr_cv(znode *node, temp_variable *Ts, int type TSRMLS_DC) +static zend_always_inline zval **_get_zval_ptr_ptr_cv(const znode *node, const temp_variable *Ts, int type TSRMLS_DC) { zval ***ptr = &CV_OF(node->u.var); - if (!*ptr) { - zend_compiled_variable *cv = &CV_DEF_OF(node->u.var); - if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) { - switch (type) { - case BP_VAR_R: - case BP_VAR_UNSET: - zend_error(E_NOTICE, "Undefined variable: %s", cv->name); - /* break missing intentionally */ - case BP_VAR_IS: - return &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE, "Undefined variable: %s", cv->name); - /* break missing intentionally */ - case BP_VAR_W: - zend_get_cv_address(cv, ptr, Ts TSRMLS_CC); - break; - } - } + if (UNEXPECTED(*ptr == NULL)) { + return _get_zval_cv_lookup(ptr, node->u.var, type TSRMLS_CC); } return *ptr; } -static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) +static inline zval **_get_zval_ptr_ptr(const znode *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { if (node->op_type == IS_CV) { should_free->var = 0; @@ -308,9 +320,9 @@ static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free } } -static inline zval *_get_obj_zval_ptr_unused(TSRMLS_D) +static zend_always_inline zval *_get_obj_zval_ptr_unused(TSRMLS_D) { - if (EG(This)) { + if (EXPECTED(EG(This) != NULL)) { return EG(This); } else { zend_error_noreturn(E_ERROR, "Using $this when not in object context"); @@ -318,10 +330,10 @@ static inline zval *_get_obj_zval_ptr_unused(TSRMLS_D) } } -static inline zval **_get_obj_zval_ptr_ptr(znode *op, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) +static inline zval **_get_obj_zval_ptr_ptr(const znode *op, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { if (op->op_type == IS_UNUSED) { - if (EG(This)) { + if (EXPECTED(EG(This) != NULL)) { /* this should actually never be modified, _ptr_ptr is modified only when the object is empty */ should_free->var = 0; @@ -333,9 +345,9 @@ static inline zval **_get_obj_zval_ptr_ptr(znode *op, temp_variable *Ts, zend_fr return get_zval_ptr_ptr(op, Ts, should_free, type); } -static inline zval **_get_obj_zval_ptr_ptr_unused(TSRMLS_D) +static zend_always_inline zval **_get_obj_zval_ptr_ptr_unused(TSRMLS_D) { - if (EG(This)) { + if (EXPECTED(EG(This) != NULL)) { return &EG(This); } else { zend_error_noreturn(E_ERROR, "Using $this when not in object context"); @@ -343,10 +355,10 @@ static inline zval **_get_obj_zval_ptr_ptr_unused(TSRMLS_D) } } -static inline zval *_get_obj_zval_ptr(znode *op, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) +static inline zval *_get_obj_zval_ptr(znode *op, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { if (op->op_type == IS_UNUSED) { - if (EG(This)) { + if (EXPECTED(EG(This) != NULL)) { should_free->var = 0; return EG(This); } else { @@ -356,77 +368,60 @@ static inline zval *_get_obj_zval_ptr(znode *op, temp_variable *Ts, zend_free_op return get_zval_ptr(op, Ts, should_free, type); } -static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC) +static inline void zend_switch_free(temp_variable *T, int extended_value TSRMLS_DC) { - switch (opline->op1.op_type) { - case IS_VAR: - if (!T(opline->op1.u.var).var.ptr_ptr) { - temp_variable *T = &T(opline->op1.u.var); - /* perform the equivalent of equivalent of a - * quick & silent get_zval_ptr, and FREE_OP - */ - PZVAL_UNLOCK_FREE(T->str_offset.str); - } else if (T(opline->op1.u.var).var.ptr) { - zval_ptr_dtor(&T(opline->op1.u.var).var.ptr); - if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { /* foreach() free */ - zval_ptr_dtor(&T(opline->op1.u.var).var.ptr); - } - } - break; - case IS_TMP_VAR: - zendi_zval_dtor(T(opline->op1.u.var).tmp_var); - break; - EMPTY_SWITCH_DEFAULT_CASE() + if (T->var.ptr) { + if (extended_value & ZEND_FE_RESET_VARIABLE) { /* foreach() free */ + Z_DELREF_P(T->var.ptr); + } + zval_ptr_dtor(&T->var.ptr); + } else if (!T->var.ptr_ptr) { + /* perform the equivalent of equivalent of a + * quick & silent get_zval_ptr, and FREE_OP + */ + PZVAL_UNLOCK_FREE(T->str_offset.str); } } static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **value_ptr_ptr TSRMLS_DC) { - zval *variable_ptr; - zval *value_ptr; - - if (!value_ptr_ptr || !variable_ptr_ptr) { - zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects"); - return; - } - - variable_ptr = *variable_ptr_ptr; - value_ptr = *value_ptr_ptr; + zval *variable_ptr = *variable_ptr_ptr; + zval *value_ptr = *value_ptr_ptr; if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) { variable_ptr_ptr = &EG(uninitialized_zval_ptr); } else if (variable_ptr != value_ptr) { if (!PZVAL_IS_REF(value_ptr)) { /* break it away */ - value_ptr->refcount--; - if (value_ptr->refcount>0) { + Z_DELREF_P(value_ptr); + if (Z_REFCOUNT_P(value_ptr)>0) { ALLOC_ZVAL(*value_ptr_ptr); **value_ptr_ptr = *value_ptr; value_ptr = *value_ptr_ptr; zendi_zval_copy_ctor(*value_ptr); } - value_ptr->refcount = 1; - value_ptr->is_ref = 1; + Z_SET_REFCOUNT_P(value_ptr, 1); + Z_SET_ISREF_P(value_ptr); } *variable_ptr_ptr = value_ptr; - value_ptr->refcount++; + Z_ADDREF_P(value_ptr); zval_ptr_dtor(&variable_ptr); - } else if (!variable_ptr->is_ref) { + } else if (!Z_ISREF_P(variable_ptr)) { if (variable_ptr_ptr == value_ptr_ptr) { SEPARATE_ZVAL(variable_ptr_ptr); } else if (variable_ptr==EG(uninitialized_zval_ptr) - || variable_ptr->refcount>2) { + || Z_REFCOUNT_P(variable_ptr)>2) { /* we need to separate */ - variable_ptr->refcount -= 2; + Z_SET_REFCOUNT_P(variable_ptr, Z_REFCOUNT_P(variable_ptr) - 2); ALLOC_ZVAL(*variable_ptr_ptr); **variable_ptr_ptr = *variable_ptr; zval_copy_ctor(*variable_ptr_ptr); *value_ptr_ptr = *variable_ptr_ptr; - (*variable_ptr_ptr)->refcount = 2; + Z_SET_REFCOUNT_PP(variable_ptr_ptr, 2); } - (*variable_ptr_ptr)->is_ref = 1; + Z_SET_ISREF_PP(variable_ptr_ptr); } } @@ -445,9 +440,9 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC) } } -static inline char * zend_verify_arg_class_kind(zend_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce TSRMLS_DC) +static inline char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC) { - *pce = zend_fetch_class(cur_arg_info->class_name, cur_arg_info->class_name_len, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC); + *pce = zend_fetch_class(cur_arg_info->class_name, cur_arg_info->class_name_len, (fetch_type | ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC); *class_name = (*pce) ? (*pce)->name: cur_arg_info->class_name; if (*pce && (*pce)->ce_flags & ZEND_ACC_INTERFACE) { @@ -457,7 +452,7 @@ static inline char * zend_verify_arg_class_kind(zend_arg_info *cur_arg_info, cha } } -static inline int zend_verify_arg_error(zend_function *zf, zend_uint arg_num, zend_arg_info *cur_arg_info, char *need_msg, char *need_kind, char *given_msg, char *given_kind TSRMLS_DC) +static inline int zend_verify_arg_error(const zend_function *zf, zend_uint arg_num, const zend_arg_info *cur_arg_info, const char *need_msg, const char *need_kind, const char *given_msg, char *given_kind TSRMLS_DC) { zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data; char *fname = zf->common.function_name; @@ -480,7 +475,7 @@ static inline int zend_verify_arg_error(zend_function *zf, zend_uint arg_num, ze return 0; } -static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg TSRMLS_DC) +static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type TSRMLS_DC) { zend_arg_info *cur_arg_info; char *need_msg; @@ -494,19 +489,19 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva cur_arg_info = &zf->common.arg_info[arg_num-1]; if (cur_arg_info->class_name) { - char *class_name; + const char *class_name; if (!arg) { - need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce TSRMLS_CC); + need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC); return zend_verify_arg_error(zf, arg_num, cur_arg_info, need_msg, class_name, "none", "" TSRMLS_CC); } if (Z_TYPE_P(arg) == IS_OBJECT) { - need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce TSRMLS_CC); + need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC); if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) { return zend_verify_arg_error(zf, arg_num, cur_arg_info, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name TSRMLS_CC); } } else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) { - need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce TSRMLS_CC); + need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC); return zend_verify_arg_error(zf, arg_num, cur_arg_info, need_msg, class_name, zend_zval_type_name(arg), "" TSRMLS_CC); } } else if (cur_arg_info->array_type_hint) { @@ -520,87 +515,78 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva return 1; } +static inline void zend_assign_to_object(znode *result, zval **object_ptr, zval *property_name, znode *value_op, const temp_variable *Ts, int opcode TSRMLS_DC) -static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode *op2, znode *value_op, temp_variable *Ts, int opcode TSRMLS_DC) { zval *object; - zend_free_op free_op2, free_value; - zval *property_name = get_zval_ptr(op2, Ts, &free_op2, BP_VAR_R); + zend_free_op free_value; zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R); zval **retval = &T(result->u.var).var.ptr; - if (!object_ptr) { - zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); - } - - if (*object_ptr == EG(error_zval_ptr)) { - FREE_OP(free_op2); - if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + if (Z_TYPE_P(*object_ptr) != IS_OBJECT) { + if (*object_ptr == EG(error_zval_ptr)) { + if (!RETURN_VALUE_UNUSED(result)) { + *retval = EG(uninitialized_zval_ptr); + PZVAL_LOCK(*retval); + } + FREE_OP(free_value); + return; } - FREE_OP(free_value); - return; - } - - make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ - object = *object_ptr; - - if (Z_TYPE_P(object) != IS_OBJECT || (opcode == ZEND_ASSIGN_OBJ && !Z_OBJ_HT_P(object)->write_property)) { - zend_error(E_WARNING, "Attempt to assign property of non-object"); - FREE_OP(free_op2); - if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + if (Z_TYPE_PP(object_ptr) == IS_NULL || + (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0) || + (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)) { + zend_error(E_STRICT, "Creating default object from empty value"); + SEPARATE_ZVAL_IF_NOT_REF(object_ptr); + zval_dtor(*object_ptr); + object_init(*object_ptr); + } else { + zend_error(E_WARNING, "Attempt to assign property of non-object"); + if (!RETURN_VALUE_UNUSED(result)) { + *retval = EG(uninitialized_zval_ptr); + PZVAL_LOCK(*retval); + } + FREE_OP(free_value); + return; } - FREE_OP(free_value); - return; } /* here we are sure we are dealing with an object */ + object = *object_ptr; /* separate our value if necessary */ - if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) { - zval *orig_value = value; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(value); - *value = *orig_value; - value->is_ref = 0; - value->refcount = 0; - dup = zend_get_object_classname(orig_value, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - value->value.obj = Z_OBJ_HANDLER_P(orig_value, clone_obj)(orig_value TSRMLS_CC); - if(!dup) { - efree(class_name); - } - } else if (value_op->op_type == IS_TMP_VAR) { + if (value_op->op_type == IS_TMP_VAR) { zval *orig_value = value; ALLOC_ZVAL(value); *value = *orig_value; - value->is_ref = 0; - value->refcount = 0; + Z_UNSET_ISREF_P(value); + Z_SET_REFCOUNT_P(value, 0); } else if (value_op->op_type == IS_CONST) { zval *orig_value = value; ALLOC_ZVAL(value); *value = *orig_value; - value->is_ref = 0; - value->refcount = 0; + Z_UNSET_ISREF_P(value); + Z_SET_REFCOUNT_P(value, 0); zval_copy_ctor(value); } - value->refcount++; + Z_ADDREF_P(value); if (opcode == ZEND_ASSIGN_OBJ) { - if (IS_TMP_FREE(free_op2)) { - MAKE_REAL_ZVAL_PTR(property_name); + if (!Z_OBJ_HT_P(object)->write_property) { + zend_error(E_WARNING, "Attempt to assign property of non-object"); + if (!RETURN_VALUE_UNUSED(result)) { + *retval = EG(uninitialized_zval_ptr); + PZVAL_LOCK(*retval); + } + if (value_op->op_type == IS_TMP_VAR) { + FREE_ZVAL(value); + } else if (value_op->op_type == IS_CONST) { + zval_ptr_dtor(&value); + } + FREE_OP(free_value); + return; } Z_OBJ_HT_P(object)->write_property(object, property_name, value TSRMLS_CC); } else { @@ -608,283 +594,148 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode if (!Z_OBJ_HT_P(object)->write_dimension) { zend_error_noreturn(E_ERROR, "Cannot use object as array"); } - if (IS_TMP_FREE(free_op2)) { - MAKE_REAL_ZVAL_PTR(property_name); - } Z_OBJ_HT_P(object)->write_dimension(object, property_name, value TSRMLS_CC); } - if (result && !RETURN_VALUE_UNUSED(result) && !EG(exception)) { - T(result->u.var).var.ptr = value; - T(result->u.var).var.ptr_ptr = &T(result->u.var).var.ptr; /* this is so that we could use it in FETCH_DIM_R, etc. - see bug #27876 */ + if (!RETURN_VALUE_UNUSED(result) && !EG(exception)) { + AI_SET_PTR(T(result->u.var).var, value); PZVAL_LOCK(value); } - if (IS_TMP_FREE(free_op2)) { - zval_ptr_dtor(&property_name); - } else { - FREE_OP(free_op2); - } zval_ptr_dtor(&value); FREE_OP_IF_VAR(free_value); } - -static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts TSRMLS_DC) +static inline int zend_assign_to_string_offset(const temp_variable *T, const zval *value, int value_type TSRMLS_DC) { - zend_free_op free_op1; - zval **variable_ptr_ptr = get_zval_ptr_ptr(op1, Ts, &free_op1, BP_VAR_W); - zval *variable_ptr; - - if (!variable_ptr_ptr) { - temp_variable *T = &T(op1->u.var); - - if (Z_TYPE_P(T->str_offset.str) == IS_STRING) - do { - zval tmp; - zval *final_value = value; - - if (((int)T->str_offset.offset < 0)) { - zend_error(E_WARNING, "Illegal string offset: %d", T->str_offset.offset); - if (!RETURN_VALUE_UNUSED(result)) { - T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*T(result->u.var).var.ptr_ptr); - AI_USE_PTR(T(result->u.var).var); - } - FREE_OP_VAR_PTR(free_op1); - return; - } - if (T->str_offset.offset >= Z_STRLEN_P(T->str_offset.str)) { - zend_uint i; + if (Z_TYPE_P(T->str_offset.str) == IS_STRING) { - if (Z_STRLEN_P(T->str_offset.str)==0) { - STR_FREE(Z_STRVAL_P(T->str_offset.str)); - Z_STRVAL_P(T->str_offset.str) = (char *) emalloc(T->str_offset.offset+1+1); - } else { - Z_STRVAL_P(T->str_offset.str) = (char *) erealloc(Z_STRVAL_P(T->str_offset.str), T->str_offset.offset+1+1); - } - for (i=Z_STRLEN_P(T->str_offset.str); istr_offset.offset; i++) { - Z_STRVAL_P(T->str_offset.str)[i] = ' '; - } - Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset+1] = 0; - Z_STRLEN_P(T->str_offset.str) = T->str_offset.offset+1; - } + if (((int)T->str_offset.offset < 0)) { + zend_error(E_WARNING, "Illegal string offset: %d", T->str_offset.offset); + return 0; + } - if (Z_TYPE_P(value)!=IS_STRING) { - tmp = *value; - if (op2->op_type != IS_TMP_VAR) { - zval_copy_ctor(&tmp); - } - convert_to_string(&tmp); - final_value = &tmp; - } + if (T->str_offset.offset >= Z_STRLEN_P(T->str_offset.str)) { + Z_STRVAL_P(T->str_offset.str) = (char *) erealloc(Z_STRVAL_P(T->str_offset.str), T->str_offset.offset+1+1); + memset(Z_STRVAL_P(T->str_offset.str) + Z_STRLEN_P(T->str_offset.str), + ' ', + T->str_offset.offset - Z_STRLEN_P(T->str_offset.str)); + Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset+1] = 0; + Z_STRLEN_P(T->str_offset.str) = T->str_offset.offset+1; + } - Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset] = Z_STRVAL_P(final_value)[0]; + if (Z_TYPE_P(value) != IS_STRING) { + zval tmp = *value; - if (final_value == &tmp) { - zval_dtor(final_value); - } else if (op2->op_type == IS_TMP_VAR) { + if (value_type != IS_TMP_VAR) { + zval_copy_ctor(&tmp); + } + convert_to_string(&tmp); + Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset] = Z_STRVAL(tmp)[0]; + STR_FREE(Z_STRVAL(tmp)); + } else { + Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset] = Z_STRVAL_P(value)[0]; + if (value_type == IS_TMP_VAR) { /* we can safely free final_value here * because separation is done only - * in case op2->op_type == IS_VAR */ - STR_FREE(Z_STRVAL_P(final_value)); + * in case value_type == IS_VAR */ + STR_FREE(Z_STRVAL_P(value)); } - /* - * the value of an assignment to a string offset is undefined - T(result->u.var).var = &T->str_offset.str; - */ - } while (0); - /* zval_ptr_dtor(&T->str_offset.str); Nuke this line if it doesn't cause a leak */ - - if (!RETURN_VALUE_UNUSED(result)) { - T(result->u.var).var.ptr_ptr = &T(result->u.var).var.ptr; - ALLOC_ZVAL(T(result->u.var).var.ptr); - INIT_PZVAL(T(result->u.var).var.ptr); - ZVAL_STRINGL(T(result->u.var).var.ptr, Z_STRVAL_P(T->str_offset.str)+T->str_offset.offset, 1, 1); } - FREE_OP_VAR_PTR(free_op1); - return; + /* + * the value of an assignment to a string offset is undefined + T(result->u.var).var = &T->str_offset.str; + */ } + return 1; +} - variable_ptr = *variable_ptr_ptr; +static inline zval* zend_assign_to_variable(zval **variable_ptr_ptr, zval *value, int is_tmp_var TSRMLS_DC) +{ + zval *variable_ptr = *variable_ptr_ptr; + zval garbage; if (variable_ptr == EG(error_zval_ptr)) { - if (result && !RETURN_VALUE_UNUSED(result)) { - T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*T(result->u.var).var.ptr_ptr); - AI_USE_PTR(T(result->u.var).var); - } - if (type==IS_TMP_VAR) { + if (is_tmp_var) { zval_dtor(value); } - FREE_OP_VAR_PTR(free_op1); - return; + return EG(uninitialized_zval_ptr); } if (Z_TYPE_P(variable_ptr) == IS_OBJECT && Z_OBJ_HANDLER_P(variable_ptr, set)) { Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr_ptr, value TSRMLS_CC); - goto done_setting_var; + return variable_ptr; } - if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) { - char *class_name; - zend_uint class_name_len; - int dup; - - dup = zend_get_object_classname(value, &class_name, &class_name_len TSRMLS_CC); - - if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } else if (PZVAL_IS_REF(variable_ptr)) { - if (variable_ptr != value) { - zend_uint refcount = variable_ptr->refcount; - zval garbage; - - garbage = *variable_ptr; - *variable_ptr = *value; - variable_ptr->refcount = refcount; - variable_ptr->is_ref = 1; - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); - zendi_zval_dtor(garbage); - } - } else { - if (variable_ptr != value) { - value->refcount++; - variable_ptr->refcount--; - if (variable_ptr->refcount == 0) { - zendi_zval_dtor(*variable_ptr); - } else { - ALLOC_ZVAL(variable_ptr); - *variable_ptr_ptr = variable_ptr; - } - *variable_ptr = *value; - INIT_PZVAL(variable_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); - zval_ptr_dtor(&value); - } - } - if (!dup) { - efree(class_name); - } - } else if (PZVAL_IS_REF(variable_ptr)) { + if (PZVAL_IS_REF(variable_ptr)) { if (variable_ptr!=value) { - zend_uint refcount = variable_ptr->refcount; - zval garbage; + zend_uint refcount = Z_REFCOUNT_P(variable_ptr); garbage = *variable_ptr; *variable_ptr = *value; - variable_ptr->refcount = refcount; - variable_ptr->is_ref = 1; - if (type!=IS_TMP_VAR) { + Z_SET_REFCOUNT_P(variable_ptr, refcount); + Z_SET_ISREF_P(variable_ptr); + if (!is_tmp_var) { zendi_zval_copy_ctor(*variable_ptr); } zendi_zval_dtor(garbage); + return variable_ptr; } } else { - variable_ptr->refcount--; - if (variable_ptr->refcount==0) { - switch (type) { - case IS_CV: - case IS_VAR: - /* break missing intentionally */ - case IS_CONST: - if (variable_ptr==value) { - variable_ptr->refcount++; - } else if (PZVAL_IS_REF(value)) { - zval tmp; - - tmp = *value; - zval_copy_ctor(&tmp); - tmp.refcount=1; - zendi_zval_dtor(*variable_ptr); - *variable_ptr = tmp; - } else { - value->refcount++; - zendi_zval_dtor(*variable_ptr); - safe_free_zval_ptr(variable_ptr); - *variable_ptr_ptr = value; - } - break; - case IS_TMP_VAR: - zendi_zval_dtor(*variable_ptr); - value->refcount=1; + if (Z_DELREF_P(variable_ptr)==0) { + if (!is_tmp_var) { + if (variable_ptr==value) { + Z_ADDREF_P(variable_ptr); + } else if (PZVAL_IS_REF(value)) { + garbage = *variable_ptr; *variable_ptr = *value; - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - } else { /* we need to split */ - switch (type) { - case IS_CV: - case IS_VAR: - /* break missing intentionally */ - case IS_CONST: - if (PZVAL_IS_REF(value) && value->refcount > 0) { - ALLOC_ZVAL(variable_ptr); - *variable_ptr_ptr = variable_ptr; - *variable_ptr = *value; - zval_copy_ctor(variable_ptr); - variable_ptr->refcount=1; - break; + INIT_PZVAL(variable_ptr); + zval_copy_ctor(variable_ptr); + zendi_zval_dtor(garbage); + return variable_ptr; + } else { + Z_ADDREF_P(value); + *variable_ptr_ptr = value; + if (variable_ptr != &EG(uninitialized_zval)) { + GC_REMOVE_ZVAL_FROM_BUFFER(variable_ptr); + zval_dtor(variable_ptr); + efree(variable_ptr); } + return value; + } + } else { + garbage = *variable_ptr; + *variable_ptr = *value; + INIT_PZVAL(variable_ptr); + zendi_zval_dtor(garbage); + return variable_ptr; + } + } else { /* we need to split */ + if (!is_tmp_var) { + if (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) { + ALLOC_ZVAL(variable_ptr); + *variable_ptr_ptr = variable_ptr; + *variable_ptr = *value; + zval_copy_ctor(variable_ptr); + Z_SET_REFCOUNT_P(variable_ptr, 1); + } else { *variable_ptr_ptr = value; - value->refcount++; - break; - case IS_TMP_VAR: - ALLOC_ZVAL(*variable_ptr_ptr); - value->refcount=1; - **variable_ptr_ptr = *value; - break; - EMPTY_SWITCH_DEFAULT_CASE() - } + Z_ADDREF_P(value); + } + } else { + ALLOC_ZVAL(*variable_ptr_ptr); + Z_SET_REFCOUNT_P(value, 1); + **variable_ptr_ptr = *value; + } } - (*variable_ptr_ptr)->is_ref=0; + Z_UNSET_ISREF_PP(variable_ptr_ptr); } -done_setting_var: - if (result && !RETURN_VALUE_UNUSED(result)) { - T(result->u.var).var.ptr_ptr = variable_ptr_ptr; - PZVAL_LOCK(*variable_ptr_ptr); - AI_USE_PTR(T(result->u.var).var); - } - FREE_OP_VAR_PTR(free_op1); + return *variable_ptr_ptr; } -static inline void zend_receive(zval **variable_ptr_ptr, zval *value TSRMLS_DC) -{ - zval *variable_ptr = *variable_ptr_ptr; - - if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) { - char *class_name; - zend_uint class_name_len; - int dup; - - dup = zend_get_object_classname(value, &class_name, &class_name_len TSRMLS_CC); - - if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } else { - variable_ptr->refcount--; - ALLOC_ZVAL(variable_ptr); - *variable_ptr_ptr = variable_ptr; - *variable_ptr = *value; - INIT_PZVAL(variable_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); - } - if (!dup) { - efree(class_name); - } - } else { - variable_ptr->refcount--; - *variable_ptr_ptr = value; - value->refcount++; - } -} - /* Utility Functions for Extensions */ -static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) +static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC) { if (extension->statement_handler) { extension->statement_handler(op_array); @@ -892,7 +743,7 @@ static void zend_extension_statement_handler(zend_extension *extension, zend_op_ } -static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) +static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC) { if (extension->fcall_begin_handler) { extension->fcall_begin_handler(op_array); @@ -900,7 +751,7 @@ static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_o } -static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) +static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC) { if (extension->fcall_end_handler) { extension->fcall_end_handler(op_array); @@ -908,10 +759,13 @@ static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_ } -static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_variable *Ts, int type, zval *variable TSRMLS_DC) +static inline HashTable *zend_get_target_symbol_table(const zend_op *opline, const temp_variable *Ts, int type, const zval *variable TSRMLS_DC) { switch (opline->op2.u.EA.type) { case ZEND_FETCH_LOCAL: + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } return EG(active_symbol_table); break; case ZEND_FETCH_GLOBAL: @@ -930,11 +784,12 @@ static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_vari return NULL; } -static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, zval *dim, int type TSRMLS_DC) +static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zval *dim, int type TSRMLS_DC) { zval **retval; char *offset_key; int offset_key_length; + long index; switch (dim->type) { case IS_NULL: @@ -951,154 +806,124 @@ fetch_string_dim: if (zend_symtable_find(ht, offset_key, offset_key_length+1, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE, "Undefined index: %s", offset_key); + zend_error(E_NOTICE, "Undefined index: %s", offset_key); /* break missing intentionally */ case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined index: %s", offset_key); + zend_error(E_NOTICE,"Undefined index: %s", offset_key); /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); - new_zval->refcount++; + Z_ADDREF_P(new_zval); zend_symtable_update(ht, offset_key, offset_key_length+1, &new_zval, sizeof(zval *), (void **) &retval); } break; } } break; + case IS_DOUBLE: { + DVAL_TO_LVAL(Z_DVAL_P(dim), index); + goto num_index; + } case IS_RESOURCE: zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(dim), Z_LVAL_P(dim)); /* Fall Through */ - case IS_DOUBLE: case IS_BOOL: - case IS_LONG: { - long index; - - if (Z_TYPE_P(dim) == IS_DOUBLE) { - index = (long)Z_DVAL_P(dim); - } else { - index = Z_LVAL_P(dim); - } - if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { - switch (type) { - case BP_VAR_R: - zend_error(E_NOTICE,"Undefined offset: %ld", index); - /* break missing intentionally */ - case BP_VAR_UNSET: - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined offset: %ld", index); - /* break missing intentionally */ - case BP_VAR_W: { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval); - } + case IS_LONG: + index = Z_LVAL_P(dim); +num_index: + if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { + switch (type) { + case BP_VAR_R: + zend_error(E_NOTICE,"Undefined offset: %ld", index); + /* break missing intentionally */ + case BP_VAR_UNSET: + case BP_VAR_IS: + retval = &EG(uninitialized_zval_ptr); break; + case BP_VAR_RW: + zend_error(E_NOTICE,"Undefined offset: %ld", index); + /* break missing intentionally */ + case BP_VAR_W: { + zval *new_zval = &EG(uninitialized_zval); + + Z_ADDREF_P(new_zval); + zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval); } + break; } } break; + default: zend_error(E_WARNING, "Illegal offset type"); - switch (type) { - case BP_VAR_R: - case BP_VAR_IS: - case BP_VAR_UNSET: - retval = &EG(uninitialized_zval_ptr); - break; - default: - retval = &EG(error_zval_ptr); - break; - } - break; + return (type == BP_VAR_W || type == BP_VAR_RW) ? + &EG(error_zval_ptr) : &EG(uninitialized_zval_ptr); } return retval; } static void zend_fetch_dimension_address(temp_variable *result, zval **container_ptr, zval *dim, int dim_is_tmp_var, int type TSRMLS_DC) { - zval *container; - - if (!container_ptr) { - zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); - } - - container = *container_ptr; - - if (container == EG(error_zval_ptr)) { - if (result) { - result->var.ptr_ptr = &EG(error_zval_ptr); - PZVAL_LOCK(*result->var.ptr_ptr); - if (type == BP_VAR_R || type == BP_VAR_IS) { - AI_USE_PTR(result->var); - } - } - return; - } - - if (Z_TYPE_P(container)==IS_NULL - || (Z_TYPE_P(container)==IS_BOOL && Z_LVAL_P(container)==0) - || (Z_TYPE_P(container)==IS_STRING && Z_STRLEN_P(container)==0)) { - switch (type) { - case BP_VAR_RW: - case BP_VAR_W: - if (!PZVAL_IS_REF(container)) { - SEPARATE_ZVAL(container_ptr); - container = *container_ptr; - } - zval_dtor(container); - array_init(container); - break; - } - } + zval *container = *container_ptr; + zval **retval; switch (Z_TYPE_P(container)) { - zval **retval; case IS_ARRAY: - if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) { + if (type != BP_VAR_UNSET && Z_REFCOUNT_P(container)>1 && !PZVAL_IS_REF(container)) { SEPARATE_ZVAL(container_ptr); container = *container_ptr; } +fetch_from_array: if (dim == NULL) { zval *new_zval = &EG(uninitialized_zval); - new_zval->refcount++; + Z_ADDREF_P(new_zval); if (zend_hash_next_index_insert(Z_ARRVAL_P(container), &new_zval, sizeof(zval *), (void **) &retval) == FAILURE) { zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied"); retval = &EG(error_zval_ptr); - new_zval->refcount--; + Z_DELREF_P(new_zval); } } else { retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, type TSRMLS_CC); } - if (result) { - result->var.ptr_ptr = retval; - PZVAL_LOCK(*result->var.ptr_ptr); - } + result->var.ptr_ptr = retval; + PZVAL_LOCK(*retval); + return; break; - case IS_NULL: { - /* for read-mode only */ - if (result) { + + case IS_NULL: + if (container == EG(error_zval_ptr)) { + result->var.ptr_ptr = &EG(error_zval_ptr); + PZVAL_LOCK(EG(error_zval_ptr)); + } else if (type != BP_VAR_UNSET) { +convert_to_array: + if (!PZVAL_IS_REF(container)) { + SEPARATE_ZVAL(container_ptr); + container = *container_ptr; + } + zval_dtor(container); + array_init(container); + goto fetch_from_array; + } else { + /* for read-mode only */ result->var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*result->var.ptr_ptr); - } - if (type==BP_VAR_W || type==BP_VAR_RW) { - zend_error(E_WARNING, "Cannot use a NULL value as an array"); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } + return; break; - } + case IS_STRING: { zval tmp; + if (type != BP_VAR_UNSET && Z_STRLEN_P(container)==0) { + goto convert_to_array; + } if (dim == NULL) { zend_error_noreturn(E_ERROR, "[] operator not supported for strings"); } @@ -1122,29 +947,19 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container convert_to_long(&tmp); dim = &tmp; } - switch (type) { - case BP_VAR_R: - case BP_VAR_IS: - case BP_VAR_UNSET: - /* do nothing... */ - break; - default: - SEPARATE_ZVAL_IF_NOT_REF(container_ptr); - break; - } - if (result) { - container = *container_ptr; - result->str_offset.str = container; - PZVAL_LOCK(container); - result->str_offset.offset = Z_LVAL_P(dim); - result->var.ptr_ptr = NULL; - if (type == BP_VAR_R || type == BP_VAR_IS) { - AI_USE_PTR(result->var); - } + if (type != BP_VAR_UNSET) { + SEPARATE_ZVAL_IF_NOT_REF(container_ptr); } + container = *container_ptr; + result->str_offset.str = container; + PZVAL_LOCK(container); + result->str_offset.offset = Z_LVAL_P(dim); + result->var.ptr_ptr = NULL; + result->var.ptr = NULL; return; } break; + case IS_OBJECT: if (!Z_OBJ_HT_P(container)->read_dimension) { zend_error_noreturn(E_ERROR, "Cannot use object as array"); @@ -1159,16 +974,15 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container overloaded_result = Z_OBJ_HT_P(container)->read_dimension(container, dim, type TSRMLS_CC); if (overloaded_result) { - if (!overloaded_result->is_ref && - (type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET)) { - if (overloaded_result->refcount > 0) { + if (!Z_ISREF_P(overloaded_result)) { + if (Z_REFCOUNT_P(overloaded_result) > 0) { zval *tmp = overloaded_result; ALLOC_ZVAL(overloaded_result); *overloaded_result = *tmp; zval_copy_ctor(overloaded_result); - overloaded_result->is_ref = 0; - overloaded_result->refcount = 0; + Z_UNSET_ISREF_P(overloaded_result); + Z_SET_REFCOUNT_P(overloaded_result, 0); } if (Z_TYPE_P(overloaded_result) != IS_OBJECT) { zend_class_entry *ce = Z_OBJCE_P(container); @@ -1179,91 +993,165 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container } else { retval = &EG(error_zval_ptr); } - if (result) { - result->var.ptr_ptr = retval; - AI_USE_PTR(result->var); - PZVAL_LOCK(*result->var.ptr_ptr); - } else if ((*retval)->refcount == 0) { - /* Destroy unused result from offsetGet() magic method */ - (*retval)->refcount = 1; - zval_ptr_dtor(retval); - } + AI_SET_PTR(result->var, *retval); + PZVAL_LOCK(*retval); if (dim_is_tmp_var) { zval_ptr_dtor(&dim); } - return; } + return; break; - default: { - switch (type) { - case BP_VAR_UNSET: - zend_error(E_WARNING, "Cannot unset offset in a non-array variable"); - /* break missing intentionally */ - case BP_VAR_R: - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - default: - retval = &EG(error_zval_ptr); - break; + + case IS_BOOL: + if (type != BP_VAR_UNSET && Z_LVAL_P(container)==0) { + goto convert_to_array; + } + /* break missing intentionally */ + + default: + if (type == BP_VAR_UNSET) { + zend_error(E_WARNING, "Cannot unset offset in a non-array variable"); + AI_SET_PTR(result->var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } else { + zend_error(E_WARNING, "Cannot use a scalar value as an array"); + result->var.ptr_ptr = &EG(error_zval_ptr); + PZVAL_LOCK(EG(error_zval_ptr)); + } + break; + } +} + +static void zend_fetch_dimension_address_read(temp_variable *result, zval **container_ptr, zval *dim, int dim_is_tmp_var, int type TSRMLS_DC) +{ + zval *container = *container_ptr; + zval **retval; + + switch (Z_TYPE_P(container)) { + + case IS_ARRAY: + retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, type TSRMLS_CC); + if (result) { + AI_SET_PTR(result->var, *retval); + PZVAL_LOCK(*retval); + } + return; + break; + + case IS_NULL: + if (result) { + AI_SET_PTR(result->var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + return; + break; + + case IS_STRING: { + zval tmp; + + if (Z_TYPE_P(dim) != IS_LONG) { + switch(Z_TYPE_P(dim)) { + /* case IS_LONG: */ + case IS_STRING: + case IS_DOUBLE: + case IS_NULL: + case IS_BOOL: + /* do nothing */ + break; + default: + zend_error(E_WARNING, "Illegal offset type"); + break; + } + + tmp = *dim; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + dim = &tmp; } if (result) { - result->var.ptr_ptr = retval; - PZVAL_LOCK(*result->var.ptr_ptr); + if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) { + zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); + } + result->str_offset.str = container; + PZVAL_LOCK(container); + result->str_offset.offset = Z_LVAL_P(dim); + result->var.ptr_ptr = NULL; + result->var.ptr = NULL; } - if (type==BP_VAR_W || type==BP_VAR_RW) { - zend_error(E_WARNING, "Cannot use a scalar value as an array"); + return; + } + break; + + case IS_OBJECT: + if (!Z_OBJ_HT_P(container)->read_dimension) { + zend_error_noreturn(E_ERROR, "Cannot use object as array"); + } else { + zval *overloaded_result; + + if (dim_is_tmp_var) { + zval *orig = dim; + MAKE_REAL_ZVAL_PTR(dim); + ZVAL_NULL(orig); + } + overloaded_result = Z_OBJ_HT_P(container)->read_dimension(container, dim, type TSRMLS_CC); + + if (overloaded_result) { + if (result) { + AI_SET_PTR(result->var, overloaded_result); + PZVAL_LOCK(overloaded_result); + } else if (Z_REFCOUNT_P(overloaded_result) == 0) { + /* Destroy unused result from offsetGet() magic method */ + Z_SET_REFCOUNT_P(overloaded_result, 1); + zval_ptr_dtor(&overloaded_result); + } + } else if (result) { + AI_SET_PTR(result->var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + if (dim_is_tmp_var) { + zval_ptr_dtor(&dim); } } + return; + break; + + default: + if (result) { + AI_SET_PTR(result->var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + return; break; - } - if (result && (type == BP_VAR_R || type == BP_VAR_IS)) { - AI_USE_PTR(result->var); } } static void zend_fetch_property_address(temp_variable *result, zval **container_ptr, zval *prop_ptr, int type TSRMLS_DC) { - zval *container; + zval *container = *container_ptr;; - if (!container_ptr) { - zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); - } - - container = *container_ptr; - if (container == EG(error_zval_ptr)) { - if (result) { + if (Z_TYPE_P(container) != IS_OBJECT) { + if (container == EG(error_zval_ptr)) { result->var.ptr_ptr = &EG(error_zval_ptr); PZVAL_LOCK(*result->var.ptr_ptr); + return; } - return; - } - /* this should modify object only if it's empty */ - if (Z_TYPE_P(container) == IS_NULL - || (Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) - || (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)) { - switch (type) { - case BP_VAR_RW: - case BP_VAR_W: - if (!PZVAL_IS_REF(container)) { - SEPARATE_ZVAL(container_ptr); - container = *container_ptr; - } - object_init(container); - break; - } - } - if (Z_TYPE_P(container) != IS_OBJECT) { - if (result) { - if (type == BP_VAR_R || type == BP_VAR_IS) { - result->var.ptr_ptr = &EG(uninitialized_zval_ptr); - } else { - result->var.ptr_ptr = &EG(error_zval_ptr); + /* this should modify object only if it's empty */ + if (type != BP_VAR_UNSET && + ((Z_TYPE_P(container) == IS_NULL || + (Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) || + (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) { + if (!PZVAL_IS_REF(container)) { + SEPARATE_ZVAL(container_ptr); + container = *container_ptr; } - PZVAL_LOCK(*result->var.ptr_ptr); + object_init(container); + } else { + zend_error(E_WARNING, "Attempt to modify property of non-object"); + result->var.ptr_ptr = &EG(error_zval_ptr); + PZVAL_LOCK(EG(error_zval_ptr)); + return; } - return; } if (Z_OBJ_HT_P(container)->get_property_ptr_ptr) { @@ -1273,34 +1161,28 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_ if (Z_OBJ_HT_P(container)->read_property && (ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type TSRMLS_CC)) != NULL) { - if (result) { - result->var.ptr = ptr; - result->var.ptr_ptr = &result->var.ptr; - } + AI_SET_PTR(result->var, ptr); + PZVAL_LOCK(ptr); } else { - zend_error(E_ERROR, "Cannot access undefined property for object with overloaded property access"); + zend_error_noreturn(E_ERROR, "Cannot access undefined property for object with overloaded property access"); } - } else if (result) { + } else { result->var.ptr_ptr = ptr_ptr; + PZVAL_LOCK(*ptr_ptr); } } else if (Z_OBJ_HT_P(container)->read_property) { - if (result) { - result->var.ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type TSRMLS_CC); - result->var.ptr_ptr = &result->var.ptr; - } + zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type TSRMLS_CC); + + AI_SET_PTR(result->var, ptr); + PZVAL_LOCK(ptr); } else { zend_error(E_WARNING, "This object doesn't support property references"); - if (result) { - result->var.ptr_ptr = &EG(error_zval_ptr); - } - } - - if (result) { - PZVAL_LOCK(*result->var.ptr_ptr); + result->var.ptr_ptr = &EG(error_zval_ptr); + PZVAL_LOCK(EG(error_zval_ptr)); } } -static inline zend_brk_cont_element* zend_brk_cont(zval *nest_levels_zval, int array_offset, zend_op_array *op_array, temp_variable *Ts TSRMLS_DC) +static inline zend_brk_cont_element* zend_brk_cont(const zval *nest_levels_zval, int array_offset, const zend_op_array *op_array, const temp_variable *Ts TSRMLS_DC) { zval tmp; int nest_levels, original_nest_levels; @@ -1325,10 +1207,14 @@ static inline zend_brk_cont_element* zend_brk_cont(zval *nest_levels_zval, int a switch (brk_opline->opcode) { case ZEND_SWITCH_FREE: - zend_switch_free(brk_opline, Ts TSRMLS_CC); + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zend_switch_free(&T(brk_opline->op1.u.var), brk_opline->extended_value TSRMLS_CC); + } break; case ZEND_FREE: - zendi_zval_dtor(T(brk_opline->op1.u.var).tmp_var); + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zendi_zval_dtor(T(brk_opline->op1.u.var).tmp_var); + } break; } } @@ -1383,31 +1269,18 @@ ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_v EX(opline) = new_op #define ZEND_VM_JMP(new_op) \ - CHECK_SYMBOL_TABLES() \ - EX(opline) = EG(exception)?EX(opline)+1:new_op; \ - ZEND_VM_CONTINUE() + CHECK_SYMBOL_TABLES() \ + if (EXPECTED(!EG(exception))) { \ + EX(opline) = new_op; \ + } \ + ZEND_VM_CONTINUE() #define ZEND_VM_INC_OPCODE() \ - if (!EG(exception)) { \ - CHECK_SYMBOL_TABLES() \ - EX(opline)++; \ - } - -#define ZEND_VM_RETURN_FROM_EXECUTE_LOOP() \ - free_alloca(EX(CVs)); \ - if (EX(op_array)->T < TEMP_VAR_STACK_LIMIT) { \ - free_alloca(EX(Ts)); \ - } else { \ - efree(EX(Ts)); \ - } \ - EG(in_execution) = EX(original_in_execution); \ - EG(current_execute_data) = EX(prev_execute_data); \ - EG(opline_ptr) = NULL; \ - ZEND_VM_RETURN() + EX(opline)++ #include "zend_vm_execute.h" -ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, opcode_handler_t handler) +ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler) { if (opcode != ZEND_USER_OPCODE) { zend_user_opcodes[opcode] = ZEND_USER_OPCODE; @@ -1417,16 +1290,16 @@ ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, opcode_handler_t ha return FAILURE; } -ZEND_API opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode) +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(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { +ZEND_API zval *zend_get_zval_ptr(znode *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { return get_zval_ptr(node, Ts, should_free, type); } -ZEND_API zval **zend_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { +ZEND_API zval **zend_get_zval_ptr_ptr(const znode *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { return get_zval_ptr_ptr(node, Ts, should_free, type); } diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index e0aa7cddc..47c5fbd3d 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.h,v 1.84.2.4.2.10 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_execute.h,v 1.84.2.4.2.8.2.12 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_EXECUTE_H #define ZEND_EXECUTE_H @@ -70,8 +70,8 @@ static inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LI FREE_ZVAL_REL(p); } } -ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC); -ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC); +ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC); +ZEND_API int zend_lookup_class_ex(const char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC); ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC); ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC); @@ -122,15 +122,8 @@ static inline int i_zend_is_true(zval *op) break; } } - - if(EG(ze1_compatibility_mode)) { - result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0); - } else { - result = 1; - } - } else { - result = 1; } + result = 1; break; default: result = 0; @@ -143,30 +136,158 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC); ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC); /* dedicated Zend executor functions - do not use! */ -static inline void zend_ptr_stack_clear_multiple(TSRMLS_D) +#define ZEND_VM_STACK_PAGE_SIZE ((64 * 1024) - 64) + +struct _zend_vm_stack { + void **top; + void **end; + zend_vm_stack prev; + void *elements[1]; +}; + +#define ZEND_VM_STACK_GROW_IF_NEEDED(count) \ + do { \ + if (UNEXPECTED((count) > \ + EG(argument_stack)->end - EG(argument_stack)->top)) { \ + zend_vm_stack_extend((count) TSRMLS_CC); \ + } \ + } while (0) + +static inline zend_vm_stack zend_vm_stack_new_page(int count) { + zend_vm_stack page = (zend_vm_stack)emalloc(sizeof(*page)+sizeof(page->elements[0])*(count-1)); + + page->top = page->elements; + page->end = page->elements + count; + page->prev = NULL; + return page; +} + +static inline void zend_vm_stack_init(TSRMLS_D) +{ + EG(argument_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_SIZE); +} + +static inline void zend_vm_stack_destroy(TSRMLS_D) +{ + zend_vm_stack stack = EG(argument_stack); + + while (stack != NULL) { + zend_vm_stack p = stack->prev; + efree(stack); + stack = p; + } +} + +static inline void zend_vm_stack_extend(int count TSRMLS_DC) +{ + zend_vm_stack p = zend_vm_stack_new_page(count >= ZEND_VM_STACK_PAGE_SIZE ? count : ZEND_VM_STACK_PAGE_SIZE); + p->prev = EG(argument_stack); + EG(argument_stack) = p; +} + +static inline void **zend_vm_stack_top(TSRMLS_D) +{ + return EG(argument_stack)->top; +} + +static inline void zend_vm_stack_push(void *ptr TSRMLS_DC) +{ + ZEND_VM_STACK_GROW_IF_NEEDED(1); + *(EG(argument_stack)->top++) = ptr; +} + +static inline void zend_vm_stack_push_nocheck(void *ptr TSRMLS_DC) +{ + *(EG(argument_stack)->top++) = ptr; +} + +static inline void *zend_vm_stack_pop(TSRMLS_D) +{ + void *el = *(--EG(argument_stack)->top); + + if (UNEXPECTED(EG(argument_stack)->top == EG(argument_stack)->elements)) { + zend_vm_stack p = EG(argument_stack); + EG(argument_stack) = p->prev; + efree(p); + } + return el; +} + +static inline void *zend_vm_stack_alloc(size_t size TSRMLS_DC) +{ + void *ret; + + size = (size + (sizeof(void*) - 1)) / sizeof(void*); + + ZEND_VM_STACK_GROW_IF_NEEDED((int)size); + ret = (void*)EG(argument_stack)->top; + EG(argument_stack)->top += size; + return ret; +} + +static inline void zend_vm_stack_free(void *ptr TSRMLS_DC) +{ + if (UNEXPECTED(EG(argument_stack)->elements == (void**)ptr)) { + zend_vm_stack p = EG(argument_stack); + + EG(argument_stack) = p->prev; + efree(p); + } else { + EG(argument_stack)->top = (void**)ptr; + } +} + +static inline void** zend_vm_stack_push_args(int count TSRMLS_DC) +{ + + if (UNEXPECTED(EG(argument_stack)->top - EG(argument_stack)->elements < count) || + UNEXPECTED(EG(argument_stack)->top == EG(argument_stack)->end)) { + zend_vm_stack p = EG(argument_stack); + + zend_vm_stack_extend(count + 1 TSRMLS_CC); + + EG(argument_stack)->top += count; + *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count; + while (count-- > 0) { + void *data = *(--p->top); + + if (UNEXPECTED(p->top == p->elements)) { + zend_vm_stack r = p; + + EG(argument_stack)->prev = p->prev; + p = p->prev; + efree(r); + } + *(EG(argument_stack)->elements + count) = data; + } + return EG(argument_stack)->top++; + } + *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count; + return EG(argument_stack)->top++; +} + +static inline void zend_vm_stack_clear_multiple(TSRMLS_D) { - void **p = EG(argument_stack).top_element-2; + void **p = EG(argument_stack)->top - 1; int delete_count = (int)(zend_uintptr_t) *p; - EG(argument_stack).top -= (delete_count+2); while (--delete_count>=0) { zval *q = *(zval **)(--p); *p = NULL; zval_ptr_dtor(&q); } - EG(argument_stack).top_element = p; + zend_vm_stack_free(p TSRMLS_CC); } -static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC) +static inline zval** zend_vm_stack_get_arg(int requested_arg TSRMLS_DC) { - void **p = EG(argument_stack).top_element-2; + void **p = EG(current_execute_data)->prev_execute_data->function_state.arguments; int arg_count = (int)(zend_uintptr_t) *p; - if (requested_arg>arg_count) { - return FAILURE; + if (UNEXPECTED(requested_arg > arg_count)) { + return NULL; } - *data = (p-arg_count+requested_arg-1); - return SUCCESS; + return (zval**)p - arg_count + requested_arg - 1; } void execute_new_code(TSRMLS_D); @@ -179,10 +300,10 @@ ZEND_API char *zend_get_executed_filename(TSRMLS_D); ZEND_API uint zend_get_executed_lineno(TSRMLS_D); ZEND_API zend_bool zend_is_executing(TSRMLS_D); -ZEND_API void zend_set_timeout(long seconds); +ZEND_API void zend_set_timeout(long seconds, int reset_signals); ZEND_API void zend_unset_timeout(TSRMLS_D); ZEND_API void zend_timeout(int dummy); -ZEND_API zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC); +ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC); void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC); #ifdef ZEND_WIN32 @@ -202,7 +323,7 @@ void zend_shutdown_timeout_thread(void); */ #define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : "") -ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var); +ZEND_API zval** zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, zend_uint var); #define ZEND_USER_OPCODE_CONTINUE 0 /* execute next opcode */ #define ZEND_USER_OPCODE_RETURN 1 /* exit from executor (return from function) */ @@ -210,8 +331,8 @@ ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data #define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */ -ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, opcode_handler_t handler); -ZEND_API opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode); +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 struct _zend_free_op { @@ -219,8 +340,8 @@ typedef struct _zend_free_op { /* int is_var; */ } zend_free_op; -ZEND_API zval *zend_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC); -ZEND_API zval **zend_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC); +ZEND_API zval *zend_get_zval_ptr(znode *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC); +ZEND_API zval **zend_get_zval_ptr_ptr(const znode *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC); ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 1e3d1e08d..b0e7a9e92 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.30 2009/01/15 14:23:42 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.75 2009/03/19 18:34:16 mattwil Exp $ */ #include #include @@ -30,7 +30,9 @@ #include "zend_constants.h" #include "zend_extensions.h" #include "zend_exceptions.h" +#include "zend_closures.h" #include "zend_vm.h" +#include "zend_float.h" #ifdef HAVE_SYS_TIME_H #include #endif @@ -39,7 +41,8 @@ ZEND_API void (*zend_execute)(zend_op_array *op_array TSRMLS_DC); ZEND_API void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC); /* true globals */ -ZEND_API zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL }; +ZEND_API const zend_fcall_info empty_fcall_info = { 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0 }; +ZEND_API const zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL, NULL }; #ifdef ZEND_WIN32 #include @@ -53,11 +56,11 @@ static int timeout_thread_initialized=0; #if 0&&ZEND_DEBUG static void (*original_sigsegv_handler)(int); -static void zend_handle_sigsegv(int dummy) +static void zend_handle_sigsegv(int dummy) /* {{{ */ { fflush(stdout); fflush(stderr); - if (original_sigsegv_handler==zend_handle_sigsegv) { + if (original_sigsegv_handler == zend_handle_sigsegv) { signal(SIGSEGV, original_sigsegv_handler); } else { signal(SIGSEGV, SIG_DFL); @@ -76,54 +79,56 @@ static void zend_handle_sigsegv(int dummy) original_sigsegv_handler(dummy); } } +/* }}} */ #endif - -static void zend_extension_activator(zend_extension *extension TSRMLS_DC) +static void zend_extension_activator(zend_extension *extension TSRMLS_DC) /* {{{ */ { if (extension->activate) { extension->activate(); } } +/* }}} */ - -static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC) +static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC) /* {{{ */ { if (extension->deactivate) { extension->deactivate(); } } +/* }}} */ - -static int clean_non_persistent_function(zend_function *function TSRMLS_DC) +static int clean_non_persistent_function(zend_function *function TSRMLS_DC) /* {{{ */ { return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE; } +/* }}} */ - -static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) +static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */ { return (function->type != ZEND_INTERNAL_FUNCTION); } +/* }}} */ - -static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) +static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) /* {{{ */ { return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE; } +/* }}} */ - -static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) +static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */ { return ((*ce)->type != ZEND_INTERNAL_CLASS); } +/* }}} */ - -void init_executor(TSRMLS_D) +void init_executor(TSRMLS_D) /* {{{ */ { + zend_init_fpu(TSRMLS_C); + INIT_ZVAL(EG(uninitialized_zval)); - /* trick to make uninitialized_zval never be modified, passed by ref, etc. */ - EG(uninitialized_zval).refcount++; + /* trick to make uninitialized_zval never be modified, passed by ref, etc. */ + Z_ADDREF(EG(uninitialized_zval)); INIT_ZVAL(EG(error_zval)); EG(uninitialized_zval_ptr)=&EG(uninitialized_zval); EG(error_zval_ptr)=&EG(error_zval); @@ -134,9 +139,9 @@ void init_executor(TSRMLS_D) #endif EG(return_value_ptr_ptr) = NULL; - EG(symtable_cache_ptr) = EG(symtable_cache)-1; - EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1; - EG(no_extensions)=0; + EG(symtable_cache_ptr) = EG(symtable_cache) - 1; + EG(symtable_cache_limit) = EG(symtable_cache) + SYMTABLE_CACHE_SIZE - 1; + EG(no_extensions) = 0; EG(function_table) = CG(function_table); EG(class_table) = CG(class_table); @@ -144,17 +149,18 @@ void init_executor(TSRMLS_D) EG(in_execution) = 0; EG(in_autoload) = NULL; EG(autoload_func) = NULL; + EG(error_handling) = EH_NORMAL; - zend_ptr_stack_init(&EG(argument_stack)); - zend_ptr_stack_push(&EG(argument_stack), (void *) NULL); + zend_vm_stack_init(TSRMLS_C); + zend_vm_stack_push((void *) NULL TSRMLS_CC); zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0); { zval *globals; ALLOC_ZVAL(globals); - globals->refcount=1; - globals->is_ref=1; + Z_SET_REFCOUNT_P(globals, 1); + Z_SET_ISREF_P(globals); Z_TYPE_P(globals) = IS_ARRAY; Z_ARRVAL_P(globals) = &EG(symbol_table); zend_hash_update(&EG(symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL); @@ -184,26 +190,31 @@ void init_executor(TSRMLS_D) #endif EG(exception) = NULL; + EG(prev_exception) = NULL; EG(scope) = NULL; + EG(called_scope) = NULL; EG(This) = NULL; - + EG(active_op_array) = NULL; EG(active) = 1; } +/* }}} */ -static int zval_call_destructor(zval **zv TSRMLS_DC) +static int zval_call_destructor(zval **zv TSRMLS_DC) /* {{{ */ { - if (Z_TYPE_PP(zv) == IS_OBJECT && (*zv)->refcount == 1) { + if (Z_TYPE_PP(zv) == IS_OBJECT && Z_REFCOUNT_PP(zv) == 1) { return ZEND_HASH_APPLY_REMOVE; } else { return ZEND_HASH_APPLY_KEEP; } } +/* }}} */ -void shutdown_destructors(TSRMLS_D) { +void shutdown_destructors(TSRMLS_D) /* {{{ */ +{ zend_try { int symbols; do { @@ -216,10 +227,12 @@ void shutdown_destructors(TSRMLS_D) { zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC); } zend_end_try(); } +/* }}} */ -void shutdown_executor(TSRMLS_D) +void shutdown_executor(TSRMLS_D) /* {{{ */ { zend_try { + /* Removed because this can not be safely done, e.g. in this situation: Object 1 creates object 2 Object 3 holds reference to object 2. @@ -242,7 +255,7 @@ void shutdown_executor(TSRMLS_D) zend_try { zval *zeh; /* remove error handlers before destroying classes and functions, - so that if handler used some class, crash would not happen */ + * so that if handler used some class, crash would not happen */ if (EG(user_error_handler)) { zeh = EG(user_error_handler); EG(user_error_handler) = NULL; @@ -265,14 +278,14 @@ void shutdown_executor(TSRMLS_D) zend_try { /* Cleanup static data for functions and arrays. - We need a separate cleanup stage because of the following problem: - Suppose we destroy class X, which destroys the class's function table, - and in the function table we have function foo() that has static $bar. - Now if an object of class X is assigned to $bar, its destructor will be - called and will fail since X's function table is in mid-destruction. - So we want first of all to clean up all data and then move to tables destruction. - Note that only run-time accessed data need to be cleaned up, pre-defined data can - not contain objects and thus are not probelmatic */ + * We need a separate cleanup stage because of the following problem: + * Suppose we destroy class X, which destroys the class's function table, + * and in the function table we have function foo() that has static $bar. + * Now if an object of class X is assigned to $bar, its destructor will be + * called and will fail since X's function table is in mid-destruction. + * So we want first of all to clean up all data and then move to tables destruction. + * Note that only run-time accessed data need to be cleaned up, pre-defined data can + * not contain objects and thus are not probelmatic */ if (EG(full_tables_cleanup)) { zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC); } else { @@ -280,7 +293,9 @@ void shutdown_executor(TSRMLS_D) } zend_hash_apply(EG(class_table), (apply_func_t) zend_cleanup_class_data TSRMLS_CC); - zend_ptr_stack_destroy(&EG(argument_stack)); + zend_vm_stack_destroy(TSRMLS_C); + + zend_objects_store_free_object_storage(&EG(objects_store) TSRMLS_CC); /* Destroy all op arrays */ if (EG(full_tables_cleanup)) { @@ -296,7 +311,6 @@ void shutdown_executor(TSRMLS_D) FREE_HASHTABLE(*EG(symtable_cache_ptr)); EG(symtable_cache_ptr)--; } - zend_objects_store_free_object_storage(&EG(objects_store) TSRMLS_CC); } zend_end_try(); zend_try { @@ -320,12 +334,15 @@ void shutdown_executor(TSRMLS_D) FREE_HASHTABLE(EG(in_autoload)); } } zend_end_try(); + + zend_shutdown_fpu(TSRMLS_C); + EG(active) = 0; } - +/* }}} */ /* return class name and "::" or "". */ -ZEND_API char *get_active_class_name(char **space TSRMLS_DC) +ZEND_API char *get_active_class_name(char **space TSRMLS_DC) /* {{{ */ { if (!zend_is_executing(TSRMLS_C)) { if (space) { @@ -333,11 +350,11 @@ ZEND_API char *get_active_class_name(char **space TSRMLS_DC) } return ""; } - switch (EG(function_state_ptr)->function->type) { + switch (EG(current_execute_data)->function_state.function->type) { case ZEND_USER_FUNCTION: case ZEND_INTERNAL_FUNCTION: { - zend_class_entry *ce = EG(function_state_ptr)->function->common.scope; + zend_class_entry *ce = EG(current_execute_data)->function_state.function->common.scope; if (space) { *space = ce ? "::" : ""; @@ -351,16 +368,16 @@ ZEND_API char *get_active_class_name(char **space TSRMLS_DC) return ""; } } +/* }}} */ - -ZEND_API char *get_active_function_name(TSRMLS_D) +ZEND_API char *get_active_function_name(TSRMLS_D) /* {{{ */ { if (!zend_is_executing(TSRMLS_C)) { return NULL; } - switch (EG(function_state_ptr)->function->type) { + switch (EG(current_execute_data)->function_state.function->type) { case ZEND_USER_FUNCTION: { - char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name; + char *function_name = ((zend_op_array *) EG(current_execute_data)->function_state.function)->function_name; if (function_name) { return function_name; @@ -370,15 +387,15 @@ ZEND_API char *get_active_function_name(TSRMLS_D) } break; case ZEND_INTERNAL_FUNCTION: - return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name; + return ((zend_internal_function *) EG(current_execute_data)->function_state.function)->function_name; break; default: return NULL; } } +/* }}} */ - -ZEND_API char *zend_get_executed_filename(TSRMLS_D) +ZEND_API char *zend_get_executed_filename(TSRMLS_D) /* {{{ */ { if (EG(active_op_array)) { return EG(active_op_array)->filename; @@ -386,9 +403,9 @@ ZEND_API char *zend_get_executed_filename(TSRMLS_D) return "[no active file]"; } } +/* }}} */ - -ZEND_API uint zend_get_executed_lineno(TSRMLS_D) +ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */ { if (EG(opline_ptr)) { return active_opline->lineno; @@ -396,61 +413,67 @@ ZEND_API uint zend_get_executed_lineno(TSRMLS_D) return 0; } } +/* }}} */ - -ZEND_API zend_bool zend_is_executing(TSRMLS_D) +ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */ { return EG(in_execution); } +/* }}} */ - -ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) +ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) /* {{{ */ { #if DEBUG_ZEND>=2 - printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1); + printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, Z_REFCOUNT_PP(zval_ptr), Z_REFCOUNT_PP(zval_ptr) - 1); #endif - (*zval_ptr)->refcount--; - if ((*zval_ptr)->refcount==0) { - zval_dtor(*zval_ptr); - safe_free_zval_ptr_rel(*zval_ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC); - } else if ((*zval_ptr)->refcount == 1) { - if ((*zval_ptr)->type == IS_OBJECT) { - TSRMLS_FETCH(); - - if (EG(ze1_compatibility_mode)) { - return; - } + Z_DELREF_PP(zval_ptr); + if (Z_REFCOUNT_PP(zval_ptr) == 0) { + TSRMLS_FETCH(); + + if (*zval_ptr != &EG(uninitialized_zval)) { + GC_REMOVE_ZVAL_FROM_BUFFER(*zval_ptr); + zval_dtor(*zval_ptr); + efree_rel(*zval_ptr); + } + } else { + TSRMLS_FETCH(); + + if (Z_REFCOUNT_PP(zval_ptr) == 1) { + Z_UNSET_ISREF_PP(zval_ptr); } - (*zval_ptr)->is_ref = 0; + + GC_ZVAL_CHECK_POSSIBLE_ROOT(*zval_ptr); } } +/* }}} */ - -ZEND_API void _zval_internal_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) +ZEND_API void _zval_internal_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) /* {{{ */ { #if DEBUG_ZEND>=2 - printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1); + printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, Z_REFCOUNT_PP(zval_ptr), Z_REFCOUNT_PP(zval_ptr) - 1); #endif - (*zval_ptr)->refcount--; - if ((*zval_ptr)->refcount==0) { + Z_DELREF_PP(zval_ptr); + if (Z_REFCOUNT_PP(zval_ptr) == 0) { zval_internal_dtor(*zval_ptr); free(*zval_ptr); - } else if ((*zval_ptr)->refcount == 1) { - (*zval_ptr)->is_ref = 0; + } else if (Z_REFCOUNT_PP(zval_ptr) == 1) { + Z_UNSET_ISREF_PP(zval_ptr); } } +/* }}} */ - -ZEND_API int zend_is_true(zval *op) +ZEND_API int zend_is_true(zval *op) /* {{{ */ { return i_zend_is_true(op); } +/* }}} */ #include "../TSRM/tsrm_strtok_r.h" -#define IS_VISITED_CONSTANT IS_CONSTANT_INDEX -#define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT) -#define MARK_CONSTANT_VISITED(p) Z_TYPE_P(p) |= IS_VISITED_CONSTANT +#define IS_VISITED_CONSTANT IS_CONSTANT_INDEX +#define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT) +#define Z_REAL_TYPE_P(p) (Z_TYPE_P(p) & ~IS_VISITED_CONSTANT) +#define MARK_CONSTANT_VISITED(p) Z_TYPE_P(p) |= IS_VISITED_CONSTANT static void zval_deep_copy(zval **p) { @@ -465,7 +488,7 @@ static void zval_deep_copy(zval **p) *p = value; } -ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) +ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */ { zval *p = *pp; zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg; @@ -474,7 +497,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco if (IS_CONSTANT_VISITED(p)) { zend_error(E_ERROR, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p)); - } else if (Z_TYPE_P(p) == IS_CONSTANT) { + } else if ((Z_TYPE_P(p) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { int refcount; zend_uchar is_ref; @@ -483,34 +506,84 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco MARK_CONSTANT_VISITED(p); - refcount = p->refcount; - is_ref = p->is_ref; + refcount = Z_REFCOUNT_P(p); + is_ref = Z_ISREF_P(p); + + if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) { + char *actual = Z_STRVAL_P(p); - if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope TSRMLS_CC)) { - if ((colon = memchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p))) && colon[1] == ':') { + if ((colon = zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) { zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p)); - } - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - p->value.str.val, - p->value.str.val); - p->type = IS_STRING; - if (!inline_change) { - zval_copy_ctor(p); + Z_STRLEN_P(p) -= ((colon - Z_STRVAL_P(p)) + 1); + if (inline_change) { + colon = estrndup(colon, Z_STRLEN_P(p)); + efree(Z_STRVAL_P(p)); + Z_STRVAL_P(p) = colon; + } else { + Z_STRVAL_P(p) = colon + 1; + } + } else { + char *save = actual, *slash; + int actual_len = Z_STRLEN_P(p); + if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) { + actual = slash + 1; + actual_len -= (actual - Z_STRVAL_P(p)); + if (inline_change) { + actual = estrndup(actual, actual_len); + Z_STRVAL_P(p) = actual; + Z_STRLEN_P(p) = actual_len; + } + } + if (actual[0] == '\\') { + if (inline_change) { + memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRLEN_P(p)); + --Z_STRLEN_P(p); + } else { + ++actual; + } + --actual_len; + } + if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) == 0) { + int fix_save = 0; + if (save[0] == '\\') { + save++; + fix_save = 1; + } + zend_error(E_ERROR, "Undefined constant '%s'", save); + if (fix_save) { + save--; + } + if (inline_change) { + efree(save); + } + save = NULL; + } + if (inline_change && save && save != actual) { + efree(save); + } + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); + p->type = IS_STRING; + if (!inline_change) { + Z_STRVAL_P(p) = actual; + Z_STRLEN_P(p) = actual_len; + zval_copy_ctor(p); + } } } else { if (inline_change) { - STR_FREE(p->value.str.val); + STR_FREE(Z_STRVAL_P(p)); } *p = const_value; } - p->refcount = refcount; - p->is_ref = is_ref; + Z_SET_REFCOUNT_P(p, refcount); + Z_SET_ISREF_TO_P(p, is_ref); } else if (Z_TYPE_P(p) == IS_CONSTANT_ARRAY) { zval **element, *new_val; char *str_index; uint str_index_len; ulong num_index; + int ret; SEPARATE_ZVAL_IF_NOT_REF(pp); p = *pp; @@ -528,60 +601,79 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco /* First go over the array and see if there are any constant indices */ zend_hash_internal_pointer_reset(Z_ARRVAL_P(p)); - while (zend_hash_get_current_data(Z_ARRVAL_P(p), (void **) &element)==SUCCESS) { + while (zend_hash_get_current_data(Z_ARRVAL_P(p), (void **) &element) == SUCCESS) { if (!(Z_TYPE_PP(element) & IS_CONSTANT_INDEX)) { zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX; - if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &str_index_len, &num_index, 0, NULL)!=HASH_KEY_IS_STRING) { + if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &str_index_len, &num_index, 0, NULL) != HASH_KEY_IS_STRING) { zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } - if (!zend_get_constant_ex(str_index, str_index_len-1, &const_value, scope TSRMLS_CC)) { - if ((colon = memchr(str_index, ':', str_index_len-1)) && colon[1] == ':') { + if (!zend_get_constant_ex(str_index, str_index_len - 3, &const_value, scope, str_index[str_index_len - 2] TSRMLS_CC)) { + char *actual, *save = str_index; + if ((colon = zend_memrchr(str_index, ':', str_index_len - 3))) { zend_error(E_ERROR, "Undefined class constant '%s'", str_index); + str_index_len -= ((colon - str_index) + 1); + str_index = colon; + } else { + if (str_index[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) { + if ((actual = (char *)zend_memrchr(str_index, '\\', str_index_len - 3))) { + actual++; + str_index_len -= (actual - str_index); + str_index = actual; + } + } + if (str_index[0] == '\\') { + ++str_index; + --str_index_len; + } + if (save[0] == '\\') { + ++save; + } + if ((str_index[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) == 0) { + zend_error(E_ERROR, "Undefined constant '%s'", save); + } + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index); } - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index); - zend_hash_move_forward(Z_ARRVAL_P(p)); - continue; + ZVAL_STRINGL(&const_value, str_index, str_index_len-3, 1); } - if (const_value.type == IS_STRING && const_value.value.str.len == (int)str_index_len-1 && - !strncmp(const_value.value.str.val, str_index, str_index_len)) { - /* constant value is the same as its name */ - zval_dtor(&const_value); - zend_hash_move_forward(p->value.ht); - continue; + if (Z_REFCOUNT_PP(element) > 1) { + ALLOC_ZVAL(new_val); + *new_val = **element; + zval_copy_ctor(new_val); + Z_SET_REFCOUNT_P(new_val, 1); + Z_UNSET_ISREF_P(new_val); + + /* preserve this bit for inheritance */ + Z_TYPE_PP(element) |= IS_CONSTANT_INDEX; + zval_ptr_dtor(element); + *element = new_val; } - ALLOC_ZVAL(new_val); - *new_val = **element; - zval_copy_ctor(new_val); - new_val->refcount = 1; - new_val->is_ref = 0; - - /* preserve this bit for inheritance */ - Z_TYPE_PP(element) |= IS_CONSTANT_INDEX; - zval_ptr_dtor(element); - *element = new_val; - switch (Z_TYPE(const_value)) { case IS_STRING: - zend_symtable_update_current_key(Z_ARRVAL_P(p), const_value.value.str.val, const_value.value.str.len+1); + ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STRVAL(const_value), Z_STRLEN(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE); break; case IS_BOOL: case IS_LONG: - zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, Z_LVAL(const_value)); + ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL); break; case IS_DOUBLE: - zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, (long)Z_DVAL(const_value)); + ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, (long)Z_DVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL); break; case IS_NULL: - zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, "", 1, 0); + ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, "", 1, 0, HASH_UPDATE_KEY_IF_BEFORE, NULL); + break; + default: + ret = SUCCESS; break; } - zend_hash_move_forward(Z_ARRVAL_P(p)); + if (ret == SUCCESS) { + zend_hash_move_forward(Z_ARRVAL_P(p)); + } zval_dtor(&const_value); } zend_hash_apply_with_argument(Z_ARRVAL_P(p), (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); @@ -589,13 +681,15 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco } return 0; } +/* }}} */ -ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) +ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) /* {{{ */ { return zval_update_constant_ex(pp, arg, NULL TSRMLS_CC); } +/* }}} */ -int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC) +int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC) /* {{{ */ { zval ***params_array; zend_uint i; @@ -621,15 +715,15 @@ int call_user_function(HashTable *function_table, zval **object_pp, zval *functi } return ex_retval; } +/* }}} */ - -int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC) +int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC) /* {{{ */ { zend_fcall_info fci; fci.size = sizeof(fci); fci.function_table = function_table; - fci.object_pp = object_pp; + fci.object_ptr = object_pp ? *object_pp : NULL; fci.function_name = function_name; fci.retval_ptr_ptr = retval_ptr_ptr; fci.param_count = param_count; @@ -639,26 +733,21 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun return zend_call_function(&fci, NULL TSRMLS_CC); } +/* }}} */ - -int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC) +int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC) /* {{{ */ { zend_uint i; zval **original_return_value; HashTable *calling_symbol_table; - zend_function_state *original_function_state_ptr; zend_op_array *original_op_array; zend_op **original_opline_ptr; zend_class_entry *current_scope; + zend_class_entry *current_called_scope; zend_class_entry *calling_scope = NULL; - zend_class_entry *check_scope_or_static = NULL; + zend_class_entry *called_scope = NULL; zval *current_this; zend_execute_data execute_data; - zval *method_name; - zval *params_array; - int call_via_handler = 0; - char *fname, *colon; - int fname_len; *fci->retval_ptr_ptr = NULL; @@ -683,7 +772,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS execute_data = *EG(current_execute_data); EX(op_array) = NULL; EX(opline) = NULL; - EX(object) = NULL; + EX(object) = NULL; } else { /* This only happens when we're called outside any execute()'s * It shouldn't be strictly necessary to NULL execute_data out, @@ -693,200 +782,42 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS } if (!fci_cache || !fci_cache->initialized) { - if (Z_TYPE_P(fci->function_name)==IS_ARRAY) { /* assume array($obj, $name) couple */ - zval **tmp_object_ptr, **tmp_real_function_name; + zend_fcall_info_cache fci_cache_local; + char *callable_name; + char *error = NULL; - if (zend_hash_index_find(Z_ARRVAL_P(fci->function_name), 0, (void **) &tmp_object_ptr)==FAILURE) { - return FAILURE; - } - if (zend_hash_index_find(Z_ARRVAL_P(fci->function_name), 1, (void **) &tmp_real_function_name)==FAILURE) { - return FAILURE; - } - fci->function_name = *tmp_real_function_name; - SEPARATE_ZVAL_IF_NOT_REF(tmp_object_ptr); - fci->object_pp = tmp_object_ptr; - (*fci->object_pp)->is_ref = 1; + if (!fci_cache) { + fci_cache = &fci_cache_local; } - if (fci->object_pp && !*fci->object_pp) { - fci->object_pp = NULL; - } - - if (fci->object_pp) { - if (Z_TYPE_PP(fci->object_pp) == IS_OBJECT - && (!EG(objects_store).object_buckets || !EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(fci->object_pp)].valid)) { - return FAILURE; - } - /* TBI!! new object handlers */ - if (Z_TYPE_PP(fci->object_pp) == IS_OBJECT) { - if (!IS_ZEND_STD_OBJECT(**fci->object_pp)) { - zend_error(E_WARNING, "Cannot use call_user_function on objects without a class entry"); - return FAILURE; - } - - calling_scope = Z_OBJCE_PP(fci->object_pp); - fci->function_table = &calling_scope->function_table; - EX(object) = *fci->object_pp; - } else if (Z_TYPE_PP(fci->object_pp) == IS_STRING) { - zend_class_entry **ce; - int found = FAILURE; - - if (EG(active_op_array) && strcmp(Z_STRVAL_PP(fci->object_pp), "self") == 0) { - if (!EG(active_op_array)->scope) { - zend_error(E_ERROR, "Cannot access self:: when no class scope is active"); - } - ce = &(EG(active_op_array)->scope); - found = (*ce != NULL?SUCCESS:FAILURE); - fci->object_pp = EG(This)?&EG(This):NULL; - EX(object) = EG(This); - } else if (strcmp(Z_STRVAL_PP(fci->object_pp), "parent") == 0 && EG(active_op_array)) { - - if (!EG(active_op_array)->scope) { - zend_error(E_ERROR, "Cannot access parent:: when no class scope is active"); - } - if (!EG(active_op_array)->scope->parent) { - zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent"); - } - ce = &(EG(active_op_array)->scope->parent); - found = (*ce != NULL?SUCCESS:FAILURE); - fci->object_pp = EG(This)?&EG(This):NULL; - EX(object) = EG(This); - } else { - zend_class_entry *scope; - scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL; - - found = zend_lookup_class(Z_STRVAL_PP(fci->object_pp), Z_STRLEN_PP(fci->object_pp), &ce TSRMLS_CC); - if (found == FAILURE) { - zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL_PP(fci->object_pp)); - } - if (scope && EG(This) && - instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) && - instanceof_function(scope, *ce TSRMLS_CC)) { - fci->object_pp = &EG(This); - EX(object) = EG(This); - } else { - fci->object_pp = NULL; - } - } - if (found == FAILURE) - return FAILURE; - - fci->function_table = &(*ce)->function_table; - calling_scope = *ce; - } else { - zend_error(E_NOTICE, "Non-callable array passed to zend_call_function()"); - return FAILURE; + if (!zend_is_callable_ex(fci->function_name, fci->object_ptr, IS_CALLABLE_CHECK_SILENT, &callable_name, NULL, fci_cache, &error TSRMLS_CC)) { + if (error) { + zend_error(E_WARNING, "Invalid callback %s, %s", callable_name, error); + efree(error); } - - if (fci->function_table == NULL) { - return FAILURE; + if (callable_name) { + efree(callable_name); } - } - - if (fci->function_name->type!=IS_STRING) { return FAILURE; - } - - fname = Z_STRVAL_P(fci->function_name); - fname_len = Z_STRLEN_P(fci->function_name); - if ((colon = strstr(fname, "::")) != NULL) { - int clen = colon - fname; - int mlen = fname_len - clen - 2; - zend_class_entry **pce, *ce_child = NULL; - if (zend_lookup_class(fname, clen, &pce TSRMLS_CC) == SUCCESS) { - ce_child = *pce; - } else { - char *lcname = zend_str_tolower_dup(fname, clen); - /* caution: lcname is not '\0' terminated */ - if (calling_scope) { - if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) { - ce_child = EG(active_op_array) ? EG(active_op_array)->scope : NULL; - } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) { - ce_child = EG(active_op_array) && EG(active_op_array)->scope ? EG(scope)->parent : NULL; - } - } - efree(lcname); - } - if (!ce_child) { - zend_error(E_ERROR, "Cannot call method %s() or method does not exist", fname); - return FAILURE; - } - check_scope_or_static = calling_scope; - fci->function_table = &ce_child->function_table; - calling_scope = ce_child; - fname = fname + clen + 2; - fname_len = mlen; - } - - if (fci->object_pp) { - if (Z_OBJ_HT_PP(fci->object_pp)->get_method == NULL) { - zend_error(E_ERROR, "Object does not support method calls"); - } - EX(function_state).function = - Z_OBJ_HT_PP(fci->object_pp)->get_method(fci->object_pp, fname, fname_len TSRMLS_CC); - if (EX(function_state).function && - (EX(function_state).function->common.fn_flags & ZEND_ACC_PRIVATE) == 0 && - calling_scope != EX(function_state).function->common.scope) { - char *function_name_lc = zend_str_tolower_dup(fname, fname_len); - if (zend_hash_find(&calling_scope->function_table, function_name_lc, fname_len+1, (void **) &EX(function_state).function)==FAILURE) { - efree(function_name_lc); - zend_error(E_ERROR, "Cannot call method %s::%s() or method does not exist", calling_scope->name, fname); - } - efree(function_name_lc); - } - } else if (calling_scope) { - char *function_name_lc = zend_str_tolower_dup(fname, fname_len); - - EX(function_state).function = - zend_std_get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC); - efree(function_name_lc); - if (check_scope_or_static && EX(function_state).function - && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC) - && !instanceof_function(check_scope_or_static, calling_scope TSRMLS_CC)) { - zend_error(E_ERROR, "Cannot call method %s() of class %s which is not a derived from %s", fname, calling_scope->name, check_scope_or_static->name); - return FAILURE; + } else if (error) { + /* Capitalize the first latter of the error message */ + if (error[0] >= 'a' && error[0] <= 'z') { + error[0] += ('A' - 'a'); } - } else { - char *function_name_lc = zend_str_tolower_dup(fname, fname_len); - - if (zend_hash_find(fci->function_table, function_name_lc, fname_len+1, (void **) &EX(function_state).function)==FAILURE) { - EX(function_state).function = NULL; - } - efree(function_name_lc); + zend_error(E_STRICT, "%s", error); + efree(error); } + efree(callable_name); + } - if (EX(function_state).function == NULL) { - /* try calling __call */ - if (calling_scope && calling_scope->__call) { - EX(function_state).function = calling_scope->__call; - /* prepare params */ - ALLOC_INIT_ZVAL(method_name); - ZVAL_STRINGL(method_name, Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name), 0); - - ALLOC_INIT_ZVAL(params_array); - array_init(params_array); - call_via_handler = 1; - } else { - return FAILURE; - } - } - if (fci_cache && - (EX(function_state).function->type != ZEND_INTERNAL_FUNCTION || - ((zend_internal_function*)EX(function_state).function)->handler != zend_std_call_user_call)) { - fci_cache->function_handler = EX(function_state).function; - fci_cache->object_pp = fci->object_pp; - fci_cache->calling_scope = calling_scope; - fci_cache->initialized = 1; - } - } else { - EX(function_state).function = fci_cache->function_handler; - calling_scope = fci_cache->calling_scope; - fci->object_pp = fci_cache->object_pp; - EX(object) = fci->object_pp ? *fci->object_pp : NULL; - if (fci->object_pp && *fci->object_pp && Z_TYPE_PP(fci->object_pp) == IS_OBJECT - && (!EG(objects_store).object_buckets || !EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(fci->object_pp)].valid)) { - return FAILURE; - } + EX(function_state).function = fci_cache->function_handler; + calling_scope = fci_cache->calling_scope; + called_scope = fci_cache->called_scope; + fci->object_ptr = fci_cache->object_ptr; + EX(object) = fci->object_ptr; + if (fci->object_ptr && Z_TYPE_P(fci->object_ptr) == IS_OBJECT && + (!EG(objects_store).object_buckets || !EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(fci->object_ptr)].valid)) { + return FAILURE; } if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) { @@ -894,103 +825,83 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); } if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { - zend_error(E_STRICT, "Function %s%s%s() is deprecated", + zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.function_name); } } - /* Prevent crash because of stack reallocation */ - if (!call_via_handler && - fci->param_count && - EG(argument_stack).top + fci->param_count > EG(argument_stack).max && - *(void***)fci->params >= EG(argument_stack).elements && - *(void***)fci->params < EG(argument_stack).top_element) { - - /* Manual stack reallocation */ - void **prev_elements = EG(argument_stack).elements; - void **prev_top_element = EG(argument_stack).top_element; - - ZEND_PTR_STACK_RESIZE_IF_NEEDED((&EG(argument_stack)), fci->param_count); - for (i=0; iparam_count; i++) { - if ((void**)fci->params[i] >= prev_elements && - (void**)fci->params[i] < prev_top_element) { - fci->params[i] = (zval**)((void**)fci->params[i] - prev_elements + EG(argument_stack).elements); - } - } - } + ZEND_VM_STACK_GROW_IF_NEEDED(fci->param_count + 1); for (i=0; iparam_count; i++) { zval *param; - if (ARG_SHOULD_BE_SENT_BY_REF(EX(function_state).function, i+1) + if (ARG_SHOULD_BE_SENT_BY_REF(EX(function_state).function, i + 1) && !PZVAL_IS_REF(*fci->params[i])) { - if ((*fci->params[i])->refcount>1) { + + if (Z_REFCOUNT_PP(fci->params[i]) > 1) { zval *new_zval; if (fci->no_separation) { if(i) { /* hack to clean up the stack */ - zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (zend_uintptr_t) i, NULL); - zend_ptr_stack_clear_multiple(TSRMLS_C); + zend_vm_stack_push_nocheck((void *) (zend_uintptr_t)i TSRMLS_CC); + zend_vm_stack_clear_multiple(TSRMLS_C); } - if (call_via_handler) { - zval_ptr_dtor(&method_name); - zval_ptr_dtor(¶ms_array); - } + zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given", + i+1, + EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", + EX(function_state).function->common.scope ? "::" : "", + EX(function_state).function->common.function_name); return FAILURE; } + ALLOC_ZVAL(new_zval); *new_zval = **fci->params[i]; zval_copy_ctor(new_zval); - new_zval->refcount = 1; - (*fci->params[i])->refcount--; + Z_SET_REFCOUNT_P(new_zval, 1); + Z_DELREF_PP(fci->params[i]); *fci->params[i] = new_zval; } - (*fci->params[i])->refcount++; - (*fci->params[i])->is_ref = 1; + Z_ADDREF_PP(fci->params[i]); + Z_SET_ISREF_PP(fci->params[i]); param = *fci->params[i]; } else if (*fci->params[i] != &EG(uninitialized_zval)) { - (*fci->params[i])->refcount++; + Z_ADDREF_PP(fci->params[i]); param = *fci->params[i]; } else { ALLOC_ZVAL(param); *param = **(fci->params[i]); INIT_PZVAL(param); } - if (call_via_handler) { - add_next_index_zval(params_array, param); - } else { - zend_ptr_stack_push(&EG(argument_stack), param); - } + zend_vm_stack_push_nocheck(param TSRMLS_CC); } - if (call_via_handler) { - zend_ptr_stack_push(&EG(argument_stack), method_name); - zend_ptr_stack_push(&EG(argument_stack), params_array); - fci->param_count = 2; - } - - zend_ptr_stack_2_push(&EG(argument_stack), (void *) (zend_uintptr_t) fci->param_count, NULL); - - original_function_state_ptr = EG(function_state_ptr); - EG(function_state_ptr) = &EX(function_state); + EX(function_state).arguments = zend_vm_stack_top(TSRMLS_C); + zend_vm_stack_push_nocheck((void*)(zend_uintptr_t)fci->param_count TSRMLS_CC); current_scope = EG(scope); EG(scope) = calling_scope; current_this = EG(This); - if (fci->object_pp) { + current_called_scope = EG(called_scope); + if (called_scope) { + EG(called_scope) = called_scope; + } else if (EX(function_state).function->type != ZEND_INTERNAL_FUNCTION) { + EG(called_scope) = NULL; + } + + if (fci->object_ptr) { if ((EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) { EG(This) = NULL; } else { - EG(This) = *fci->object_pp; + EG(This) = fci->object_ptr; if (!PZVAL_IS_REF(EG(This))) { - EG(This)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EG(This)); /* For $this pointer */ } else { zval *this_ptr; @@ -1003,15 +914,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS } } else { EG(This) = NULL; - if (calling_scope && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) { - int severity; - if (EX(function_state).function->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_STRICT; - } else { - severity = E_ERROR; - } - zend_error(severity, "Non-static method %s::%s() cannot be called statically", calling_scope->name, EX(function_state).function->common.function_name); - } } EX(prev_execute_data) = EG(current_execute_data); @@ -1023,8 +925,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS if (fci->symbol_table) { EG(active_symbol_table) = fci->symbol_table; } else { - ALLOC_HASHTABLE(EG(active_symbol_table)); - zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0); + EG(active_symbol_table) = NULL; } original_return_value = EG(return_value_ptr_ptr); @@ -1033,32 +934,69 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS EG(active_op_array) = (zend_op_array *) EX(function_state).function; original_opline_ptr = EG(opline_ptr); zend_execute(EG(active_op_array) TSRMLS_CC); - if (!fci->symbol_table) { - zend_hash_destroy(EG(active_symbol_table)); - FREE_HASHTABLE(EG(active_symbol_table)); + if (!fci->symbol_table && EG(active_symbol_table)) { + if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { + zend_hash_destroy(EG(active_symbol_table)); + FREE_HASHTABLE(EG(active_symbol_table)); + } else { + /* clean before putting into the cache, since clean + could call dtors, which could use cached hash */ + zend_hash_clean(EG(active_symbol_table)); + *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); + } } EG(active_symbol_table) = calling_symbol_table; EG(active_op_array) = original_op_array; EG(return_value_ptr_ptr)=original_return_value; EG(opline_ptr) = original_opline_ptr; - } else { + } else if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { + int call_via_handler = (EX(function_state).function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0; ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr); if (EX(function_state).function->common.scope) { EG(scope) = EX(function_state).function->common.scope; } - ((zend_internal_function *) EX(function_state).function)->handler(fci->param_count, *fci->retval_ptr_ptr, EX(function_state).function->common.return_reference?fci->retval_ptr_ptr:NULL, (fci->object_pp?*fci->object_pp:NULL), 1 TSRMLS_CC); - INIT_PZVAL(*fci->retval_ptr_ptr); - } - zend_ptr_stack_clear_multiple(TSRMLS_C); - if (call_via_handler) { - zval_ptr_dtor(&method_name); - zval_ptr_dtor(¶ms_array); + ((zend_internal_function *) EX(function_state).function)->handler(fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC); + /* We shouldn't fix bad extensions here, + because it can break proper ones (Bug #34045) + if (!EX(function_state).function->common.return_reference) + { + INIT_PZVAL(*fci->retval_ptr_ptr); + }*/ + if (EG(exception) && fci->retval_ptr_ptr) { + zval_ptr_dtor(fci->retval_ptr_ptr); + *fci->retval_ptr_ptr = NULL; + } + + if (call_via_handler) { + /* We must re-initialize function again */ + fci_cache->initialized = 0; + } + } else { /* ZEND_OVERLOADED_FUNCTION */ + ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr); + + /* Not sure what should be done here if it's a static method */ + if (fci->object_ptr) { + Z_OBJ_HT_P(fci->object_ptr)->call_method(EX(function_state).function->common.function_name, fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC); + } else { + zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object"); + } + + if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { + efree(EX(function_state).function->common.function_name); + } + efree(EX(function_state).function); + + if (EG(exception) && fci->retval_ptr_ptr) { + zval_ptr_dtor(fci->retval_ptr_ptr); + *fci->retval_ptr_ptr = NULL; + } } - EG(function_state_ptr) = original_function_state_ptr; + zend_vm_stack_clear_multiple(TSRMLS_C); if (EG(This)) { zval_ptr_dtor(&EG(This)); } + EG(called_scope) = current_called_scope; EG(scope) = current_scope; EG(This) = current_this; EG(current_execute_data) = EX(prev_execute_data); @@ -1068,17 +1006,17 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS } return SUCCESS; } +/* }}} */ - -ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC) +ZEND_API int zend_lookup_class_ex(const char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { zval **args[1]; zval autoload_function; zval *class_name_ptr; zval *retval_ptr = NULL; - int retval; + int retval, lc_length; char *lc_name; - zval *exception; + char *lc_free; zend_fcall_info fcall_info; zend_fcall_info_cache fcall_cache; char dummy = 1; @@ -1087,12 +1025,18 @@ ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, if (name == NULL || !name_length) { return FAILURE; } - - lc_name = do_alloca_with_limit(name_length + 1, use_heap); + + lc_free = lc_name = do_alloca(name_length + 1, use_heap); zend_str_tolower_copy(lc_name, name, name_length); + lc_length = name_length + 1; + + if (lc_name[0] == '\\') { + lc_name += 1; + lc_length -= 1; + } - if (zend_hash_find(EG(class_table), lc_name, name_length+1, (void **) ce) == SUCCESS) { - free_alloca_with_limit(lc_name, use_heap); + if (zend_hash_find(EG(class_table), lc_name, lc_length, (void **) ce) == SUCCESS) { + free_alloca(lc_free, use_heap); return SUCCESS; } @@ -1100,26 +1044,26 @@ ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, * (doesn't impact fuctionality of __autoload() */ if (!use_autoload || zend_is_compiling(TSRMLS_C)) { - free_alloca_with_limit(lc_name, use_heap); + free_alloca(lc_free, use_heap); return FAILURE; } if (EG(in_autoload) == NULL) { ALLOC_HASHTABLE(EG(in_autoload)); - zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0); + zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0); } - - if (zend_hash_add(EG(in_autoload), lc_name, name_length+1, (void**)&dummy, sizeof(char), NULL) == FAILURE) { - free_alloca_with_limit(lc_name, use_heap); + + if (zend_hash_add(EG(in_autoload), lc_name, lc_length, (void**)&dummy, sizeof(char), NULL) == FAILURE) { + free_alloca(lc_free, use_heap); return FAILURE; } - ZVAL_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 0); + ZVAL_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1, 0); ALLOC_ZVAL(class_name_ptr); INIT_PZVAL(class_name_ptr); ZVAL_STRINGL(class_name_ptr, name, name_length, 1); - + args[0] = &class_name_ptr; fcall_info.size = sizeof(fcall_info); @@ -1129,81 +1073,74 @@ ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, fcall_info.retval_ptr_ptr = &retval_ptr; fcall_info.param_count = 1; fcall_info.params = args; - fcall_info.object_pp = NULL; + fcall_info.object_ptr = NULL; fcall_info.no_separation = 1; fcall_cache.initialized = EG(autoload_func) ? 1 : 0; fcall_cache.function_handler = EG(autoload_func); fcall_cache.calling_scope = NULL; - fcall_cache.object_pp = NULL; + fcall_cache.called_scope = NULL; + fcall_cache.object_ptr = NULL; - exception = EG(exception); - EG(exception) = NULL; + zend_exception_save(TSRMLS_C); retval = zend_call_function(&fcall_info, &fcall_cache TSRMLS_CC); + zend_exception_restore(TSRMLS_C); + EG(autoload_func) = fcall_cache.function_handler; zval_ptr_dtor(&class_name_ptr); - zend_hash_del(EG(in_autoload), lc_name, name_length+1); + zend_hash_del(EG(in_autoload), lc_name, lc_length); - if (retval == FAILURE) { - EG(exception) = exception; - free_alloca_with_limit(lc_name, use_heap); - return FAILURE; + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); } - if (EG(exception) && exception) { - free_alloca_with_limit(lc_name, use_heap); - zend_error(E_ERROR, "Function %s(%s) threw an exception of type '%s'", ZEND_AUTOLOAD_FUNC_NAME, name, Z_OBJCE_P(EG(exception))->name); + if (retval == FAILURE) { + free_alloca(lc_free, use_heap); return FAILURE; } - if (!EG(exception)) { - EG(exception) = exception; - } - if (retval_ptr) { - zval_ptr_dtor(&retval_ptr); - } - retval = zend_hash_find(EG(class_table), lc_name, name_length + 1, (void **) ce); - free_alloca_with_limit(lc_name, use_heap); + retval = zend_hash_find(EG(class_table), lc_name, lc_length, (void **) ce); + free_alloca(lc_free, use_heap); return retval; } +/* }}} */ -ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) +ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { return zend_lookup_class_ex(name, name_length, 1, ce TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC) +ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */ { zval pv; zend_op_array *new_op_array; zend_op_array *original_active_op_array = EG(active_op_array); - zend_function_state *original_function_state_ptr = EG(function_state_ptr); - zend_uchar original_handle_op_arrays; + zend_uint original_compiler_options; int retval; if (retval_ptr) { int l = strlen(str); - Z_STRLEN(pv) = l+sizeof("return ;")-1; + Z_STRLEN(pv) = l + sizeof("return ;") - 1; Z_STRVAL(pv) = emalloc(Z_STRLEN(pv) + 1); - memcpy(Z_STRVAL(pv), "return ", sizeof("return ")-1); - memcpy(Z_STRVAL(pv) + sizeof("return ")-1, str, l); - Z_STRVAL(pv)[Z_STRLEN(pv)-2] = ' '; - Z_STRVAL(pv)[Z_STRLEN(pv)-1] = ';'; + memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1); + memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, l); + Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';'; Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0'; } else { - pv.value.str.len = strlen(str); - pv.value.str.val = estrndup(str, pv.value.str.len); + Z_STRLEN(pv) = strlen(str); + Z_STRVAL(pv) = str; } - pv.type = IS_STRING; + Z_TYPE(pv) = IS_STRING; /*printf("Evaluating '%s'\n", pv.value.str.val);*/ - original_handle_op_arrays = CG(handle_op_arrays); - CG(handle_op_arrays) = 0; + original_compiler_options = CG(compiler_options); + CG(compiler_options) = ZEND_COMPILE_DEFAULT_FOR_EVAL; new_op_array = zend_compile_string(&pv, string_name TSRMLS_CC); - CG(handle_op_arrays) = original_handle_op_arrays; + CG(compiler_options) = original_compiler_options; if (new_op_array) { zval *local_retval_ptr=NULL; @@ -1213,6 +1150,9 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR EG(return_value_ptr_ptr) = &local_retval_ptr; EG(active_op_array) = new_op_array; EG(no_extensions)=1; + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } zend_execute(new_op_array TSRMLS_CC); @@ -1231,7 +1171,6 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR EG(no_extensions)=0; EG(opline_ptr) = original_opline_ptr; EG(active_op_array) = original_active_op_array; - EG(function_state_ptr) = original_function_state_ptr; destroy_op_array(new_op_array TSRMLS_CC); efree(new_op_array); EG(return_value_ptr_ptr) = original_return_value_ptr_ptr; @@ -1239,29 +1178,30 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR } else { retval = FAILURE; } - zval_dtor(&pv); + if (retval_ptr) { + zval_dtor(&pv); + } return retval; } +/* }}} */ - -ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) +ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) /* {{{ */ { int result; result = zend_eval_string(str, retval_ptr, string_name TSRMLS_CC); if (handle_exceptions && EG(exception)) { - zend_exception_error(EG(exception) TSRMLS_CC); + zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); result = FAILURE; } return result; } +/* }}} */ - -void execute_new_code(TSRMLS_D) +void execute_new_code(TSRMLS_D) /* {{{ */ { zend_op *opline, *end; zend_op *ret_opline; - zval *local_retval=NULL; if (!(CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) || CG(active_op_array)->backpatch_count>0 @@ -1276,8 +1216,6 @@ void execute_new_code(TSRMLS_D) INIT_ZVAL(ret_opline->op1.u.constant); SET_UNUSED(ret_opline->op2); - zend_do_handle_exception(TSRMLS_C); - if (!CG(active_op_array)->start_op) { CG(active_op_array)->start_op = CG(active_op_array)->opcodes; } @@ -1286,15 +1224,20 @@ void execute_new_code(TSRMLS_D) end=CG(active_op_array)->opcodes+CG(active_op_array)->last; while (oplineop1.op_type==IS_CONST) { - opline->op1.u.constant.is_ref = 1; - opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */ + if (opline->op1.op_type == IS_CONST) { + Z_SET_ISREF(opline->op1.u.constant); + Z_SET_REFCOUNT(opline->op1.u.constant, 2); /* Make sure is_ref won't be reset */ } - if (opline->op2.op_type==IS_CONST) { - opline->op2.u.constant.is_ref = 1; - opline->op2.u.constant.refcount = 2; + if (opline->op2.op_type == IS_CONST) { + Z_SET_ISREF(opline->op2.u.constant); + Z_SET_REFCOUNT(opline->op2.u.constant, 2); } switch (opline->opcode) { + case ZEND_GOTO: + if (Z_TYPE(opline->op2.u.constant) != IS_LONG) { + zend_resolve_goto_label(CG(active_op_array), opline, 1 TSRMLS_CC); + } + /* break omitted intentionally */ case ZEND_JMP: opline->op1.u.jmp_addr = &CG(active_op_array)->opcodes[opline->op1.u.opline_num]; break; @@ -1302,30 +1245,30 @@ void execute_new_code(TSRMLS_D) case ZEND_JMPNZ: case ZEND_JMPZ_EX: case ZEND_JMPNZ_EX: + case ZEND_JMP_SET: opline->op2.u.jmp_addr = &CG(active_op_array)->opcodes[opline->op2.u.opline_num]; break; } ZEND_VM_SET_OPCODE_HANDLER(opline); opline++; } - - EG(return_value_ptr_ptr) = &local_retval; + + zend_release_labels(TSRMLS_C); + + EG(return_value_ptr_ptr) = NULL; EG(active_op_array) = CG(active_op_array); zend_execute(CG(active_op_array) TSRMLS_CC); - if (local_retval) { - zval_ptr_dtor(&local_retval); - } if (EG(exception)) { - zend_exception_error(EG(exception) TSRMLS_CC); + zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); } - CG(active_op_array)->last -= 2; /* get rid of that ZEND_RETURN and ZEND_HANDLE_EXCEPTION */ + CG(active_op_array)->last -= 1; /* get rid of that ZEND_RETURN */ CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last; } +/* }}} */ - -ZEND_API void zend_timeout(int dummy) +ZEND_API void zend_timeout(int dummy) /* {{{ */ { TSRMLS_FETCH(); @@ -1333,12 +1276,12 @@ ZEND_API void zend_timeout(int dummy) zend_on_timeout(EG(timeout_seconds) TSRMLS_CC); } - zend_error(E_ERROR, "Maximum execution time of %d second%s exceeded", - EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s"); + zend_error(E_ERROR, "Maximum execution time of %d second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s"); } +/* }}} */ #ifdef ZEND_WIN32 -static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) /* {{{ */ { switch (message) { case WM_DESTROY: @@ -1346,7 +1289,7 @@ static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wPa break; case WM_REGISTER_ZEND_TIMEOUT: /* wParam is the thread id pointer, lParam is the timeout amount in seconds */ - if (lParam==0) { + if (lParam == 0) { KillTimer(timeout_window, wParam); } else { #ifdef ZTS @@ -1386,10 +1329,9 @@ static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wPa } return 0; } +/* }}} */ - - -static unsigned __stdcall timeout_thread_proc(void *pArgs) +static unsigned __stdcall timeout_thread_proc(void *pArgs) /* {{{ */ { MSG message; @@ -1419,18 +1361,18 @@ static unsigned __stdcall timeout_thread_proc(void *pArgs) SetEvent(timeout_thread_handle); return 0; } +/* }}} */ - -void zend_init_timeout_thread(void) +void zend_init_timeout_thread(void) /* {{{ */ { timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL); timeout_thread_handle = CreateEvent(NULL, FALSE, FALSE, NULL); _beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id); WaitForSingleObject(timeout_thread_event, INFINITE); } +/* }}} */ - -void zend_shutdown_timeout_thread(void) +void zend_shutdown_timeout_thread(void) /* {{{ */ { if (!timeout_thread_initialized) { return; @@ -1442,6 +1384,7 @@ void zend_shutdown_timeout_thread(void) CloseHandle(timeout_thread_handle); timeout_thread_initialized = 0; } +/* }}} */ #endif @@ -1450,16 +1393,17 @@ void zend_shutdown_timeout_thread(void) #define SIGPROF 27 #endif -void zend_set_timeout(long seconds) +void zend_set_timeout(long seconds, int reset_signals) /* {{{ */ { TSRMLS_FETCH(); EG(timeout_seconds) = seconds; + +#ifdef ZEND_WIN32 if(!seconds) { return; } -#ifdef ZEND_WIN32 - if (timeout_thread_initialized==0 && InterlockedIncrement(&timeout_thread_initialized)==1) { + if (timeout_thread_initialized == 0 && InterlockedIncrement(&timeout_thread_initialized) == 1) { /* We start up this process-wide thread here and not in zend_startup(), because if Zend * is initialized inside a DllMain(), you're not supposed to start threads from it. */ @@ -1472,28 +1416,37 @@ void zend_set_timeout(long seconds) struct itimerval t_r; /* timeout requested */ sigset_t sigset; - t_r.it_value.tv_sec = seconds; - t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0; + if(seconds) { + t_r.it_value.tv_sec = seconds; + t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0; # ifdef __CYGWIN__ - setitimer(ITIMER_REAL, &t_r, NULL); - signal(SIGALRM, zend_timeout); - sigemptyset(&sigset); - sigaddset(&sigset, SIGALRM); + setitimer(ITIMER_REAL, &t_r, NULL); + } + if(reset_signals) { + signal(SIGALRM, zend_timeout); + sigemptyset(&sigset); + sigaddset(&sigset, SIGALRM); + } # else - setitimer(ITIMER_PROF, &t_r, NULL); - signal(SIGPROF, zend_timeout); - sigemptyset(&sigset); - sigaddset(&sigset, SIGPROF); + setitimer(ITIMER_PROF, &t_r, NULL); + } + if(reset_signals) { + signal(SIGPROF, zend_timeout); + sigemptyset(&sigset); + sigaddset(&sigset, SIGPROF); + } # endif - sigprocmask(SIG_UNBLOCK, &sigset, NULL); + if(reset_signals) { + sigprocmask(SIG_UNBLOCK, &sigset, NULL); + } } # endif #endif } +/* }}} */ - -void zend_unset_timeout(TSRMLS_D) +void zend_unset_timeout(TSRMLS_D) /* {{{ */ { #ifdef ZEND_WIN32 if(timeout_thread_initialized) { @@ -1515,14 +1468,16 @@ void zend_unset_timeout(TSRMLS_D) # endif #endif } +/* }}} */ - -zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) +zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) /* {{{ */ { zend_class_entry **pce; int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0; + int silent = (fetch_type & ZEND_FETCH_CLASS_SILENT) != 0; + + fetch_type &= ZEND_FETCH_CLASS_MASK; - fetch_type = fetch_type & ~ZEND_FETCH_CLASS_NO_AUTOLOAD; check_fetch_type: switch (fetch_type) { case ZEND_FETCH_CLASS_SELF: @@ -1538,6 +1493,11 @@ check_fetch_type: zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent"); } return EG(scope)->parent; + case ZEND_FETCH_CLASS_STATIC: + if (!EG(called_scope)) { + zend_error(E_ERROR, "Cannot access static:: when no class scope is active"); + } + return EG(called_scope); case ZEND_FETCH_CLASS_AUTO: { fetch_type = zend_get_class_fetch_type(class_name, class_name_len); if (fetch_type!=ZEND_FETCH_CLASS_DEFAULT) { @@ -1547,20 +1507,21 @@ check_fetch_type: break; } - if (zend_lookup_class_ex(class_name, class_name_len, use_autoload, &pce TSRMLS_CC)==FAILURE) { + if (zend_lookup_class_ex(class_name, class_name_len, use_autoload, &pce TSRMLS_CC) == FAILURE) { if (use_autoload) { - if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) { - zend_error(E_ERROR, "Interface '%s' not found", class_name); - } else { - zend_error(E_ERROR, "Class '%s' not found", class_name); + if (!silent && !EG(exception)) { + if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) { + zend_error(E_ERROR, "Interface '%s' not found", class_name); + } else { + zend_error(E_ERROR, "Class '%s' not found", class_name); + } } } return NULL; } return *pce; } - - +/* }}} */ #define MAX_ABSTRACT_INFO_CNT 3 #define MAX_ABSTRACT_INFO_FMT "%s%s%s%s" @@ -1568,27 +1529,36 @@ check_fetch_type: ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : "", \ ai.afn[idx] ? "::" : "", \ ai.afn[idx] ? ai.afn[idx]->common.function_name : "", \ - ai.afn[idx] && ai.afn[idx+1] ? ", " : (ai.afn[idx] && ai.cnt > MAX_ABSTRACT_INFO_CNT ? ", ..." : "") + ai.afn[idx] && ai.afn[idx + 1] ? ", " : (ai.afn[idx] && ai.cnt > MAX_ABSTRACT_INFO_CNT ? ", ..." : "") typedef struct _zend_abstract_info { - zend_function *afn[MAX_ABSTRACT_INFO_CNT+1]; + zend_function *afn[MAX_ABSTRACT_INFO_CNT + 1]; int cnt; + int ctor; } zend_abstract_info; - -static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC) +static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC) /* {{{ */ { if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) { if (ai->cnt < MAX_ABSTRACT_INFO_CNT) { ai->afn[ai->cnt] = fn; } - ai->cnt++; + if (fn->common.fn_flags & ZEND_ACC_CTOR) { + if (!ai->ctor) { + ai->cnt++; + ai->ctor = 1; + } else { + ai->afn[ai->cnt] = NULL; + } + } else { + ai->cnt++; + } } return 0; } +/* }}} */ - -void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) +void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) /* {{{ */ { zend_abstract_info ai; @@ -1608,8 +1578,9 @@ void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) } } } +/* }}} */ -ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) +ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) /* {{{ */ { zend_execute_data *ex; int i; @@ -1622,30 +1593,83 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) } } } +/* }}} */ -ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC) +ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC) /* {{{ */ { zend_execute_data *ex; - ulong hash_value = zend_inline_hash_func(name, name_len+1); + ulong hash_value = zend_inline_hash_func(name, name_len + 1); - if (zend_hash_quick_exists(&EG(symbol_table), name, name_len+1, hash_value)) { + if (zend_hash_quick_exists(&EG(symbol_table), name, name_len + 1, hash_value)) { for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) { if (ex->op_array && ex->symbol_table == &EG(symbol_table)) { int i; for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && - ex->op_array->vars[i].name_len == name_len && - !memcmp(ex->op_array->vars[i].name, name, name_len)) { + ex->op_array->vars[i].name_len == name_len && + !memcmp(ex->op_array->vars[i].name, name, name_len) + ) { ex->CVs[i] = NULL; break; } } } } - return zend_hash_del(&EG(symbol_table), name, name_len+1); + return zend_hash_quick_del(&EG(symbol_table), name, name_len + 1, hash_value); } return FAILURE; } +/* }}} */ + +ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */ +{ + zend_uint i; + zend_execute_data *ex; + + if (!EG(active_symbol_table)) { + + /* Search for last called user function */ + ex = EG(current_execute_data); + while (ex && !ex->op_array) { + ex = ex->prev_execute_data; + } + if (ex && ex->symbol_table) { + EG(active_symbol_table) = ex->symbol_table; + return; + } + + if (ex && ex->op_array) { + if (EG(symtable_cache_ptr)>=EG(symtable_cache)) { + /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/ + EG(active_symbol_table) = *(EG(symtable_cache_ptr)--); + } else { + ALLOC_HASHTABLE(EG(active_symbol_table)); + zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0); + /*printf("Cache miss! Initialized %x\n", EG(active_symbol_table));*/ + } + ex->symbol_table = EG(active_symbol_table); + + if (ex->op_array->this_var != -1 && + !ex->CVs[ex->op_array->this_var] && + EG(This)) { + ex->CVs[ex->op_array->this_var] = (zval**)ex->CVs + ex->op_array->last_var + ex->op_array->this_var; + *ex->CVs[ex->op_array->this_var] = EG(This); + } + for (i = 0; i < ex->op_array->last_var; i++) { + if (ex->CVs[i]) { + zend_hash_quick_update(EG(active_symbol_table), + ex->op_array->vars[i].name, + ex->op_array->vars[i].name_len + 1, + ex->op_array->vars[i].hash_value, + (void**)ex->CVs[i], + sizeof(zval*), + (void**)&ex->CVs[i]); + } + } + } + } +} +/* }}} */ /* * Local variables: diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index c38880255..04e4c4f6f 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -17,14 +17,14 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_extensions.c,v 1.48.2.1.2.5 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_extensions.c,v 1.48.2.1.2.3.2.4 2009/01/17 02:05:13 stas Exp $ */ #include "zend_extensions.h" ZEND_API zend_llist zend_extensions; static int last_resource_number; -int zend_load_extension(char *path) +int zend_load_extension(const char *path) { #if ZEND_EXTENSIONS_SUPPORT DL_HANDLE handle; @@ -79,18 +79,9 @@ int zend_load_extension(char *path) DL_UNLOAD(handle); return FAILURE; } - } else if (ZTS_V!=extension_version_info->thread_safe) { - fprintf(stderr, "Cannot load %s - it %s thread safe, whereas Zend %s\n", - new_extension->name, - (extension_version_info->thread_safe?"is":"isn't"), - (ZTS_V?"is":"isn't")); - DL_UNLOAD(handle); - return FAILURE; - } else if (ZEND_DEBUG!=extension_version_info->debug) { - fprintf(stderr, "Cannot load %s - it %s debug information, whereas Zend %s\n", - new_extension->name, - (extension_version_info->debug?"contains":"does not contain"), - (ZEND_DEBUG?"does":"does not")); + } else if (strcmp(ZEND_EXTENSION_BUILD_ID, extension_version_info->build_id)) { + fprintf(stderr, "Cannot load %s - it was build with configuration %s, whereas running engine is %s\n", + new_extension->name, extension_version_info->build_id, ZEND_EXTENSION_BUILD_ID); DL_UNLOAD(handle); return FAILURE; } @@ -178,7 +169,7 @@ void zend_extension_dtor(zend_extension *extension) } -static void zend_extension_message_dispatcher(zend_extension *extension, int num_args, va_list args TSRMLS_DC) +static void zend_extension_message_dispatcher(const zend_extension *extension, int num_args, va_list args TSRMLS_DC) { int message; void *arg; @@ -211,7 +202,7 @@ ZEND_API int zend_get_resource_handle(zend_extension *extension) } -ZEND_API zend_extension *zend_get_extension(char *extension_name) +ZEND_API zend_extension *zend_get_extension(const char *extension_name) { zend_llist_element *element; diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 634a532c9..e550e148b 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -17,25 +17,25 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_extensions.h,v 1.67.2.3.2.5 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_extensions.h,v 1.67.2.3.2.3.2.6 2009/01/17 16:14:59 johannes Exp $ */ #ifndef ZEND_EXTENSIONS_H #define ZEND_EXTENSIONS_H #include "zend_compile.h" +#include "zend_build.h" /* The first number is the engine version and the rest is the date. * This way engine 2/3 API no. is always greater than engine 1 API no.. */ -#define ZEND_EXTENSION_API_NO 220060519 +#define ZEND_EXTENSION_API_NO 220090115 typedef struct _zend_extension_version_info { int zend_extension_api_no; - char *required_zend_version; - unsigned char thread_safe; - unsigned char debug; + char *build_id; } zend_extension_version_info; +#define ZEND_EXTENSION_BUILD_ID "API" ZEND_TOSTR(ZEND_EXTENSION_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA typedef struct _zend_extension zend_extension; @@ -101,7 +101,7 @@ END_EXTERN_C() #define ZEND_EXTENSION() \ - ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_VERSION, ZTS_V, ZEND_DEBUG } + ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_EXTENSION_BUILD_ID } #define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1 #define COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1 @@ -110,15 +110,15 @@ END_EXTERN_C() ZEND_API extern zend_llist zend_extensions; void zend_extension_dtor(zend_extension *extension); -void zend_append_version_info(zend_extension *extension); +void zend_append_version_info(const zend_extension *extension); int zend_startup_extensions_mechanism(void); int zend_startup_extensions(void); void zend_shutdown_extensions(TSRMLS_D); BEGIN_EXTERN_C() -ZEND_API int zend_load_extension(char *path); +ZEND_API int zend_load_extension(const char *path); ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); -ZEND_API zend_extension *zend_get_extension(char *extension_name); +ZEND_API zend_extension *zend_get_extension(const char *extension_name); END_EXTERN_C() #endif /* ZEND_EXTENSIONS_H */ diff --git a/Zend/zend_fast_cache.h b/Zend/zend_fast_cache.h index f054a0aac..66d6f59ae 100644 --- a/Zend/zend_fast_cache.h +++ b/Zend/zend_fast_cache.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_fast_cache.h,v 1.21.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_fast_cache.h,v 1.21.2.1.2.2.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #if 0 #ifndef ZEND_FAST_CACHE_H #define ZEND_FAST_CACHE_H diff --git a/Zend/zend_float.c b/Zend/zend_float.c new file mode 100644 index 000000000..ab59c9159 --- /dev/null +++ b/Zend/zend_float.c @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2009 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: Christian Seiler | + +----------------------------------------------------------------------+ +*/ + +/* $Id: zend_float.c,v 1.1.2.2 2009/03/18 11:53:10 dmitry Exp $ */ + +#include "zend.h" +#include "zend_compile.h" +#include "zend_float.h" + +ZEND_API void zend_init_fpu(TSRMLS_D) /* {{{ */ +{ +#if XPFPA_HAVE_CW + XPFPA_DECLARE + + if (!EG(saved_fpu_cw)) { + EG(saved_fpu_cw) = emalloc(sizeof(XPFPA_CW_DATATYPE)); + } + XPFPA_STORE_CW(EG(saved_fpu_cw)); + XPFPA_SWITCH_DOUBLE(); +#else + if (EG(saved_fpu_cw)) { + efree(EG(saved_fpu_cw)); + } + EG(saved_fpu_cw) = NULL; +#endif +} +/* }}} */ + +ZEND_API void zend_shutdown_fpu(TSRMLS_D) /* {{{ */ +{ +#if XPFPA_HAVE_CW + if (EG(saved_fpu_cw)) { + XPFPA_RESTORE_CW(EG(saved_fpu_cw)); + } +#endif + if (EG(saved_fpu_cw)) { + efree(EG(saved_fpu_cw)); + EG(saved_fpu_cw) = NULL; + } +} +/* }}} */ + +ZEND_API void zend_ensure_fpu_mode(TSRMLS_D) /* {{{ */ +{ + XPFPA_DECLARE + + XPFPA_SWITCH_DOUBLE(); +} +/* }}} */ diff --git a/Zend/zend_float.h b/Zend/zend_float.h new file mode 100644 index 000000000..1c8c96ad9 --- /dev/null +++ b/Zend/zend_float.h @@ -0,0 +1,422 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2009 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: Christian Seiler | + +----------------------------------------------------------------------+ +*/ + +/* $Id: zend_float.h,v 1.2.2.5 2009/03/18 10:18:09 dmitry Exp $ */ + +#ifndef ZEND_FLOAT_H +#define ZEND_FLOAT_H + +/* + Define functions for FP initialization and de-initialization. +*/ +extern ZEND_API void zend_init_fpu(TSRMLS_D); +extern ZEND_API void zend_shutdown_fpu(TSRMLS_D); +extern ZEND_API void zend_ensure_fpu_mode(TSRMLS_D); + +/* Copy of the contents of xpfpa.h (which is under public domain) + See http://wiki.php.net/rfc/rounding for details. + + Cross Platform Floating Point Arithmetics + + This header file defines several platform-dependent macros that ensure + equal and deterministic floating point behaviour across several platforms, + compilers and architectures. + + The current macros are currently only used on x86 and x86_64 architectures, + on every other architecture, these macros expand to NOPs. This assumes that + other architectures do not have an internal precision and the operhand types + define the computational precision of floating point operations. This + assumption may be false, in that case, the author is interested in further + details on the other platform. + + For further details, please visit: + http://www.christian-seiler.de/projekte/fpmath/ + + Version: 20090317 */ + +/* + Implementation notes: + + x86_64: + - Since all x86_64 compilers use SSE by default, it is probably unecessary + to use these macros there. We define them anyway since we are too lazy + to differentiate the architecture. Also, the compiler option -mfpmath=i387 + justifies this decision. + + General: + - It would be nice if one could detect whether SSE if used for math via some + funky compiler defines and if so, make the macros go to NOPs. Any ideas + on how to do that? + + MS Visual C: + - Since MSVC users tipically don't use autoconf or CMake, we will detect + MSVC via compile time define. +*/ + +/* MSVC detection (MSVC people usually don't use autoconf) */ +#ifdef _MSC_VER +# if _MSC_VER >= 1500 + /* Visual C++ 2008 or higher, supports _controlfp_s */ +# define HAVE__CONTROLFP_S +# else + /* Visual C++ (up to 2005), supports _controlfp */ +# define HAVE__CONTROLFP +# endif /* MSC_VER >= 1500 */ + /* Tell MSVC optimizer that we access FP environment */ +# pragma fenv_access (on) +#endif /* _MSC_VER */ + +#ifdef HAVE__CONTROLFP_S + +/* float.h defines _controlfp_s */ +# include + +# define XPFPA_HAVE_CW 1 +# define XPFPA_CW_DATATYPE \ + unsigned int + +# define XPFPA_STORE_CW(vptr) do { \ + _controlfp_s((unsigned int *)(vptr), 0, 0); \ + } while (0) + +# define XPFPA_RESTORE_CW(vptr) do { \ + unsigned int _xpfpa_fpu_cw; \ + _controlfp_s(&_xpfpa_fpu_cw, *((unsigned int *)(vptr)), _MCW_PC); \ + } while (0) + +# define XPFPA_DECLARE \ + unsigned int _xpfpa_fpu_oldcw, _xpfpa_fpu_cw; + +# define XPFPA_SWITCH_DOUBLE() do { \ + _controlfp_s(&_xpfpa_fpu_cw, 0, 0); \ + _xpfpa_fpu_oldcw = _xpfpa_fpu_cw; \ + _controlfp_s(&_xpfpa_fpu_cw, _PC_53, _MCW_PC); \ + } while (0) +# define XPFPA_SWITCH_SINGLE() do { \ + _controlfp_s(&_xpfpa_fpu_cw, 0, 0); \ + _xpfpa_fpu_oldcw = _xpfpa_fpu_cw; \ + _controlfp_s(&_xpfpa_fpu_cw, _PC_24, _MCW_PC); \ + } while (0) +/* NOTE: This only sets internal precision. MSVC does NOT support double- + extended precision! */ +# define XPFPA_SWITCH_DOUBLE_EXTENDED() do { \ + _controlfp_s(&_xpfpa_fpu_cw, 0, 0); \ + _xpfpa_fpu_oldcw = _xpfpa_fpu_cw; \ + _controlfp_s(&_xpfpa_fpu_cw, _PC_64, _MCW_PC); \ + } while (0) +# define XPFPA_RESTORE() \ + _controlfp_s(&_xpfpa_fpu_cw, _xpfpa_fpu_oldcw, _MCW_PC) +/* We do NOT use the volatile return trick since _controlfp_s is a function + call and thus FP registers are saved in memory anyway. However, we do use + a variable to ensure that the expression passed into val will be evaluated + *before* switching back contexts. */ +# define XPFPA_RETURN_DOUBLE(val) \ + do { \ + double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +# define XPFPA_RETURN_SINGLE(val) \ + do { \ + float _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +/* This won't work, but we add a macro for it anyway. */ +# define XPFPA_RETURN_DOUBLE_EXTENDED(val) \ + do { \ + long double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) + +#elif defined(HAVE__CONTROLFP) + +/* float.h defines _controlfp */ +# include + +# define XPFPA_DECLARE \ + unsigned int _xpfpa_fpu_oldcw; + +# define XPFPA_HAVE_CW 1 +# define XPFPA_CW_DATATYPE \ + unsigned int + +# define XPFPA_STORE_CW(vptr) do { \ + *((unsigned int *)(vptr)) = _controlfp(0, 0); \ + } while (0) + +# define XPFPA_RESTORE_CW(vptr) do { \ + _controlfp(*((unsigned int *)(vptr)), _MCW_PC); \ + } while (0) + +# define XPFPA_SWITCH_DOUBLE() do { \ + _xpfpa_fpu_oldcw = _controlfp(0, 0); \ + _controlfp(_PC_53, _MCW_PC); \ + } while (0) +# define XPFPA_SWITCH_SINGLE() do { \ + _xpfpa_fpu_oldcw = _controlfp(0, 0); \ + _controlfp(_PC_24, _MCW_PC); \ + } while (0) +/* NOTE: This will only work as expected on MinGW. */ +# define XPFPA_SWITCH_DOUBLE_EXTENDED() do { \ + _xpfpa_fpu_oldcw = _controlfp(0, 0); \ + _controlfp(_PC_64, _MCW_PC); \ + } while (0) +# define XPFPA_RESTORE() \ + _controlfp(_xpfpa_fpu_oldcw, _MCW_PC) +/* We do NOT use the volatile return trick since _controlfp is a function + call and thus FP registers are saved in memory anyway. However, we do use + a variable to ensure that the expression passed into val will be evaluated + *before* switching back contexts. */ +# define XPFPA_RETURN_DOUBLE(val) \ + do { \ + double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +# define XPFPA_RETURN_SINGLE(val) \ + do { \ + float _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +/* This will only work on MinGW */ +# define XPFPA_RETURN_DOUBLE_EXTENDED(val) \ + do { \ + long double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) + +#elif defined(HAVE__FPU_SETCW) /* glibc systems */ + +/* fpu_control.h defines _FPU_[GS]ETCW */ +# include + +# define XPFPA_DECLARE \ + fpu_control_t _xpfpa_fpu_oldcw, _xpfpa_fpu_cw; + +# define XPFPA_HAVE_CW 1 +# define XPFPA_CW_DATATYPE \ + fpu_control_t + +# define XPFPA_STORE_CW(vptr) do { \ + _FPU_GETCW((*((fpu_control_t *)(vptr)))); \ + } while (0) + +# define XPFPA_RESTORE_CW(vptr) do { \ + _FPU_SETCW((*((fpu_control_t *)(vptr)))); \ + } while (0) + +# define XPFPA_SWITCH_DOUBLE() do { \ + _FPU_GETCW(_xpfpa_fpu_oldcw); \ + _xpfpa_fpu_cw = (_xpfpa_fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_SINGLE) | _FPU_DOUBLE; \ + _FPU_SETCW(_xpfpa_fpu_cw); \ + } while (0) +# define XPFPA_SWITCH_SINGLE() do { \ + _FPU_GETCW(_xpfpa_fpu_oldcw); \ + _xpfpa_fpu_cw = (_xpfpa_fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_DOUBLE) | _FPU_SINGLE; \ + _FPU_SETCW(_xpfpa_fpu_cw); \ + } while (0) +# define XPFPA_SWITCH_DOUBLE_EXTENDED() do { \ + _FPU_GETCW(_xpfpa_fpu_oldcw); \ + _xpfpa_fpu_cw = (_xpfpa_fpu_oldcw & ~_FPU_SINGLE & ~_FPU_DOUBLE) | _FPU_EXTENDED; \ + _FPU_SETCW(_xpfpa_fpu_cw); \ + } while (0) +# define XPFPA_RESTORE() \ + _FPU_SETCW(_xpfpa_fpu_oldcw) +/* We use a temporary volatile variable (in a new block) in order to ensure + that the optimizer does not mis-optimize the instructions. Also, a volatile + variable ensures truncation to correct precision. */ +# define XPFPA_RETURN_DOUBLE(val) \ + do { \ + volatile double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +# define XPFPA_RETURN_SINGLE(val) \ + do { \ + volatile float _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +# define XPFPA_RETURN_DOUBLE_EXTENDED(val) \ + do { \ + volatile long double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) + +#elif defined(HAVE_FPSETPREC) /* FreeBSD */ + +/* fpu_control.h defines _FPU_[GS]ETCW */ +# include + +# define XPFPA_DECLARE \ + fp_prec_t _xpfpa_fpu_oldprec; + +# define XPFPA_HAVE_CW 1 +# define XPFPA_CW_DATATYPE \ + fp_prec_t + +# define XPFPA_STORE_CW(vptr) do { \ + *((fp_prec_t *)(vptr)) = fpgetprec(); \ + } while (0) + +# define XPFPA_RESTORE_CW(vptr) do { \ + fpsetprec(*((fp_prec_t *)(vptr))); \ + } while (0) + +# define XPFPA_SWITCH_DOUBLE() do { \ + _xpfpa_fpu_oldprec = fpgetprec(); \ + fpsetprec(FP_PD); \ + } while (0) +# define XPFPA_SWITCH_SINGLE() do { \ + _xpfpa_fpu_oldprec = fpgetprec(); \ + fpsetprec(FP_PS); \ + } while (0) +# define XPFPA_SWITCH_DOUBLE_EXTENDED() do { \ + _xpfpa_fpu_oldprec = fpgetprec(); \ + fpsetprec(FP_PE); \ + } while (0) +# define XPFPA_RESTORE() \ + fpsetprec(_xpfpa_fpu_oldprec) +/* We use a temporary volatile variable (in a new block) in order to ensure + that the optimizer does not mis-optimize the instructions. Also, a volatile + variable ensures truncation to correct precision. */ +# define XPFPA_RETURN_DOUBLE(val) \ + do { \ + volatile double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +# define XPFPA_RETURN_SINGLE(val) \ + do { \ + volatile float _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +# define XPFPA_RETURN_DOUBLE_EXTENDED(val) \ + do { \ + volatile long double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) + +#elif defined(HAVE_FPU_INLINE_ASM_X86) + +/* + Custom x86 inline assembler implementation. + + This implementation does not use predefined wrappers of the OS / compiler + but rather uses x86/x87 inline assembler directly. Basic instructions: + + fnstcw - Store the FPU control word in a variable + fldcw - Load the FPU control word from a variable + + Bits (only bits 8 and 9 are relevant, bits 0 to 7 are for other things): + 0x0yy: Single precision + 0x1yy: Reserved + 0x2yy: Double precision + 0x3yy: Double-extended precision + + We use an unsigned int for the datatype. glibc sources add __mode__ (__HI__) + attribute to it (HI stands for half-integer according to docs). It is unclear + what the does exactly and how portable it is. + + The assembly syntax works with GNU CC, Intel CC and Sun CC. +*/ + +# define XPFPA_DECLARE \ + unsigned int _xpfpa_fpu_oldcw, _xpfpa_fpu_cw; + +# define XPFPA_HAVE_CW 1 +# define XPFPA_CW_DATATYPE \ + unsigned int + +# define XPFPA_STORE_CW(vptr) do { \ + __asm__ __volatile__ ("fnstcw %0" : "=m" (*((unsigned int *)(vptr)))); \ + } while (0) + +# define XPFPA_RESTORE_CW(vptr) do { \ + __asm__ __volatile__ ("fldcw %0" : : "m" (*((unsigned int *)(vptr)))); \ + } while (0) + +# define XPFPA_SWITCH_DOUBLE() do { \ + __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_xpfpa_fpu_oldcw)); \ + _xpfpa_fpu_cw = (_xpfpa_fpu_oldcw & ~0x100) | 0x200; \ + __asm__ __volatile__ ("fldcw %0" : : "m" (*&_xpfpa_fpu_cw)); \ + } while (0) +# define XPFPA_SWITCH_SINGLE() do { \ + __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_xpfpa_fpu_oldcw)); \ + _xpfpa_fpu_cw = (_xpfpa_fpu_oldcw & ~0x300); \ + __asm__ __volatile__ ("fldcw %0" : : "m" (*&_xpfpa_fpu_cw)); \ + } while (0) +# define XPFPA_SWITCH_DOUBLE_EXTENDED() do { \ + __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_xpfpa_fpu_oldcw)); \ + _xpfpa_fpu_cw = _xpfpa_fpu_oldcw | 0x300; \ + __asm__ __volatile__ ("fldcw %0" : : "m" (*&_xpfpa_fpu_cw)); \ + } while (0) +# define XPFPA_RESTORE() \ + __asm__ __volatile__ ("fldcw %0" : : "m" (*&_xpfpa_fpu_oldcw)) +/* We use a temporary volatile variable (in a new block) in order to ensure + that the optimizer does not mis-optimize the instructions. Also, a volatile + variable ensures truncation to correct precision. */ +# define XPFPA_RETURN_DOUBLE(val) \ + do { \ + volatile double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +# define XPFPA_RETURN_SINGLE(val) \ + do { \ + volatile float _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) +# define XPFPA_RETURN_DOUBLE_EXTENDED(val) \ + do { \ + volatile long double _xpfpa_result = (val); \ + XPFPA_RESTORE(); \ + return _xpfpa_result; \ + } while (0) + +#else /* FPU CONTROL */ + +/* + This is either not an x87 FPU or the inline assembly syntax was not + recognized. In any case, default to NOPs for the macros and hope the + generated code will behave as planned. +*/ +# define XPFPA_DECLARE /* NOP */ +# define XPFPA_HAVE_CW 0 +# define XPFPA_CW_DATATYPE unsigned int +# define XPFPA_STORE_CW(variable) /* NOP */ +# define XPFPA_RESTORE_CW(variable) /* NOP */ +# define XPFPA_SWITCH_DOUBLE() /* NOP */ +# define XPFPA_SWITCH_SINGLE() /* NOP */ +# define XPFPA_SWITCH_DOUBLE_EXTENDED() /* NOP */ +# define XPFPA_RESTORE() /* NOP */ +# define XPFPA_RETURN_DOUBLE(val) return (val) +# define XPFPA_RETURN_SINGLE(val) return (val) +# define XPFPA_RETURN_DOUBLE_EXTENDED(val) return (val) + +#endif /* FPU CONTROL */ + +#endif diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c new file mode 100644 index 000000000..64ffaf108 --- /dev/null +++ b/Zend/zend_gc.c @@ -0,0 +1,612 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2009 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: David Wang | + | Dmitry Stogov | + +----------------------------------------------------------------------+ +*/ + +/* $Id: zend_gc.c,v 1.1.2.21 2009/02/18 12:02:53 dmitry Exp $ */ + +#include "zend.h" +#include "zend_API.h" + +#define GC_ROOT_BUFFER_MAX_ENTRIES 10000 + +#ifdef ZTS +ZEND_API int gc_globals_id; +#else +ZEND_API zend_gc_globals gc_globals; +#endif + +/* Forward declarations */ +static int children_scan_black(zval **pz TSRMLS_DC); +static int children_mark_grey(zval **pz TSRMLS_DC); +static int children_collect_white(zval **pz TSRMLS_DC); +static int children_scan(zval **pz TSRMLS_DC); + +static void root_buffer_dtor(zend_gc_globals *gc_globals TSRMLS_DC) +{ + if (gc_globals->buf) { + free(gc_globals->buf); + gc_globals->buf = NULL; + } +} + +static void gc_globals_ctor_ex(zend_gc_globals *gc_globals TSRMLS_DC) +{ + gc_globals->gc_enabled = 0; + gc_globals->gc_active = 0; + + gc_globals->buf = NULL; + + gc_globals->roots.next = &gc_globals->roots; + gc_globals->roots.prev = &gc_globals->roots; + gc_globals->unused = NULL; + gc_globals->zval_to_free = NULL; + gc_globals->free_list = NULL; + gc_globals->next_to_free = NULL; + + gc_globals->gc_runs = 0; + gc_globals->collected = 0; + +#if GC_BENCH + gc_globals->root_buf_length = 0; + gc_globals->root_buf_peak = 0; + gc_globals->zval_possible_root = 0; + gc_globals->zobj_possible_root = 0; + gc_globals->zval_buffered = 0; + gc_globals->zobj_buffered = 0; + gc_globals->zval_remove_from_buffer = 0; + gc_globals->zobj_remove_from_buffer = 0; + gc_globals->zval_marked_grey = 0; + gc_globals->zobj_marked_grey = 0; +#endif +} + +ZEND_API void gc_globals_ctor(TSRMLS_D) +{ +#ifdef ZTS + ts_allocate_id(&gc_globals_id, sizeof(zend_gc_globals), (ts_allocate_ctor) gc_globals_ctor_ex, (ts_allocate_dtor) root_buffer_dtor); +#else + gc_globals_ctor_ex(&gc_globals); +#endif +} + +ZEND_API void gc_globals_dtor(TSRMLS_D) +{ +#ifndef ZTS + root_buffer_dtor(&gc_globals TSRMLS_DC); +#endif +} + +ZEND_API void gc_reset(TSRMLS_D) +{ + GC_G(gc_runs) = 0; + GC_G(collected) = 0; + +#if GC_BENCH + GC_G(root_buf_length) = 0; + GC_G(root_buf_peak) = 0; + GC_G(zval_possible_root) = 0; + GC_G(zobj_possible_root) = 0; + GC_G(zval_buffered) = 0; + GC_G(zobj_buffered) = 0; + GC_G(zval_remove_from_buffer) = 0; + GC_G(zobj_remove_from_buffer) = 0; + GC_G(zval_marked_grey) = 0; + GC_G(zobj_marked_grey) = 0; +#endif + + GC_G(roots).next = &GC_G(roots); + GC_G(roots).prev = &GC_G(roots); + + if (GC_G(buf)) { + GC_G(unused) = NULL; + GC_G(first_unused) = GC_G(buf); + + GC_G(zval_to_free) = NULL; + } else { + GC_G(unused) = NULL; + GC_G(first_unused) = NULL; + GC_G(last_unused) = NULL; + } +} + +ZEND_API void gc_init(TSRMLS_D) +{ + if (GC_G(buf) == NULL && GC_G(gc_enabled)) { + GC_G(buf) = (gc_root_buffer*) malloc(sizeof(gc_root_buffer) * GC_ROOT_BUFFER_MAX_ENTRIES); + GC_G(last_unused) = &GC_G(buf)[GC_ROOT_BUFFER_MAX_ENTRIES]; + gc_reset(TSRMLS_C); + } +} + +ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC) +{ + if (UNEXPECTED(GC_G(free_list) != NULL && + GC_ZVAL_ADDRESS(zv) != NULL && + GC_ZVAL_GET_COLOR(zv) == GC_BLACK) && + (GC_ZVAL_ADDRESS(zv) < GC_G(buf) || + GC_ZVAL_ADDRESS(zv) >= GC_G(last_unused))) { + /* The given zval is a garbage that is going to be deleted by + * currently running GC */ + return; + } + + if (zv->type == IS_OBJECT) { + GC_ZOBJ_CHECK_POSSIBLE_ROOT(zv); + return; + } + + GC_BENCH_INC(zval_possible_root); + + if (GC_ZVAL_GET_COLOR(zv) != GC_PURPLE) { + GC_ZVAL_SET_PURPLE(zv); + + if (!GC_ZVAL_ADDRESS(zv)) { + gc_root_buffer *newRoot = GC_G(unused); + + if (newRoot) { + GC_G(unused) = newRoot->prev; + } else if (GC_G(first_unused) != GC_G(last_unused)) { + newRoot = GC_G(first_unused); + GC_G(first_unused)++; + } else { + if (!GC_G(gc_enabled)) { + GC_ZVAL_SET_BLACK(zv); + return; + } + zv->refcount__gc++; + gc_collect_cycles(TSRMLS_C); + zv->refcount__gc--; + newRoot = GC_G(unused); + if (!newRoot) { + return; + } + GC_ZVAL_SET_PURPLE(zv); + GC_G(unused) = newRoot->prev; + } + + newRoot->next = GC_G(roots).next; + newRoot->prev = &GC_G(roots); + GC_G(roots).next->prev = newRoot; + GC_G(roots).next = newRoot; + + GC_ZVAL_SET_ADDRESS(zv, newRoot); + + newRoot->handle = 0; + newRoot->u.pz = zv; + + GC_BENCH_INC(zval_buffered); + GC_BENCH_INC(root_buf_length); + GC_BENCH_PEAK(root_buf_peak, root_buf_length); + } + } +} + +ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC) +{ + struct _store_object *obj; + + if (UNEXPECTED(Z_OBJ_HT_P(zv)->get_properties == NULL || + EG(objects_store).object_buckets == NULL)) { + return; + } + + GC_BENCH_INC(zobj_possible_root); + + obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zv)].bucket.obj; + if (GC_GET_COLOR(obj->buffered) != GC_PURPLE) { + GC_SET_PURPLE(obj->buffered); + if (!GC_ADDRESS(obj->buffered)) { + gc_root_buffer *newRoot = GC_G(unused); + + if (newRoot) { + GC_G(unused) = newRoot->prev; + } else if (GC_G(first_unused) != GC_G(last_unused)) { + newRoot = GC_G(first_unused); + GC_G(first_unused)++; + } else { + if (!GC_G(gc_enabled)) { + GC_ZVAL_SET_BLACK(zv); + return; + } + zv->refcount__gc++; + gc_collect_cycles(TSRMLS_C); + zv->refcount__gc--; + newRoot = GC_G(unused); + if (!newRoot) { + return; + } + obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zv)].bucket.obj; + GC_SET_PURPLE(obj->buffered); + GC_G(unused) = newRoot->prev; + } + + newRoot->next = GC_G(roots).next; + newRoot->prev = &GC_G(roots); + GC_G(roots).next->prev = newRoot; + GC_G(roots).next = newRoot; + + GC_SET_ADDRESS(obj->buffered, newRoot); + + newRoot->handle = Z_OBJ_HANDLE_P(zv); + newRoot->u.handlers = Z_OBJ_HT_P(zv); + + GC_BENCH_INC(zobj_buffered); + GC_BENCH_INC(root_buf_length); + GC_BENCH_PEAK(root_buf_peak, root_buf_length); + } + } +} + +ZEND_API void gc_remove_zval_from_buffer(zval *zv TSRMLS_DC) +{ + gc_root_buffer* root_buffer = GC_ADDRESS(((zval_gc_info*)zv)->u.buffered); + + if (UNEXPECTED(GC_G(free_list) != NULL && + GC_ZVAL_GET_COLOR(zv) == GC_BLACK) && + (GC_ZVAL_ADDRESS(zv) < GC_G(buf) || + GC_ZVAL_ADDRESS(zv) >= GC_G(last_unused))) { + /* The given zval is a garbage that is going to be deleted by + * currently running GC */ + if (GC_G(next_to_free) == (zval_gc_info*)zv) { + GC_G(next_to_free) = ((zval_gc_info*)zv)->u.next; + } + return; + } + GC_BENCH_INC(zval_remove_from_buffer); + GC_REMOVE_FROM_BUFFER(root_buffer); + ((zval_gc_info*)zv)->u.buffered = NULL; +} + +static void zobj_scan_black(struct _store_object *obj, zval *pz TSRMLS_DC) +{ + GC_SET_BLACK(obj->buffered); + + if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid && + Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) { + zend_hash_apply(Z_OBJPROP_P(pz), (apply_func_t) children_scan_black TSRMLS_CC); + } +} + +static void zval_scan_black(zval *pz TSRMLS_DC) +{ + GC_ZVAL_SET_BLACK(pz); + + if (Z_TYPE_P(pz) == IS_OBJECT && EG(objects_store).object_buckets) { + struct _store_object *obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].bucket.obj; + + obj->refcount++; + if (GC_GET_COLOR(obj->buffered) != GC_BLACK) { + zobj_scan_black(obj, pz TSRMLS_CC); + } + } else if (Z_TYPE_P(pz) == IS_ARRAY) { + if (Z_ARRVAL_P(pz) != &EG(symbol_table)) { + zend_hash_apply(Z_ARRVAL_P(pz), (apply_func_t) children_scan_black TSRMLS_CC); + } + } +} + +static int children_scan_black(zval **pz TSRMLS_DC) +{ + if (Z_TYPE_PP(pz) != IS_ARRAY || Z_ARRVAL_PP(pz) != &EG(symbol_table)) { + (*pz)->refcount__gc++; + } + + if (GC_ZVAL_GET_COLOR(*pz) != GC_BLACK) { + zval_scan_black(*pz TSRMLS_CC); + } + + return 0; +} + +static void zobj_mark_grey(struct _store_object *obj, zval *pz TSRMLS_DC) +{ + if (GC_GET_COLOR(obj->buffered) != GC_GREY) { + GC_BENCH_INC(zobj_marked_grey); + GC_SET_COLOR(obj->buffered, GC_GREY); + if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid && + Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) { + zend_hash_apply(Z_OBJPROP_P(pz), (apply_func_t) children_mark_grey TSRMLS_CC); + } + } +} + +static void zval_mark_grey(zval *pz TSRMLS_DC) +{ + if (GC_ZVAL_GET_COLOR(pz) != GC_GREY) { + GC_BENCH_INC(zval_marked_grey); + GC_ZVAL_SET_COLOR(pz, GC_GREY); + + if (Z_TYPE_P(pz) == IS_OBJECT && EG(objects_store).object_buckets) { + struct _store_object *obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].bucket.obj; + + obj->refcount--; + zobj_mark_grey(obj, pz TSRMLS_CC); + } else if (Z_TYPE_P(pz) == IS_ARRAY) { + if (Z_ARRVAL_P(pz) == &EG(symbol_table)) { + GC_ZVAL_SET_BLACK(pz); + } else { + zend_hash_apply(Z_ARRVAL_P(pz), (apply_func_t) children_mark_grey TSRMLS_CC); + } + } + } +} + +static int children_mark_grey(zval **pz TSRMLS_DC) +{ + if (Z_TYPE_PP(pz) != IS_ARRAY || Z_ARRVAL_PP(pz) != &EG(symbol_table)) { + (*pz)->refcount__gc--; + } + zval_mark_grey(*pz TSRMLS_CC); + return 0; +} + +static void gc_mark_roots(TSRMLS_D) +{ + gc_root_buffer *current = GC_G(roots).next; + + while (current != &GC_G(roots)) { + if (current->handle && EG(objects_store).object_buckets) { + struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj; + + if (GC_GET_COLOR(obj->buffered) == GC_PURPLE) { + zval z; + + INIT_PZVAL(&z); + Z_OBJ_HANDLE(z) = current->handle; + Z_OBJ_HT(z) = current->u.handlers; + zobj_mark_grey(obj, &z TSRMLS_CC); + } else { + GC_SET_ADDRESS(obj->buffered, NULL); + GC_REMOVE_FROM_BUFFER(current); + } + } else { + if (GC_ZVAL_GET_COLOR(current->u.pz) == GC_PURPLE) { + zval_mark_grey(current->u.pz TSRMLS_CC); + } else { + GC_ZVAL_SET_ADDRESS(current->u.pz, NULL); + GC_REMOVE_FROM_BUFFER(current); + } + } + current = current->next; + } +} + +static void zobj_scan(zval *pz TSRMLS_DC) +{ + if (EG(objects_store).object_buckets) { + struct _store_object *obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].bucket.obj; + + if (GC_GET_COLOR(obj->buffered) == GC_GREY) { + if (obj->refcount > 0) { + zobj_scan_black(obj, pz TSRMLS_CC); + } else { + GC_SET_COLOR(obj->buffered, GC_WHITE); + if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid && + Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) { + zend_hash_apply(Z_OBJPROP_P(pz), (apply_func_t) children_scan TSRMLS_CC); + } + } + } + } +} + +static int zval_scan(zval *pz TSRMLS_DC) +{ + if (GC_ZVAL_GET_COLOR(pz) == GC_GREY) { + if (pz->refcount__gc > 0) { + zval_scan_black(pz TSRMLS_CC); + } else { + GC_ZVAL_SET_COLOR(pz, GC_WHITE); + if (Z_TYPE_P(pz) == IS_OBJECT) { + zobj_scan(pz TSRMLS_CC); + } else if (Z_TYPE_P(pz) == IS_ARRAY) { + if (Z_ARRVAL_P(pz) == &EG(symbol_table)) { + GC_ZVAL_SET_BLACK(pz); + } else { + zend_hash_apply(Z_ARRVAL_P(pz), (apply_func_t) children_scan TSRMLS_CC); + } + } + } + } + return 0; +} + +static int children_scan(zval **pz TSRMLS_DC) +{ + zval_scan(*pz TSRMLS_CC); + return 0; +} + +static void gc_scan_roots(TSRMLS_D) +{ + gc_root_buffer *current = GC_G(roots).next; + + while (current != &GC_G(roots)) { + if (current->handle) { + zval z; + + INIT_PZVAL(&z); + Z_OBJ_HANDLE(z) = current->handle; + Z_OBJ_HT(z) = current->u.handlers; + zobj_scan(&z TSRMLS_CC); + } else { + zval_scan(current->u.pz TSRMLS_CC); + } + current = current->next; + } +} + +static void zobj_collect_white(zval *pz TSRMLS_DC) +{ + if (EG(objects_store).object_buckets) { + zend_object_handle handle = Z_OBJ_HANDLE_P(pz); + struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj; + + if (obj->buffered == (gc_root_buffer*)GC_WHITE) { + GC_SET_BLACK(obj->buffered); + + if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid && + Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) { + zend_hash_apply(Z_OBJPROP_P(pz), (apply_func_t) children_collect_white TSRMLS_CC); + } + } + } +} + +static void zval_collect_white(zval *pz TSRMLS_DC) +{ + if (((zval_gc_info*)(pz))->u.buffered == (gc_root_buffer*)GC_WHITE) { + GC_ZVAL_SET_BLACK(pz); + + if (Z_TYPE_P(pz) == IS_OBJECT) { + zobj_collect_white(pz TSRMLS_CC); + } else { + if (Z_TYPE_P(pz) == IS_ARRAY) { + zend_hash_apply(Z_ARRVAL_P(pz), (apply_func_t) children_collect_white TSRMLS_CC); + } + } + + /* restore refcount and put into list to free */ + pz->refcount__gc++; + ((zval_gc_info*)pz)->u.next = GC_G(zval_to_free); + GC_G(zval_to_free) = (zval_gc_info*)pz; + } +} + +static int children_collect_white(zval **pz TSRMLS_DC) +{ + if (Z_TYPE_PP(pz) != IS_ARRAY || Z_ARRVAL_PP(pz) != &EG(symbol_table)) { + (*pz)->refcount__gc++; + } + zval_collect_white(*pz TSRMLS_CC); + return 0; +} + +static void gc_collect_roots(TSRMLS_D) +{ + gc_root_buffer *current = GC_G(roots).next; + + while (current != &GC_G(roots)) { + if (current->handle && EG(objects_store).object_buckets) { + struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj; + zval z; + + GC_SET_ADDRESS(obj->buffered, NULL); + INIT_PZVAL(&z); + Z_OBJ_HANDLE(z) = current->handle; + Z_OBJ_HT(z) = current->u.handlers; + zobj_collect_white(&z TSRMLS_CC); + } else { + GC_ZVAL_SET_ADDRESS(current->u.pz, NULL); + zval_collect_white(current->u.pz TSRMLS_CC); + } + + GC_REMOVE_FROM_BUFFER(current); + current = current->next; + } +} + +#define FREE_LIST_END ((zval_gc_info*)(~(zend_uintptr_t)GC_COLOR)) + +ZEND_API int gc_collect_cycles(TSRMLS_D) +{ + int count = 0; + + if (GC_G(roots).next != &GC_G(roots)) { + zval_gc_info *p, *q, *orig_free_list, *orig_next_to_free; + + if (GC_G(gc_active)) { + return 0; + } + GC_G(gc_runs)++; + GC_G(zval_to_free) = FREE_LIST_END; + GC_G(gc_active) = 1; + gc_mark_roots(TSRMLS_C); + gc_scan_roots(TSRMLS_C); + gc_collect_roots(TSRMLS_C); + + orig_free_list = GC_G(free_list); + orig_next_to_free = GC_G(next_to_free); + p = GC_G(free_list) = GC_G(zval_to_free); + GC_G(zval_to_free) = NULL; + GC_G(gc_active) = 0; + + /* First call destructors */ + while (p != FREE_LIST_END) { + if (Z_TYPE(p->z) == IS_OBJECT) { + if (EG(objects_store).object_buckets && + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].valid && + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].bucket.obj.refcount <= 0 && + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].bucket.obj.dtor && + !EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].destructor_called) { + + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].destructor_called = 1; + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].bucket.obj.refcount++; + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].bucket.obj.dtor(EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].bucket.obj.object, Z_OBJ_HANDLE(p->z) TSRMLS_CC); + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].bucket.obj.refcount--; + } + } + count++; + p = p->u.next; + } + + /* Destroy zvals */ + p = GC_G(free_list); + while (p != FREE_LIST_END) { + GC_G(next_to_free) = p->u.next; + if (Z_TYPE(p->z) == IS_OBJECT) { + if (EG(objects_store).object_buckets && + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].valid && + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].bucket.obj.refcount <= 0) { + EG(objects_store).object_buckets[Z_OBJ_HANDLE(p->z)].bucket.obj.refcount = 1; + Z_TYPE(p->z) = IS_NULL; + zend_objects_store_del_ref_by_handle_ex(Z_OBJ_HANDLE(p->z), Z_OBJ_HT(p->z) TSRMLS_CC); + } + } else if (Z_TYPE(p->z) == IS_ARRAY) { + Z_TYPE(p->z) = IS_NULL; + zend_hash_destroy(Z_ARRVAL(p->z)); + FREE_HASHTABLE(Z_ARRVAL(p->z)); + } else { + zval_dtor(&p->z); + Z_TYPE(p->z) = IS_NULL; + } + p = GC_G(next_to_free); + } + + /* Free zvals */ + p = GC_G(free_list); + while (p != FREE_LIST_END) { + q = p->u.next; + FREE_ZVAL_EX(&p->z); + p = q; + } + GC_G(collected) += count; + GC_G(free_list) = orig_free_list; + GC_G(next_to_free) = orig_next_to_free; + } + + return count; +} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h new file mode 100644 index 000000000..d4a9b2bc9 --- /dev/null +++ b/Zend/zend_gc.h @@ -0,0 +1,245 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2009 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: David Wang | + | Dmitry Stogov | + +----------------------------------------------------------------------+ +*/ + +/* $Id: zend_gc.h,v 1.1.2.9 2009/01/02 20:45:41 felipe Exp $ */ + +#ifndef ZEND_GC_H +#define ZEND_GC_H + +#ifndef GC_BENCH +# define GC_BENCH 0 +#endif + +#if GC_BENCH +# define GC_BENCH_INC(counter) GC_G(counter)++ +# define GC_BENCH_DEC(counter) GC_G(counter)-- +# define GC_BENCH_PEAK(peak, counter) do { \ + if (GC_G(counter) > GC_G(peak)) { \ + GC_G(peak) = GC_G(counter); \ + } \ + } while (0) +#else +# define GC_BENCH_INC(counter) +# define GC_BENCH_DEC(counter) +# define GC_BENCH_PEAK(peak, counter) +#endif + +#define GC_COLOR 0x03 + +#define GC_BLACK 0x00 +#define GC_WHITE 0x01 +#define GC_GREY 0x02 +#define GC_PURPLE 0x03 + +#define GC_ADDRESS(v) \ + ((gc_root_buffer*)(((zend_uintptr_t)(v)) & ~GC_COLOR)) +#define GC_SET_ADDRESS(v, a) \ + (v) = ((gc_root_buffer*)((((zend_uintptr_t)(v)) & GC_COLOR) | ((zend_uintptr_t)(a)))) +#define GC_GET_COLOR(v) \ + (((zend_uintptr_t)(v)) & GC_COLOR) +#define GC_SET_COLOR(v, c) \ + (v) = ((gc_root_buffer*)((((zend_uintptr_t)(v)) & ~GC_COLOR) | (c))) +#define GC_SET_BLACK(v) \ + (v) = ((gc_root_buffer*)(((zend_uintptr_t)(v)) & ~GC_COLOR)) +#define GC_SET_PURPLE(v) \ + (v) = ((gc_root_buffer*)(((zend_uintptr_t)(v)) | GC_PURPLE)) + +#define GC_ZVAL_INIT(z) \ + ((zval_gc_info*)(z))->u.buffered = NULL +#define GC_ZVAL_ADDRESS(v) \ + GC_ADDRESS(((zval_gc_info*)(v))->u.buffered) +#define GC_ZVAL_SET_ADDRESS(v, a) \ + GC_SET_ADDRESS(((zval_gc_info*)(v))->u.buffered, (a)) +#define GC_ZVAL_GET_COLOR(v) \ + GC_GET_COLOR(((zval_gc_info*)(v))->u.buffered) +#define GC_ZVAL_SET_COLOR(v, c) \ + GC_SET_COLOR(((zval_gc_info*)(v))->u.buffered, (c)) +#define GC_ZVAL_SET_BLACK(v) \ + GC_SET_BLACK(((zval_gc_info*)(v))->u.buffered) +#define GC_ZVAL_SET_PURPLE(v) \ + GC_SET_PURPLE(((zval_gc_info*)(v))->u.buffered) + +#define GC_OBJ_INIT(z) \ + (z)->buffered = NULL + +typedef struct _gc_root_buffer { + struct _gc_root_buffer *prev; /* double-linked list */ + struct _gc_root_buffer *next; + zend_object_handle handle; /* must be 0 for zval */ + union { + zval *pz; + zend_object_handlers *handlers; + } u; +} gc_root_buffer; + +typedef struct _zval_gc_info { + zval z; + union { + gc_root_buffer *buffered; + struct _zval_gc_info *next; + } u; +} zval_gc_info; + +typedef struct _zend_gc_globals { + zend_bool gc_enabled; + zend_bool gc_active; + + gc_root_buffer *buf; /* preallocated arrays of buffers */ + gc_root_buffer roots; /* list of possible roots of cycles */ + gc_root_buffer *unused; /* list of unused buffers */ + gc_root_buffer *first_unused; /* pointer to first unused buffer */ + gc_root_buffer *last_unused; /* pointer to last unused buffer */ + + zval_gc_info *zval_to_free; /* temporaryt list of zvals to free */ + zval_gc_info *free_list; + zval_gc_info *next_to_free; + + zend_uint gc_runs; + zend_uint collected; + +#if GC_BENCH + zend_uint root_buf_length; + zend_uint root_buf_peak; + zend_uint zval_possible_root; + zend_uint zobj_possible_root; + zend_uint zval_buffered; + zend_uint zobj_buffered; + zend_uint zval_remove_from_buffer; + zend_uint zobj_remove_from_buffer; + zend_uint zval_marked_grey; + zend_uint zobj_marked_grey; +#endif + +} zend_gc_globals; + +#ifdef ZTS +BEGIN_EXTERN_C() +ZEND_API extern int gc_globals_id; +END_EXTERN_C() +#define GC_G(v) TSRMG(gc_globals_id, zend_gc_globals *, v) +#else +#define GC_G(v) (gc_globals.v) +extern ZEND_API zend_gc_globals gc_globals; +#endif + +BEGIN_EXTERN_C() +ZEND_API int gc_collect_cycles(TSRMLS_D); +ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC); +ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC); +ZEND_API void gc_remove_zval_from_buffer(zval *zv TSRMLS_DC); +ZEND_API void gc_globals_ctor(TSRMLS_D); +ZEND_API void gc_globals_dtor(TSRMLS_D); +ZEND_API void gc_init(TSRMLS_D); +ZEND_API void gc_reset(TSRMLS_D); +END_EXTERN_C() + +#define GC_ZVAL_CHECK_POSSIBLE_ROOT(z) \ + gc_zval_check_possible_root((z) TSRMLS_CC) + +#define GC_REMOVE_FROM_BUFFER(current) \ + gc_remove_from_buffer((current) TSRMLS_CC) + +#define GC_REMOVE_ZVAL_FROM_BUFFER(z) \ + if (GC_ADDRESS(((zval_gc_info*)z)->u.buffered)) { \ + gc_remove_zval_from_buffer(z TSRMLS_CC); \ + } + +#define GC_ZOBJ_CHECK_POSSIBLE_ROOT(zobject) \ + do { \ + if (EXPECTED(EG(objects_store).object_buckets != NULL) && \ + EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zobject)].valid) { \ + gc_zobj_possible_root(zobject TSRMLS_CC); \ + } \ + } while (0) + +#define GC_REMOVE_ZOBJ_FROM_BUFFER(obj) \ + do { \ + if (GC_ADDRESS((obj)->buffered) && !GC_G(gc_active)) { \ + GC_BENCH_INC(zobj_remove_from_buffer); \ + GC_REMOVE_FROM_BUFFER(GC_ADDRESS((obj)->buffered)); \ + (obj)->buffered = NULL; \ + } \ + } while (0) + +static zend_always_inline void gc_zval_check_possible_root(zval *z TSRMLS_DC) +{ + if (z->type == IS_ARRAY || z->type == IS_OBJECT) { + gc_zval_possible_root(z TSRMLS_CC); + } +} + +static zend_always_inline void gc_remove_from_buffer(gc_root_buffer *root TSRMLS_DC) +{ + root->next->prev = root->prev; + root->prev->next = root->next; + root->prev = GC_G(unused); + GC_G(unused) = root; + GC_BENCH_DEC(root_buf_length); +} + +#define ALLOC_PERMANENT_ZVAL(z) \ + do { \ + (z) = (zval*)malloc(sizeof(zval_gc_info)); \ + GC_ZVAL_INIT(z); \ + } while (0) + +/* The following macroses override macroses from zend_alloc.h */ +#undef ALLOC_ZVAL +#define ALLOC_ZVAL(z) \ + do { \ + (z) = (zval*)emalloc(sizeof(zval_gc_info)); \ + GC_ZVAL_INIT(z); \ + } while (0) + +#undef FREE_ZVAL +#define FREE_ZVAL(z) \ + do { \ + GC_REMOVE_ZVAL_FROM_BUFFER(z); \ + efree(z); \ + } while (0) + +#undef ALLOC_ZVAL_REL +#define ALLOC_ZVAL_REL(z) \ + do { \ + (z) = (zval*)emalloc_rel(sizeof(zval_gc_info)); \ + GC_ZVAL_INIT(z); \ + } while (0) + +#undef FREE_ZVAL_REL +#define FREE_ZVAL_REL(z) \ + do { \ + GC_REMOVE_ZVAL_FROM_BUFFER(z); \ + efree_rel(z); \ + } while (0) + +#define FREE_ZVAL_EX(z) \ + efree(z) + +#define FREE_ZVAL_REL_EX(z) \ + efree_rel(z) + +#endif /* ZEND_GC_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 79fa71b92..2fa423a0c 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_globals.h,v 1.141.2.3.2.9 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_globals.h,v 1.141.2.3.2.7.2.23 2009/03/18 10:18:09 dmitry Exp $ */ #ifndef ZEND_GLOBALS_H #define ZEND_GLOBALS_H @@ -59,11 +59,15 @@ END_EXTERN_C() /* excpt.h on Digital Unix 4.0 defines function_table */ #undef function_table +#define ZEND_EARLY_BINDING_COMPILE_TIME 0 +#define ZEND_EARLY_BINDING_DELAYED 1 +#define ZEND_EARLY_BINDING_DELAYED_ALL 2 typedef struct _zend_declarables { zval ticks; } zend_declarables; +typedef struct _zend_vm_stack *zend_vm_stack; struct _zend_compiler_globals { zend_stack bp_stack; @@ -84,7 +88,7 @@ struct _zend_compiler_globals { char *compiled_filename; int zend_lineno; - int comment_start_line; + char *heredoc; int heredoc_len; @@ -104,10 +108,6 @@ struct _zend_compiler_globals { zend_declarables declarables; - /* For extensions support */ - zend_bool extended_info; /* generate extension information for debugger/profiler */ - zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */ - zend_bool unclean_shutdown; zend_bool ini_parser_unbuffered_errors; @@ -130,10 +130,21 @@ struct _zend_compiler_globals { char *doc_comment; zend_uint doc_comment_len; + zend_uint compiler_options; /* set of ZEND_COMPILE_* constants */ + + zval *current_namespace; + HashTable *current_import; + zend_bool in_namespace; + zend_bool has_bracketed_namespaces; + + HashTable *labels; + zend_stack labels_stack; + #ifdef ZEND_MULTIBYTE zend_encoding **script_encoding_list; - int script_encoding_list_size; + size_t script_encoding_list_size; zend_bool detect_unicode; + zend_bool encoding_declared; zend_encoding *internal_encoding; @@ -159,7 +170,6 @@ struct _zend_executor_globals { zval error_zval; zval *error_zval_ptr; - zend_function_state *function_state_ptr; zend_ptr_stack arg_types_stack; /* symbol table cache */ @@ -174,7 +184,7 @@ struct _zend_executor_globals { HashTable included_files; /* files already included */ - jmp_buf *bailout; + JMP_BUF *bailout; int error_reporting; int orig_error_reporting; @@ -187,6 +197,7 @@ struct _zend_executor_globals { HashTable *zend_constants; /* constants table */ zend_class_entry *scope; + zend_class_entry *called_scope; /* Scope of the calling class */ zval *This; @@ -198,19 +209,19 @@ struct _zend_executor_globals { HashTable *in_autoload; zend_function *autoload_func; zend_bool full_tables_cleanup; - zend_bool ze1_compatibility_mode; /* for extended information support */ zend_bool no_extensions; #ifdef ZEND_WIN32 zend_bool timed_out; + OSVERSIONINFOEX windows_version_info; #endif HashTable regular_list; HashTable persistent_list; - zend_ptr_stack argument_stack; + zend_vm_stack argument_stack; int user_error_handler_error_reporting; zval *user_error_handler; @@ -219,6 +230,9 @@ struct _zend_executor_globals { zend_ptr_stack user_error_handlers; zend_ptr_stack user_exception_handlers; + zend_error_handling_t error_handling; + zend_class_entry *exception_class; + /* timeout support */ int timeout_seconds; @@ -228,8 +242,9 @@ struct _zend_executor_globals { HashTable *modified_ini_directives; zend_objects_store objects_store; - zval *exception; + zval *exception, *prev_exception; zend_op *opline_before_exception; + zend_op exception_op[3]; struct _zend_execute_data *current_execute_data; @@ -239,40 +254,54 @@ struct _zend_executor_globals { zend_bool active; + void *saved_fpu_cw; + void *reserved[ZEND_MAX_RESERVED_RESOURCES]; }; -struct _zend_scanner_globals { +struct _zend_ini_scanner_globals { zend_file_handle *yy_in; zend_file_handle *yy_out; - int yy_leng; - char *yy_text; - struct yy_buffer_state *current_buffer; - char *c_buf_p; - int init; - int start; + + unsigned int yy_leng; + unsigned char *yy_start; + unsigned char *yy_text; + unsigned char *yy_cursor; + unsigned char *yy_marker; + unsigned char *yy_limit; + int yy_state; + zend_stack state_stack; + + char *filename; int lineno; - char _yy_hold_char; - int yy_n_chars; - int _yy_did_buffer_switch_on_eof; - int _yy_last_accepting_state; /* Must be of the same type as yy_state_type, - * if for whatever reason it's no longer int! - */ - char *_yy_last_accepting_cpos; - int _yy_more_flag; - int _yy_more_len; - int yy_start_stack_ptr; - int yy_start_stack_depth; - int *yy_start_stack; + + /* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */ + int scanner_mode; +}; + +struct _zend_php_scanner_globals { + zend_file_handle *yy_in; + zend_file_handle *yy_out; + + unsigned int yy_leng; + unsigned char *yy_start; + unsigned char *yy_text; + unsigned char *yy_cursor; + unsigned char *yy_marker; + unsigned char *yy_limit; + int yy_state; + zend_stack state_stack; + + zend_llist used_state_stacks; #ifdef ZEND_MULTIBYTE /* original (unfiltered) script */ - char *script_org; - int script_org_size; + unsigned char *script_org; + size_t script_org_size; /* filtered script */ - char *script_filtered; - int script_filtered_size; + unsigned char *script_filtered; + size_t script_filtered_size; /* input/ouput filters */ zend_encoding_filter input_filter; diff --git a/Zend/zend_globals_macros.h b/Zend/zend_globals_macros.h index 52d3f926b..0a3705dc2 100644 --- a/Zend/zend_globals_macros.h +++ b/Zend/zend_globals_macros.h @@ -17,14 +17,15 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_globals_macros.h,v 1.22.2.1.2.6 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_globals_macros.h,v 1.22.2.1.2.4.2.3 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_GLOBALS_MACROS_H #define ZEND_GLOBALS_MACROS_H typedef struct _zend_compiler_globals zend_compiler_globals; typedef struct _zend_executor_globals zend_executor_globals; -typedef struct _zend_scanner_globals zend_scanner_globals; +typedef struct _zend_php_scanner_globals zend_php_scanner_globals; +typedef struct _zend_ini_scanner_globals zend_ini_scanner_globals; BEGIN_EXTERN_C() @@ -49,21 +50,21 @@ extern ZEND_API zend_executor_globals executor_globals; /* Language Scanner */ #ifdef ZTS -# define LANG_SCNG(v) TSRMG(language_scanner_globals_id, zend_scanner_globals *, v) +# define LANG_SCNG(v) TSRMG(language_scanner_globals_id, zend_php_scanner_globals *, v) extern ZEND_API ts_rsrc_id language_scanner_globals_id; #else # define LANG_SCNG(v) (language_scanner_globals.v) -extern ZEND_API zend_scanner_globals language_scanner_globals; +extern ZEND_API zend_php_scanner_globals language_scanner_globals; #endif /* INI Scanner */ #ifdef ZTS -# define INI_SCNG(v) TSRMG(ini_scanner_globals_id, zend_scanner_globals *, v) +# define INI_SCNG(v) TSRMG(ini_scanner_globals_id, zend_ini_scanner_globals *, v) extern ZEND_API ts_rsrc_id ini_scanner_globals_id; #else # define INI_SCNG(v) (ini_scanner_globals.v) -extern ZEND_API zend_scanner_globals ini_scanner_globals; +extern ZEND_API zend_ini_scanner_globals ini_scanner_globals; #endif END_EXTERN_C() diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 887a7545e..5a7a389a9 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.c,v 1.121.2.4.2.10 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_hash.c,v 1.121.2.4.2.8.2.8 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" @@ -48,7 +48,7 @@ #define HT_DESTROYED 2 #define HT_CLEANING 3 -static void _zend_is_inconsistent(HashTable *ht, char *file, int line) +static void _zend_is_inconsistent(const HashTable *ht, const char *file, int line) { if (ht->inconsistent==HT_OK) { return; @@ -94,7 +94,7 @@ static void _zend_is_inconsistent(HashTable *ht, char *file, int line) static int zend_hash_do_resize(HashTable *ht); -ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength) +ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength) { return zend_inline_hash_func(arKey, nKeyLength); } @@ -197,7 +197,7 @@ ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProt -ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { ulong h; uint nIndex; @@ -267,7 +267,7 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLengt return SUCCESS; } -ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { uint nIndex; Bucket *p; @@ -336,7 +336,7 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKe } -ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength) { void *dummy = (void *) 1; @@ -452,7 +452,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht) return SUCCESS; } -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) +ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag) { uint nIndex; Bucket *p; @@ -709,7 +709,7 @@ ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t appl } -ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int num_args, ...) +ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func_args_t apply_func, int num_args, ...) { Bucket *p; va_list args; @@ -726,7 +726,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t ap hash_key.arKey = p->arKey; hash_key.nKeyLength = p->nKeyLength; hash_key.h = p->h; - result = apply_func(p->pData, num_args, args, &hash_key); + result = apply_func(p->pData TSRMLS_CC, num_args, args, &hash_key); if (result & ZEND_HASH_APPLY_REMOVE) { p = zend_hash_apply_deleter(ht, p); @@ -856,7 +856,7 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor } -ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength) +ZEND_API ulong zend_get_hash_value(const char *arKey, uint nKeyLength) { return zend_inline_hash_func(arKey, nKeyLength); } @@ -866,7 +866,7 @@ ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength) * data is returned in pData. The reason is that there's no reason * someone using the hash table might not want to have NULL data */ -ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData) { ulong h; uint nIndex; @@ -891,7 +891,7 @@ ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void ** } -ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) +ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData) { uint nIndex; Bucket *p; @@ -918,7 +918,7 @@ ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, u } -ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength) { ulong h; uint nIndex; @@ -942,7 +942,7 @@ ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) } -ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h) +ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h) { uint nIndex; Bucket *p; @@ -969,7 +969,7 @@ ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, } -ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData) +ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData) { uint nIndex; Bucket *p; @@ -990,7 +990,7 @@ ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData) } -ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h) +ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h) { uint nIndex; Bucket *p; @@ -1010,7 +1010,7 @@ ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h) } -ZEND_API int zend_hash_num_elements(HashTable *ht) +ZEND_API int zend_hash_num_elements(const HashTable *ht) { IS_CONSISTENT(ht); @@ -1018,7 +1018,7 @@ ZEND_API int zend_hash_num_elements(HashTable *ht) } -ZEND_API int zend_hash_get_pointer(HashTable *ht, HashPointer *ptr) +ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr) { ptr->pos = ht->pInternalPointer; if (ht->pInternalPointer) { @@ -1104,7 +1104,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) /* This function should be made binary safe */ -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) +ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) { Bucket *p; @@ -1170,7 +1170,7 @@ ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosi /* This function changes key of currevt element without changing elements' * order. If element with target key already exists, it will be deleted first. */ -ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char *str_index, uint str_length, ulong num_index, HashPosition *pos) +ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos) { Bucket *p; @@ -1184,12 +1184,88 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char * if (!p->nKeyLength && p->h == num_index) { return SUCCESS; } + + if (mode != HASH_UPDATE_KEY_ANYWAY) { + Bucket *q = ht->arBuckets[num_index & ht->nTableMask]; + int found = 0; + + while (q != NULL) { + if (q == p) { + found = 1; + } else if (!q->nKeyLength && q->h == num_index) { + if (found) { + if (mode & HASH_UPDATE_KEY_IF_BEFORE) { + break; + } else { + if (p->nKeyLength) { + zend_hash_del(ht, p->arKey, p->nKeyLength); + } else { + zend_hash_index_del(ht, p->h); + } + return FAILURE; + } + } else { + if (mode & HASH_UPDATE_KEY_IF_AFTER) { + break; + } else { + if (p->nKeyLength) { + zend_hash_del(ht, p->arKey, p->nKeyLength); + } else { + zend_hash_index_del(ht, p->h); + } + return FAILURE; + } + } + } + q = q->pNext; + } + } + zend_hash_index_del(ht, num_index); } else if (key_type == HASH_KEY_IS_STRING) { if (p->nKeyLength == str_length && memcmp(p->arKey, str_index, str_length) == 0) { return SUCCESS; } + + if (mode != HASH_UPDATE_KEY_ANYWAY) { + ulong h = zend_inline_hash_func(str_index, str_length); + Bucket *q = ht->arBuckets[h & ht->nTableMask]; + int found = 0; + + while (q != NULL) { + if (q == p) { + found = 1; + } else if (q->h == h && q->nKeyLength == str_length && + memcmp(q->arKey, str_index, str_length) == 0) { + if (found) { + if (mode & HASH_UPDATE_KEY_IF_BEFORE) { + break; + } else { + if (p->nKeyLength) { + zend_hash_del(ht, p->arKey, p->nKeyLength); + } else { + zend_hash_index_del(ht, p->h); + } + return FAILURE; + } + } else { + if (mode & HASH_UPDATE_KEY_IF_AFTER) { + break; + } else { + if (p->nKeyLength) { + zend_hash_del(ht, p->arKey, p->nKeyLength); + } else { + zend_hash_index_del(ht, p->h); + } + return FAILURE; + } + } + } + q = q->pNext; + } + } + zend_hash_del(ht, str_index, str_length); } else { return FAILURE; @@ -1404,7 +1480,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co } -ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC) +ZEND_API int zend_hash_minmax(const HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC) { Bucket *p, *res; @@ -1431,7 +1507,7 @@ ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, vo return SUCCESS; } -ZEND_API ulong zend_hash_next_free_element(HashTable *ht) +ZEND_API ulong zend_hash_next_free_element(const HashTable *ht) { IS_CONSISTENT(ht); @@ -1441,7 +1517,7 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht) #if ZEND_DEBUG -void zend_hash_display_pListTail(HashTable *ht) +void zend_hash_display_pListTail(const HashTable *ht) { Bucket *p; @@ -1452,7 +1528,7 @@ void zend_hash_display_pListTail(HashTable *ht) } } -void zend_hash_display(HashTable *ht) +void zend_hash_display(const HashTable *ht) { Bucket *p; uint i; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 0f991eb5e..90b4535b2 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.h,v 1.78.2.2.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_hash.h,v 1.78.2.2.2.2.2.11 2009/03/19 15:16:10 dmitry Exp $ */ #ifndef ZEND_HASH_H #define ZEND_HASH_H @@ -35,8 +35,14 @@ #define HASH_DEL_KEY 0 #define HASH_DEL_INDEX 1 +#define HASH_DEL_KEY_QUICK 2 -typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength); +#define HASH_UPDATE_KEY_IF_NONE 0 +#define HASH_UPDATE_KEY_IF_BEFORE 1 +#define HASH_UPDATE_KEY_IF_AFTER 2 +#define HASH_UPDATE_KEY_ANYWAY 3 + +typedef ulong (*hash_func_t)(const char *arKey, uint nKeyLength); typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC); typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC); typedef void (*dtor_func_t)(void *pDest); @@ -98,13 +104,13 @@ ZEND_API void zend_hash_clean(HashTable *ht); #define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pHashFunction), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC) /* additions/updates/changes */ -ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); +ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); #define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC) #define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC) -ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); +ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); #define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ _zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC) #define zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ @@ -116,23 +122,22 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void #define zend_hash_next_index_insert(ht, pData, nDataSize, pDest) \ _zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT ZEND_FILE_LINE_CC) -ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength); +ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength); #define ZEND_HASH_APPLY_KEEP 0 #define ZEND_HASH_APPLY_REMOVE 1<<0 #define ZEND_HASH_APPLY_STOP 1<<1 - typedef int (*apply_func_t)(void *pDest TSRMLS_DC); typedef int (*apply_func_arg_t)(void *pDest, void *argument TSRMLS_DC); -typedef int (*apply_func_args_t)(void *pDest, int num_args, va_list args, zend_hash_key *hash_key); +typedef int (*apply_func_args_t)(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); ZEND_API void zend_hash_graceful_destroy(HashTable *ht); ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht); ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC); ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC); -ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int, ...); +ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func_args_t apply_func, int, ...); /* This function should be used with special care (in other words, * it should usually not be used). When used with the ZEND_HASH_APPLY_STOP @@ -144,24 +149,26 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR /* Deletes */ -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag); +ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag); #define zend_hash_del(ht, arKey, nKeyLength) \ zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY) +#define zend_hash_quick_del(ht, arKey, nKeyLength, h) \ + zend_hash_del_key_or_index(ht, arKey, nKeyLength, h, HASH_DEL_KEY_QUICK) #define zend_hash_index_del(ht, h) \ zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX) -ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength); +ZEND_API ulong zend_get_hash_value(const char *arKey, uint nKeyLength); /* Data retreival */ -ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData); -ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData); -ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData); +ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData); +ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData); +ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData); /* Misc */ -ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength); -ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h); -ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h); -ZEND_API ulong zend_hash_next_free_element(HashTable *ht); +ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength); +ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h); +ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h); +ZEND_API ulong zend_hash_next_free_element(const HashTable *ht); /* traversing */ @@ -169,19 +176,19 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht); (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTANT ? FAILURE : SUCCESS) ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos); +ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos); ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char *str_index, uint str_length, ulong num_index, HashPosition *pos); +ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos); typedef struct _HashPointer { HashPosition pos; ulong h; } HashPointer; -ZEND_API int zend_hash_get_pointer(HashTable *ht, HashPointer *ptr); +ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr); ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr); #define zend_hash_has_more_elements(ht) \ @@ -201,7 +208,7 @@ ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr); #define zend_hash_internal_pointer_end(ht) \ zend_hash_internal_pointer_end_ex(ht, NULL) #define zend_hash_update_current_key(ht, key_type, str_index, str_length, num_index) \ - zend_hash_update_current_key_ex(ht, key_type, str_index, str_length, num_index, NULL) + zend_hash_update_current_key_ex(ht, key_type, str_index, str_length, num_index, HASH_UPDATE_KEY_ANYWAY, NULL) /* Copying, merging and sorting */ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size); @@ -209,12 +216,12 @@ ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_f ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam); ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC); ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC); -ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC); +ZEND_API int zend_hash_minmax(const HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC); #define zend_hash_merge(target, source, pCopyConstructor, tmp, size, overwrite) \ _zend_hash_merge(target, source, pCopyConstructor, tmp, size, overwrite ZEND_FILE_LINE_CC) -ZEND_API int zend_hash_num_elements(HashTable *ht); +ZEND_API int zend_hash_num_elements(const HashTable *ht); ZEND_API int zend_hash_rehash(HashTable *ht); @@ -251,7 +258,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht); * -- Ralf S. Engelschall */ -static inline ulong zend_inline_hash_func(char *arKey, uint nKeyLength) +static inline ulong zend_inline_hash_func(const char *arKey, uint nKeyLength) { register ulong hash = 5381; @@ -281,12 +288,12 @@ EMPTY_SWITCH_DEFAULT_CASE() } -ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength); +ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength); #if ZEND_DEBUG /* debug */ -void zend_hash_display_pListTail(HashTable *ht); -void zend_hash_display(HashTable *ht); +void zend_hash_display_pListTail(const HashTable *ht); +void zend_hash_display(const HashTable *ht); #endif END_EXTERN_C() @@ -297,74 +304,91 @@ END_EXTERN_C() #define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \ zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent) - -#define HANDLE_NUMERIC(key, length, func) { \ - register char *tmp=key; \ - \ - if (*tmp=='-') { \ - tmp++; \ - } \ - if ((*tmp>='0' && *tmp<='9')) do { /* possibly a numeric index */ \ - char *end=key+length-1; \ - long idx; \ - \ - if (*tmp++=='0' && length>2) { /* don't accept numbers with leading zeros */ \ - break; \ - } \ - while (tmp='0' && *tmp<='9')) { \ - break; \ - } \ - tmp++; \ - } \ - if (tmp==end && *tmp=='\0') { /* a numeric index */ \ - if (*key=='-') { \ - idx = strtol(key, NULL, 10); \ - if (idx!=LONG_MIN) { \ - return func; \ - } \ - } else { \ - idx = strtol(key, NULL, 10); \ - if (idx!=LONG_MAX) { \ - return func; \ - } \ - } \ - } \ - } while (0); \ -} - - -static inline int zend_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) \ +#define ZEND_HANDLE_NUMERIC(key, length, func) do { \ + register const char *tmp = key; \ + \ + if (*tmp == '-') { \ + tmp++; \ + } \ + if (*tmp >= '0' && *tmp <= '9') { /* possibly a numeric index */ \ + const char *end = key + length - 1; \ + long idx; \ + \ + if (*end != '\0') { /* not a null terminated string */ \ + break; \ + } else if (*tmp == '0') { \ + if (end - tmp != 1) { \ + /* don't accept numbers with leading zeros */ \ + break; \ + } \ + idx = 0; \ + } else if (end - tmp > MAX_LENGTH_OF_LONG - 1) { \ + /* don't accept too long strings */ \ + break; \ + } else { \ + if (end - tmp == MAX_LENGTH_OF_LONG - 1) { \ + end--; /* check overflow in last digit later */ \ + } \ + idx = (*tmp++ - '0'); \ + while (tmp != end && *tmp >= '0' && *tmp <= '9') { \ + idx = (idx * 10) + (*tmp++ - '0'); \ + } \ + if (tmp != end) { \ + break; \ + } \ + if (end != key + length - 1) { \ + /* last digit can cause overflow */ \ + if (*tmp < '0' || *tmp > '9' || idx > LONG_MAX / 10) { \ + break; \ + } \ + idx = (idx * 10) + (*tmp - '0'); \ + if (*key == '-') { \ + idx = -idx; \ + if (idx > 0) { /* overflow */ \ + break; \ + } \ + } else if (idx < 0) { /* overflow */ \ + break; \ + } \ + } else if (*key == '-') { \ + idx = -idx; \ + } \ + } \ + return func; \ + } \ +} while (0) + +static inline int zend_symtable_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) \ { - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); + ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); return zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest); } -static inline int zend_symtable_del(HashTable *ht, char *arKey, uint nKeyLength) +static inline int zend_symtable_del(HashTable *ht, const char *arKey, uint nKeyLength) { - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx)) + ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx)); return zend_hash_del(ht, arKey, nKeyLength); } -static inline int zend_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +static inline int zend_symtable_find(HashTable *ht, const char *arKey, uint nKeyLength, void **pData) { - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); + ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); return zend_hash_find(ht, arKey, nKeyLength, pData); } -static inline int zend_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength) +static inline int zend_symtable_exists(HashTable *ht, const char *arKey, uint nKeyLength) { - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); + ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); return zend_hash_exists(ht, arKey, nKeyLength); } -static inline int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength) +static inline int zend_symtable_update_current_key(HashTable *ht, const char *arKey, uint nKeyLength, int mode) { - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL, 0, idx)); - return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, arKey, nKeyLength, 0); + ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_LONG, NULL, 0, idx, mode, NULL)); + return zend_hash_update_current_key_ex(ht, HASH_KEY_IS_STRING, arKey, nKeyLength, 0, mode, NULL); } #endif /* ZEND_HASH_H */ diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index a2fe8b623..83b2d1381 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_highlight.c,v 1.49.2.3.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_highlight.c,v 1.49.2.3.2.2.2.6 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" #include @@ -68,7 +68,7 @@ ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) end = filtered + filtered_len; } #endif /* ZEND_MULTIBYTE */ - + while (ptrhighlight_html; char *next_color; - int in_string=0; zend_printf(""); zend_printf("\n", last_color); @@ -116,22 +114,18 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini case T_CLOSE_TAG: next_color = syntax_highlighter_ini->highlight_default; break; + case '"': + case T_ENCAPSED_AND_WHITESPACE: case T_CONSTANT_ENCAPSED_STRING: next_color = syntax_highlighter_ini->highlight_string; break; - case '"': - next_color = syntax_highlighter_ini->highlight_string; - in_string = !in_string; - break; case T_WHITESPACE: zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); /* no color needed */ token.type = 0; continue; break; default: - if (in_string) { - next_color = syntax_highlighter_ini->highlight_string; - } else if (token.type == 0) { + if (token.type == 0) { next_color = syntax_highlighter_ini->highlight_keyword; } else { next_color = syntax_highlighter_ini->highlight_default; @@ -159,8 +153,6 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini if (token.type == IS_STRING) { switch (token_type) { - case EOF: - goto done; case T_OPEN_TAG: case T_OPEN_TAG_WITH_ECHO: case T_CLOSE_TAG: @@ -179,7 +171,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini } /* handler for trailing comments, see bug #42767 */ - if (LANG_SCNG(yy_leng) && LANG_SCNG(_yy_more_len)) { + if (LANG_SCNG(yy_leng) && LANG_SCNG(yy_text) < LANG_SCNG(yy_limit)) { if (last_color != syntax_highlighter_ini->highlight_comment) { if (last_color != syntax_highlighter_ini->highlight_html) { zend_printf(""); @@ -188,9 +180,9 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini zend_printf("", syntax_highlighter_ini->highlight_comment); } } - zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(_yy_more_len) TSRMLS_CC); + zend_html_puts(LANG_SCNG(yy_text), (LANG_SCNG(yy_limit) - LANG_SCNG(yy_text)) TSRMLS_CC); } -done: + if (last_color != syntax_highlighter_ini->highlight_html) { zend_printf("\n"); } @@ -217,9 +209,6 @@ ZEND_API void zend_strip(TSRMLS_D) case T_DOC_COMMENT: token.type = 0; continue; - - case EOF: - return; case T_END_HEREDOC: zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng)); diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index 3c26e3b53..7b00895df 100644 --- a/Zend/zend_highlight.h +++ b/Zend/zend_highlight.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_highlight.h,v 1.25.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_highlight.h,v 1.25.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_HIGHLIGHT_H #define ZEND_HIGHLIGHT_H diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c index 79ec45a0e..9f5c33c0e 100644 --- a/Zend/zend_indent.c +++ b/Zend/zend_indent.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_indent.c,v 1.24.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_indent.c,v 1.24.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ /* This indenter doesn't really work, it's here for no particular reason. */ diff --git a/Zend/zend_indent.h b/Zend/zend_indent.h index b4fa1fe7f..76069e4cd 100644 --- a/Zend/zend_indent.h +++ b/Zend/zend_indent.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_indent.h,v 1.17.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_indent.h,v 1.17.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_INDENT_H #define ZEND_INDENT_H diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 4e8e22bef..6147abf8f 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.39.2.2.2.28 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_ini.c,v 1.39.2.2.2.18.2.18 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" #include "zend_qsort.h" @@ -60,12 +60,11 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS } ini_entry->value = ini_entry->orig_value; ini_entry->value_length = ini_entry->orig_value_length; + ini_entry->modifiable = ini_entry->orig_modifiable; ini_entry->modified = 0; ini_entry->orig_value = NULL; ini_entry->orig_value_length = 0; - if (ini_entry->modifiable >= (1 << 3)) { - ini_entry->modifiable >>= 3; - } + ini_entry->orig_modifiable = 0; } return 0; } @@ -167,9 +166,9 @@ ZEND_API void zend_ini_sort_entries(TSRMLS_D) /* {{{ */ /* * Registration / unregistration */ -ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC) /* {{{ */ +ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC) /* {{{ */ { - zend_ini_entry *p = ini_entry; + const zend_ini_entry *p = ini_entry; zend_ini_entry *hashed_ini_entry; zval default_value; HashTable *directives = registered_zend_ini_directives; @@ -190,12 +189,12 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num #endif while (p->name) { - p->module_number = module_number; config_directive_success = 0; - if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry) == FAILURE) { + if (zend_hash_add(directives, p->name, p->name_length, (void*)p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry) == FAILURE) { zend_unregister_ini_entries(module_number TSRMLS_CC); return FAILURE; } + hashed_ini_entry->module_number = module_number; if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) { if (!hashed_ini_entry->on_modify || hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRLEN(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) { @@ -239,17 +238,18 @@ ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) /* {{{ */ { - return zend_alter_ini_entry_ex(name, name_length, new_value, new_value_length, modify_type, stage, 0); + TSRMLS_FETCH(); + + return zend_alter_ini_entry_ex(name, name_length, new_value, new_value_length, modify_type, stage, 0 TSRMLS_CC); } /* }}} */ -ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change) /* {{{ */ +ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */ { zend_ini_entry *ini_entry; char *duplicate; zend_bool modifiable; zend_bool modified; - TSRMLS_FETCH(); if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == FAILURE) { return FAILURE; @@ -259,8 +259,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val modified = ini_entry->modified; if (stage == ZEND_INI_STAGE_ACTIVATE && modify_type == ZEND_INI_SYSTEM) { - /* only touch lower bits */ - ini_entry->modifiable = (ini_entry->modifiable & (ZEND_INI_ALL << 3)) | ZEND_INI_SYSTEM; + ini_entry->modifiable = ZEND_INI_SYSTEM; } if (!force_change) { @@ -276,8 +275,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val if (!modified) { ini_entry->orig_value = ini_entry->value; ini_entry->orig_value_length = ini_entry->value_length; - /* store orginial value in the upper bits */ - ini_entry->modifiable = (modifiable << 3) | ini_entry->modifiable; + ini_entry->orig_modifiable = modifiable; ini_entry->modified = 1; zend_hash_add(EG(modified_ini_directives), name, name_length, &ini_entry, sizeof(zend_ini_entry*), NULL); } @@ -293,6 +291,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val ini_entry->value_length = new_value_length; } else { efree(duplicate); + return FAILURE; } return SUCCESS; @@ -343,8 +342,8 @@ ZEND_API long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */ if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) { if (orig && ini_entry->modified) { return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0); - } else if (ini_entry->value) { - return strtol(ini_entry->value, NULL, 0); + } else { + return (ini_entry->value ? strtol(ini_entry->value, NULL, 0) : 0); } } @@ -360,8 +359,8 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ * if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) { if (orig && ini_entry->modified) { return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value, NULL) : 0.0); - } else if (ini_entry->value) { - return (double) zend_strtod(ini_entry->value, NULL); + } else { + return (double) (ini_entry->value ? zend_strtod(ini_entry->value, NULL) : 0.0); } } @@ -369,20 +368,42 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ * } /* }}} */ -ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */ +ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) { + if (exists) { + *exists = 1; + } + if (orig && ini_entry->modified) { return ini_entry->orig_value; } else { return ini_entry->value; } + } else { + if (exists) { + *exists = 0; + } + return NULL; } +} +/* }}} */ - return ""; +ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */ +{ + zend_bool exists = 1; + char *return_value; + + return_value = zend_ini_string_ex(name, name_length, orig, &exists); + if (!exists) { + return NULL; + } else if (!return_value) { + return_value = ""; + } + return return_value; } /* }}} */ @@ -556,12 +577,12 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */ p = (long *) (base+(size_t) mh_arg1); - *p = zend_atoi(new_value, new_value_length); + *p = zend_atol(new_value, new_value_length); return SUCCESS; } /* }}} */ -ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) +ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */ { long *p, tmp; #ifndef ZTS @@ -572,7 +593,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) base = (char *) ts_resource(*((int *) mh_arg2)); #endif - tmp = zend_atoi(new_value, new_value_length); + tmp = zend_atol(new_value, new_value_length); if (tmp < 0) { return FAILURE; } diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index 40e7569d5..23e89da39 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.h,v 1.34.2.1.2.8 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_ini.h,v 1.34.2.1.2.6.2.7 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_INI_H #define ZEND_INI_H @@ -77,6 +77,7 @@ struct _zend_ini_entry { char *orig_value; uint orig_value_length; + int orig_modifiable; int modified; void (*displayer)(zend_ini_entry *ini_entry, int type); @@ -92,17 +93,18 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D); ZEND_API void zend_ini_sort_entries(TSRMLS_D); -ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC); +ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC); ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC); ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC); ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage); -ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change); +ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC); ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage); ZEND_API void display_ini_entries(zend_module_entry *module); ZEND_API long zend_ini_long(char *name, uint name_length, int orig); ZEND_API double zend_ini_double(char *name, uint name_length, int orig); ZEND_API char *zend_ini_string(char *name, uint name_length, int orig); +ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists); ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); @@ -111,11 +113,11 @@ ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb); ZEND_API ZEND_INI_DISP(display_link_numbers); END_EXTERN_C() -#define ZEND_INI_BEGIN() static zend_ini_entry ini_entries[] = { -#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } }; +#define ZEND_INI_BEGIN() static const zend_ini_entry ini_entries[] = { +#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 0, NULL } }; #define ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, displayer) \ - { 0, modifiable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer }, + { 0, modifiable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, 0, displayer }, #define ZEND_INI_ENTRY3(name, default_value, modifiable, on_modify, arg1, arg2, arg3) \ ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, NULL) @@ -156,7 +158,7 @@ END_EXTERN_C() #define INI_INT(name) zend_ini_long((name), sizeof(name), 0) #define INI_FLT(name) zend_ini_double((name), sizeof(name), 0) -#define INI_STR(name) zend_ini_string((name), sizeof(name), 0) +#define INI_STR(name) zend_ini_string_ex((name), sizeof(name), 0, NULL) #define INI_BOOL(name) ((zend_bool) INI_INT(name)) #define INI_ORIG_INT(name) zend_ini_long((name), sizeof(name), 1) @@ -164,7 +166,6 @@ END_EXTERN_C() #define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name), 1) #define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name)) - #define REGISTER_INI_ENTRIES() zend_register_ini_entries(ini_entries, module_number TSRMLS_CC) #define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries(module_number TSRMLS_CC) #define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module) @@ -193,15 +194,16 @@ END_EXTERN_C() #define ZEND_INI_STAGE_HTACCESS (1<<5) /* INI parsing engine */ -typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg); +typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC); BEGIN_EXTERN_C() -ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg); -ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg); +ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC); +ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC); END_EXTERN_C() -#define ZEND_INI_PARSER_ENTRY 1 -#define ZEND_INI_PARSER_SECTION 2 -#define ZEND_INI_PARSER_POP_ENTRY 3 +/* INI entries */ +#define ZEND_INI_PARSER_ENTRY 1 /* Normal entry: foo = bar */ +#define ZEND_INI_PARSER_SECTION 2 /* Section: [foobar] */ +#define ZEND_INI_PARSER_POP_ENTRY 3 /* Offset entry: foo[] = bar */ typedef struct _zend_ini_parser_param { zend_ini_parser_cb_t ini_parser_cb; diff --git a/Zend/zend_ini_parser.c b/Zend/zend_ini_parser.c index cef2d6acc..75a6a86d3 100644 --- a/Zend/zend_ini_parser.c +++ b/Zend/zend_ini_parser.c @@ -74,23 +74,37 @@ /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { - TC_STRING = 258, - TC_ENCAPSULATED_STRING = 259, - BRACK = 260, - SECTION = 261, - CFG_TRUE = 262, - CFG_FALSE = 263, - TC_DOLLAR_CURLY = 264 + TC_SECTION = 258, + TC_RAW = 259, + TC_CONSTANT = 260, + TC_NUMBER = 261, + TC_STRING = 262, + TC_WHITESPACE = 263, + TC_LABEL = 264, + TC_OFFSET = 265, + TC_DOLLAR_CURLY = 266, + TC_VARNAME = 267, + TC_QUOTED_STRING = 268, + BOOL_TRUE = 269, + BOOL_FALSE = 270, + END_OF_LINE = 271 }; #endif /* Tokens. */ -#define TC_STRING 258 -#define TC_ENCAPSULATED_STRING 259 -#define BRACK 260 -#define SECTION 261 -#define CFG_TRUE 262 -#define CFG_FALSE 263 -#define TC_DOLLAR_CURLY 264 +#define TC_SECTION 258 +#define TC_RAW 259 +#define TC_CONSTANT 260 +#define TC_NUMBER 261 +#define TC_STRING 262 +#define TC_WHITESPACE 263 +#define TC_LABEL 264 +#define TC_OFFSET 265 +#define TC_DOLLAR_CURLY 266 +#define TC_VARNAME 267 +#define TC_QUOTED_STRING 268 +#define BOOL_TRUE 269 +#define BOOL_FALSE 270 +#define END_OF_LINE 271 @@ -112,13 +126,15 @@ | obtain it through the world-wide-web, please send a note to | | license@zend.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Zeev Suraski | + | Authors: Zeev Suraski | + | Jani Taskinen | +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_parser.y,v 1.41.2.2.2.4 2008/12/31 11:16:12 sebastian Exp $ */ +/* $Id: zend_ini_parser.y,v 1.41.2.2.2.2.2.6 2008/12/31 11:13:47 sebastian Exp $ */ #define DEBUG_CFG_PARSER 0 + #include "zend.h" #include "zend_API.h" #include "zend_ini.h" @@ -126,32 +142,23 @@ #include "zend_ini_scanner.h" #include "zend_extensions.h" +#define YYERROR_VERBOSE #define YYSTYPE zval #ifdef ZTS #define YYPARSE_PARAM tsrm_ls #define YYLEX_PARAM tsrm_ls -#endif - -#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb -#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg - -int ini_lex(zval *ini_lval TSRMLS_DC); -#ifdef ZTS int ini_parse(void *arg); #else int ini_parse(void); #endif -zval yylval; - -#ifndef ZTS -extern int ini_lex(zval *ini_lval TSRMLS_DC); -extern FILE *ini_in; -extern void init_cfg_scanner(void); -#endif +#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb +#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg -void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) +/* {{{ zend_ini_do_op() +*/ +static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) { int i_result; int i_op1, i_op2; @@ -190,16 +197,22 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0; Z_TYPE_P(result) = IS_STRING; } +/* }}} */ -void zend_ini_init_string(zval *result) +/* {{{ zend_ini_init_string() +*/ +static void zend_ini_init_string(zval *result) { Z_STRVAL_P(result) = malloc(1); Z_STRVAL_P(result)[0] = 0; Z_STRLEN_P(result) = 0; Z_TYPE_P(result) = IS_STRING; } +/* }}} */ -void zend_ini_add_string(zval *result, zval *op1, zval *op2) +/* {{{ zend_ini_add_string() +*/ +static void zend_ini_add_string(zval *result, zval *op1, zval *op2) { int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); @@ -209,12 +222,15 @@ void zend_ini_add_string(zval *result, zval *op1, zval *op2) Z_STRLEN_P(result) = length; Z_TYPE_P(result) = IS_STRING; } +/* }}} */ -void zend_ini_get_constant(zval *result, zval *name) +/* {{{ zend_ini_get_constant() +*/ +static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC) { zval z_constant; - TSRMLS_FETCH(); + /* If name contains ':' it is not a constant. Bug #26893. */ if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name)) && zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) { /* z_constant is emalloc()'d */ @@ -228,16 +244,20 @@ void zend_ini_get_constant(zval *result, zval *name) *result = *name; } } +/* }}} */ -void zend_ini_get_var(zval *result, zval *name) +/* {{{ zend_ini_get_var() +*/ +static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC) { zval curval; char *envvar; - TSRMLS_FETCH(); + /* Fetch configuration option value */ if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name)+1, &curval) == SUCCESS) { Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRLEN(curval)); Z_STRLEN_P(result) = Z_STRLEN(curval); + /* ..or if not found, try ENV */ } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL || (envvar = getenv(Z_STRVAL_P(name))) != NULL) { Z_STRVAL_P(result) = strdup(envvar); @@ -246,9 +266,11 @@ void zend_ini_get_var(zval *result, zval *name) zend_ini_init_string(result); } } +/* }}} */ - -static void ini_error(char *str) +/* {{{ ini_error() +*/ +static void ini_error(char *msg) { char *error_buf; int error_buf_len; @@ -257,10 +279,10 @@ static void ini_error(char *str) currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C); if (currently_parsed_filename) { - error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */ + error_buf_len = 128 + strlen(msg) + strlen(currently_parsed_filename); /* should be more than enough */ error_buf = (char *) emalloc(error_buf_len); - sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); + sprintf(error_buf, "%s in %s on line %d\n", msg, currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); } else { error_buf = estrdup("Invalid configuration directive\n"); } @@ -276,57 +298,64 @@ static void ini_error(char *str) } efree(error_buf); } +/* }}} */ - -ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg) +/* {{{ zend_parse_ini_file() +*/ +ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC) { int retval; zend_ini_parser_param ini_parser_param; - TSRMLS_FETCH(); ini_parser_param.ini_parser_cb = ini_parser_cb; ini_parser_param.arg = arg; - CG(ini_parser_param) = &ini_parser_param; - if (zend_ini_open_file_for_scanning(fh TSRMLS_CC)==FAILURE) { + + if (zend_ini_open_file_for_scanning(fh, scanner_mode TSRMLS_CC) == FAILURE) { return FAILURE; } CG(ini_parser_unbuffered_errors) = unbuffered_errors; retval = ini_parse(TSRMLS_C); + zend_file_handle_dtor(fh TSRMLS_CC); - zend_ini_close_file(fh TSRMLS_CC); - - if (retval==0) { + shutdown_ini_scanner(TSRMLS_C); + + if (retval == 0) { return SUCCESS; } else { return FAILURE; } } +/* }}} */ - -ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg) +/* {{{ zend_parse_ini_string() +*/ +ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC) { + int retval; zend_ini_parser_param ini_parser_param; - TSRMLS_FETCH(); ini_parser_param.ini_parser_cb = ini_parser_cb; ini_parser_param.arg = arg; - CG(ini_parser_param) = &ini_parser_param; - if (zend_ini_prepare_string_for_scanning(str TSRMLS_CC)==FAILURE) { + + if (zend_ini_prepare_string_for_scanning(str, scanner_mode TSRMLS_CC) == FAILURE) { return FAILURE; } CG(ini_parser_unbuffered_errors) = unbuffered_errors; + retval = ini_parse(TSRMLS_C); - if (ini_parse(TSRMLS_C)) { + shutdown_ini_scanner(TSRMLS_C); + + if (retval == 0) { return SUCCESS; } else { return FAILURE; } } - +/* }}} */ @@ -576,20 +605,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 41 +#define YYLAST 80 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 19 +#define YYNTOKENS 43 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 8 +#define YYNNTS 11 /* YYNRULES -- Number of rules. */ -#define YYNRULES 27 +#define YYNRULES 37 /* YYNRULES -- Number of states. */ -#define YYNSTATES 38 +#define YYNSTATES 54 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 264 +#define YYMAXUTOK 271 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -598,18 +627,18 @@ union yyalloc static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 13, 2, 2, 2, 2, 11, 2, - 17, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 14, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 39, 21, 2, 29, 28, 38, 22, + 41, 42, 27, 24, 19, 25, 20, 26, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, + 31, 17, 32, 33, 34, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 40, 23, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 10, 16, 12, 2, 2, 2, + 2, 2, 2, 35, 37, 36, 30, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -623,7 +652,8 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9 + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16 }; #if YYDEBUG @@ -631,30 +661,34 @@ static const yytype_uint8 yytranslate[] = YYRHS. */ static const yytype_uint8 yyprhs[] = { - 0, 0, 3, 6, 7, 11, 16, 18, 20, 22, - 24, 26, 28, 30, 31, 33, 35, 37, 40, 43, - 46, 50, 52, 56, 60, 63, 66, 70 + 0, 0, 3, 6, 7, 11, 15, 21, 23, 25, + 27, 28, 30, 32, 34, 36, 38, 39, 42, 45, + 46, 48, 50, 54, 57, 60, 65, 67, 71, 75, + 78, 81, 85, 89, 91, 93, 95, 97 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 20, 0, -1, 20, 21, -1, -1, 3, 14, 22, - -1, 3, 5, 14, 22, -1, 3, -1, 6, -1, - 15, -1, 25, -1, 7, -1, 8, -1, 15, -1, - -1, 24, -1, 4, -1, 26, -1, 23, 24, -1, - 23, 4, -1, 23, 26, -1, 9, 3, 16, -1, - 23, -1, 25, 10, 25, -1, 25, 11, 25, -1, - 12, 25, -1, 13, 25, -1, 17, 25, 18, -1, - 3, -1 + 44, 0, -1, 44, 45, -1, -1, 3, 46, 40, + -1, 9, 17, 47, -1, 10, 48, 40, 17, 47, + -1, 9, -1, 16, -1, 50, -1, -1, 51, -1, + 14, -1, 15, -1, 16, -1, 50, -1, -1, 49, + 52, -1, 49, 13, -1, -1, 52, -1, 53, -1, + 21, 49, 21, -1, 50, 52, -1, 50, 53, -1, + 50, 21, 49, 21, -1, 50, -1, 51, 37, 51, + -1, 51, 38, 51, -1, 30, 51, -1, 39, 51, + -1, 41, 51, 42, -1, 11, 12, 36, -1, 5, + -1, 4, -1, 6, -1, 7, -1, 8, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 248, 248, 249, 253, 261, 269, 270, 271, 276, - 277, 278, 279, 280, 285, 286, 287, 288, 289, 290, - 294, 298, 299, 300, 301, 302, 303, 307 + 0, 273, 273, 274, 278, 285, 293, 302, 303, 307, + 308, 312, 313, 314, 315, 319, 320, 324, 325, 326, + 330, 331, 332, 333, 334, 335, 339, 340, 341, 342, + 343, 344, 348, 352, 353, 354, 355, 356 }; #endif @@ -663,11 +697,15 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "TC_STRING", "TC_ENCAPSULATED_STRING", - "BRACK", "SECTION", "CFG_TRUE", "CFG_FALSE", "TC_DOLLAR_CURLY", "'|'", - "'&'", "'~'", "'!'", "'='", "'\\n'", "'}'", "'('", "')'", "$accept", - "statement_list", "statement", "string_or_value", "var_string_list", - "cfg_var_ref", "expr", "constant_string", 0 + "$end", "error", "$undefined", "TC_SECTION", "TC_RAW", "TC_CONSTANT", + "TC_NUMBER", "TC_STRING", "TC_WHITESPACE", "TC_LABEL", "TC_OFFSET", + "TC_DOLLAR_CURLY", "TC_VARNAME", "TC_QUOTED_STRING", "BOOL_TRUE", + "BOOL_FALSE", "END_OF_LINE", "'='", "':'", "','", "'.'", "'\"'", "'''", + "'^'", "'+'", "'-'", "'/'", "'*'", "'%'", "'$'", "'~'", "'<'", "'>'", + "'?'", "'@'", "'{'", "'}'", "'|'", "'&'", "'!'", "']'", "'('", "')'", + "$accept", "statement_list", "statement", "section_string_or_value", + "string_or_value", "option_offset", "encapsed_list", "var_string_list", + "expr", "cfg_var_ref", "constant_string", 0 }; #endif @@ -677,24 +715,29 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 124, 38, 126, 33, 61, 10, 125, 40, 41 + 265, 266, 267, 268, 269, 270, 271, 61, 58, 44, + 46, 34, 39, 94, 43, 45, 47, 42, 37, 36, + 126, 60, 62, 63, 64, 123, 125, 124, 38, 33, + 93, 40, 41 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 19, 20, 20, 21, 21, 21, 21, 21, 22, - 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, - 24, 25, 25, 25, 25, 25, 25, 26 + 0, 43, 44, 44, 45, 45, 45, 45, 45, 46, + 46, 47, 47, 47, 47, 48, 48, 49, 49, 49, + 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, + 51, 51, 52, 53, 53, 53, 53, 53 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 2, 0, 3, 4, 1, 1, 1, 1, - 1, 1, 1, 0, 1, 1, 1, 2, 2, 2, - 3, 1, 3, 3, 2, 2, 3, 1 + 0, 2, 2, 0, 3, 3, 5, 1, 1, 1, + 0, 1, 1, 1, 1, 1, 0, 2, 2, 0, + 1, 1, 3, 2, 2, 4, 1, 3, 3, 2, + 2, 3, 3, 1, 1, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -702,33 +745,39 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 3, 0, 1, 6, 7, 8, 2, 0, 13, 13, - 27, 15, 10, 11, 0, 0, 0, 12, 0, 4, - 21, 14, 9, 16, 5, 0, 24, 25, 0, 18, - 17, 19, 0, 0, 20, 26, 22, 23 + 3, 0, 1, 10, 7, 16, 8, 2, 34, 33, + 35, 36, 37, 0, 19, 0, 9, 20, 21, 0, + 0, 15, 0, 0, 4, 19, 23, 24, 12, 13, + 14, 0, 0, 0, 5, 26, 11, 0, 32, 18, + 22, 17, 0, 29, 30, 0, 0, 0, 0, 25, + 31, 27, 28, 6 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 6, 19, 20, 21, 22, 23 + -1, 1, 7, 15, 34, 20, 23, 35, 36, 17, + 18 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -16 +#define YYPACT_NINF -33 static const yytype_int8 yypact[] = { - -16, 4, -16, -3, -16, -16, -16, -2, 17, 17, - -16, -16, -16, -16, 13, 24, 24, -16, 24, -16, - 5, -16, 12, -16, -16, -1, -16, -16, -5, -16, - -16, -16, 24, 24, -16, -16, -16, -16 + -33, 60, -33, 38, 3, 38, -33, -33, -33, -33, + -33, -33, -33, -3, -33, 1, 46, -33, -33, -4, + 8, 46, 0, 18, -33, -33, -33, -33, -33, -33, + -33, 17, 17, 17, -33, 46, -32, 44, -33, -33, + -33, -33, 19, -33, -33, 35, 17, 17, -4, -33, + -33, -33, -33, -33 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -16, -16, -16, 22, -16, 15, -15, 18 + -33, -33, -33, -33, 7, -33, 37, 13, 33, -8, + -2 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -738,30 +787,40 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 26, 27, 7, 28, 2, 32, 33, 3, 10, 29, - 4, 8, 9, 35, 14, 34, 25, 36, 37, 5, - 10, 11, 32, 33, 12, 13, 14, 10, 11, 15, - 16, 24, 17, 14, 18, 30, 15, 16, 31, 0, - 0, 18 + 8, 9, 10, 11, 12, 46, 47, 13, 26, 22, + 28, 29, 30, 26, 27, 41, 16, 14, 21, 27, + 19, 8, 9, 10, 11, 12, 31, 26, 13, 13, + 13, 39, 39, 27, 41, 32, 38, 33, 14, 40, + 49, 24, 8, 9, 10, 11, 12, 31, 37, 13, + 8, 9, 10, 11, 12, 53, 32, 13, 33, 14, + 2, 48, 42, 3, 43, 44, 45, 25, 0, 4, + 5, 0, 46, 47, 0, 0, 6, 50, 0, 51, + 52 }; static const yytype_int8 yycheck[] = { - 15, 16, 5, 18, 0, 10, 11, 3, 3, 4, - 6, 14, 14, 18, 9, 16, 3, 32, 33, 15, - 3, 4, 10, 11, 7, 8, 9, 3, 4, 12, - 13, 9, 15, 9, 17, 20, 12, 13, 20, -1, - -1, 17 + 4, 5, 6, 7, 8, 37, 38, 11, 16, 12, + 14, 15, 16, 21, 16, 23, 3, 21, 5, 21, + 17, 4, 5, 6, 7, 8, 30, 35, 11, 11, + 11, 13, 13, 35, 42, 39, 36, 41, 21, 21, + 21, 40, 4, 5, 6, 7, 8, 30, 40, 11, + 4, 5, 6, 7, 8, 48, 39, 11, 41, 21, + 0, 17, 25, 3, 31, 32, 33, 21, -1, 9, + 10, -1, 37, 38, -1, -1, 16, 42, -1, 46, + 47 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 20, 0, 3, 6, 15, 21, 5, 14, 14, - 3, 4, 7, 8, 9, 12, 13, 15, 17, 22, - 23, 24, 25, 26, 22, 3, 25, 25, 25, 4, - 24, 26, 10, 11, 16, 18, 25, 25 + 0, 44, 0, 3, 9, 10, 16, 45, 4, 5, + 6, 7, 8, 11, 21, 46, 50, 52, 53, 17, + 48, 50, 12, 49, 40, 21, 52, 53, 14, 15, + 16, 30, 39, 41, 47, 50, 51, 40, 36, 13, + 21, 52, 49, 51, 51, 51, 37, 38, 17, 21, + 42, 51, 51, 47 }; #define yyerrok (yyerrstatus = 0) @@ -1579,11 +1638,10 @@ yyreduce: { #if DEBUG_CFG_PARSER - printf("'%s' = '%s'\n", Z_STRVAL((yyvsp[(1) - (3)])), Z_STRVAL((yyvsp[(3) - (3)]))); + printf("SECTION: [%s]\n", Z_STRVAL((yyvsp[(2) - (3)]))); #endif - ZEND_INI_PARSER_CB(&(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); - free(Z_STRVAL((yyvsp[(1) - (3)]))); - free(Z_STRVAL((yyvsp[(3) - (3)]))); + ZEND_INI_PARSER_CB(&(yyvsp[(2) - (3)]), NULL, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG TSRMLS_CC); + free(Z_STRVAL((yyvsp[(2) - (3)]))); } break; @@ -1591,22 +1649,30 @@ yyreduce: { #if DEBUG_CFG_PARSER - printf("'%s'[ ] = '%s'\n", Z_STRVAL((yyvsp[(1) - (4)])), Z_STRVAL((yyvsp[(4) - (4)]))); + printf("NORMAL: '%s' = '%s'\n", Z_STRVAL((yyvsp[(1) - (3)])), Z_STRVAL((yyvsp[(3) - (3)]))); #endif - ZEND_INI_PARSER_CB(&(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]), ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG); - free(Z_STRVAL((yyvsp[(1) - (4)]))); - free(Z_STRVAL((yyvsp[(4) - (4)]))); + ZEND_INI_PARSER_CB(&(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); + free(Z_STRVAL((yyvsp[(1) - (3)]))); + free(Z_STRVAL((yyvsp[(3) - (3)]))); } break; case 6: - { ZEND_INI_PARSER_CB(&(yyvsp[(1) - (1)]), NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free(Z_STRVAL((yyvsp[(1) - (1)]))); } + { +#if DEBUG_CFG_PARSER + printf("OFFSET: '%s'[%s] = '%s'\n", Z_STRVAL((yyvsp[(1) - (5)])), Z_STRVAL((yyvsp[(2) - (5)])), Z_STRVAL((yyvsp[(5) - (5)]))); +#endif + ZEND_INI_PARSER_CB(&(yyvsp[(1) - (5)]), &(yyvsp[(5) - (5)]), &(yyvsp[(2) - (5)]), ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); + free(Z_STRVAL((yyvsp[(1) - (5)]))); + free(Z_STRVAL((yyvsp[(2) - (5)]))); + free(Z_STRVAL((yyvsp[(5) - (5)]))); + } break; case 7: - { ZEND_INI_PARSER_CB(&(yyvsp[(1) - (1)]), NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free(Z_STRVAL((yyvsp[(1) - (1)]))); } + { ZEND_INI_PARSER_CB(&(yyvsp[(1) - (1)]), NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); free(Z_STRVAL((yyvsp[(1) - (1)]))); } break; case 9: @@ -1616,7 +1682,7 @@ yyreduce: case 10: - { (yyval) = (yyvsp[(1) - (1)]); } + { zend_ini_init_string(&(yyval)); } break; case 11: @@ -1626,17 +1692,17 @@ yyreduce: case 12: - { zend_ini_init_string(&(yyval)); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 13: - { zend_ini_init_string(&(yyval)); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 14: - { (yyval) = (yyvsp[(1) - (1)]); } + { zend_ini_init_string(&(yyval)); } break; case 15: @@ -1646,12 +1712,12 @@ yyreduce: case 16: - { (yyval) = (yyvsp[(1) - (1)]); } + { zend_ini_init_string(&(yyval)); } break; case 17: - { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free((yyvsp[(2) - (2)]).value.str.val); } + { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free(Z_STRVAL((yyvsp[(2) - (2)]))); } break; case 18: @@ -1661,12 +1727,12 @@ yyreduce: case 19: - { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free((yyvsp[(2) - (2)]).value.str.val); } + { zend_ini_init_string(&(yyval)); } break; case 20: - { zend_ini_get_var(&(yyval), &(yyvsp[(2) - (3)])); free((yyvsp[(2) - (3)]).value.str.val); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 21: @@ -1676,32 +1742,82 @@ yyreduce: case 22: - { zend_ini_do_op('|', &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); } + { (yyval) = (yyvsp[(2) - (3)]); } break; case 23: - { zend_ini_do_op('&', &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); } + { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free(Z_STRVAL((yyvsp[(2) - (2)]))); } break; case 24: - { zend_ini_do_op('~', &(yyval), &(yyvsp[(2) - (2)]), NULL); } + { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free(Z_STRVAL((yyvsp[(2) - (2)]))); } break; case 25: - { zend_ini_do_op('!', &(yyval), &(yyvsp[(2) - (2)]), NULL); } + { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)])); free(Z_STRVAL((yyvsp[(3) - (4)]))); } break; case 26: - { (yyval) = (yyvsp[(2) - (3)]); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 27: - { zend_ini_get_constant(&(yyval), &(yyvsp[(1) - (1)])); } + { zend_ini_do_op('|', &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); } + break; + + case 28: + + { zend_ini_do_op('&', &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); } + break; + + case 29: + + { zend_ini_do_op('~', &(yyval), &(yyvsp[(2) - (2)]), NULL); } + break; + + case 30: + + { zend_ini_do_op('!', &(yyval), &(yyvsp[(2) - (2)]), NULL); } + break; + + case 31: + + { (yyval) = (yyvsp[(2) - (3)]); } + break; + + case 32: + + { zend_ini_get_var(&(yyval), &(yyvsp[(2) - (3)]) TSRMLS_CC); free(Z_STRVAL((yyvsp[(2) - (3)]))); } + break; + + case 33: + + { zend_ini_get_constant(&(yyval), &(yyvsp[(1) - (1)]) TSRMLS_CC); } + break; + + case 34: + + { (yyval) = (yyvsp[(1) - (1)]); /*printf("TC_RAW: '%s'\n", Z_STRVAL($1));*/ } + break; + + case 35: + + { (yyval) = (yyvsp[(1) - (1)]); /*printf("TC_NUMBER: '%s'\n", Z_STRVAL($1));*/ } + break; + + case 36: + + { (yyval) = (yyvsp[(1) - (1)]); /*printf("TC_STRING: '%s'\n", Z_STRVAL($1));*/ } + break; + + case 37: + + { (yyval) = (yyvsp[(1) - (1)]); /*printf("TC_WHITESPACE: '%s'\n", Z_STRVAL($1));*/ } break; diff --git a/Zend/zend_ini_parser.h b/Zend/zend_ini_parser.h index 9e652172c..d883f9d40 100644 --- a/Zend/zend_ini_parser.h +++ b/Zend/zend_ini_parser.h @@ -39,23 +39,37 @@ /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { - TC_STRING = 258, - TC_ENCAPSULATED_STRING = 259, - BRACK = 260, - SECTION = 261, - CFG_TRUE = 262, - CFG_FALSE = 263, - TC_DOLLAR_CURLY = 264 + TC_SECTION = 258, + TC_RAW = 259, + TC_CONSTANT = 260, + TC_NUMBER = 261, + TC_STRING = 262, + TC_WHITESPACE = 263, + TC_LABEL = 264, + TC_OFFSET = 265, + TC_DOLLAR_CURLY = 266, + TC_VARNAME = 267, + TC_QUOTED_STRING = 268, + BOOL_TRUE = 269, + BOOL_FALSE = 270, + END_OF_LINE = 271 }; #endif /* Tokens. */ -#define TC_STRING 258 -#define TC_ENCAPSULATED_STRING 259 -#define BRACK 260 -#define SECTION 261 -#define CFG_TRUE 262 -#define CFG_FALSE 263 -#define TC_DOLLAR_CURLY 264 +#define TC_SECTION 258 +#define TC_RAW 259 +#define TC_CONSTANT 260 +#define TC_NUMBER 261 +#define TC_STRING 262 +#define TC_WHITESPACE 263 +#define TC_LABEL 264 +#define TC_OFFSET 265 +#define TC_DOLLAR_CURLY 266 +#define TC_VARNAME 267 +#define TC_QUOTED_STRING 268 +#define BOOL_TRUE 269 +#define BOOL_FALSE 270 +#define END_OF_LINE 271 diff --git a/Zend/zend_ini_parser.output b/Zend/zend_ini_parser.output index 74b682733..608ef14b8 100644 --- a/Zend/zend_ini_parser.output +++ b/Zend/zend_ini_parser.output @@ -1,6 +1,21 @@ -State 8 conflicts: 2 shift/reduce -State 9 conflicts: 2 shift/reduce -State 20 conflicts: 1 shift/reduce +Terminals which are not used + + ':' + ',' + '.' + ''' + '^' + '+' + '-' + '/' + '*' + '%' + '$' + '<' + '>' + '?' + '@' + '{' Grammar @@ -10,77 +25,120 @@ Grammar 1 statement_list: statement_list statement 2 | /* empty */ - 3 statement: TC_STRING '=' string_or_value - 4 | TC_STRING BRACK '=' string_or_value - 5 | TC_STRING - 6 | SECTION - 7 | '\n' + 3 statement: TC_SECTION section_string_or_value ']' + 4 | TC_LABEL '=' string_or_value + 5 | TC_OFFSET option_offset ']' '=' string_or_value + 6 | TC_LABEL + 7 | END_OF_LINE - 8 string_or_value: expr - 9 | CFG_TRUE - 10 | CFG_FALSE - 11 | '\n' - 12 | /* empty */ + 8 section_string_or_value: var_string_list + 9 | /* empty */ - 13 var_string_list: cfg_var_ref - 14 | TC_ENCAPSULATED_STRING - 15 | constant_string - 16 | var_string_list cfg_var_ref - 17 | var_string_list TC_ENCAPSULATED_STRING - 18 | var_string_list constant_string + 10 string_or_value: expr + 11 | BOOL_TRUE + 12 | BOOL_FALSE + 13 | END_OF_LINE - 19 cfg_var_ref: TC_DOLLAR_CURLY TC_STRING '}' + 14 option_offset: var_string_list + 15 | /* empty */ - 20 expr: var_string_list - 21 | expr '|' expr - 22 | expr '&' expr - 23 | '~' expr - 24 | '!' expr - 25 | '(' expr ')' + 16 encapsed_list: encapsed_list cfg_var_ref + 17 | encapsed_list TC_QUOTED_STRING + 18 | /* empty */ - 26 constant_string: TC_STRING + 19 var_string_list: cfg_var_ref + 20 | constant_string + 21 | '"' encapsed_list '"' + 22 | var_string_list cfg_var_ref + 23 | var_string_list constant_string + 24 | var_string_list '"' encapsed_list '"' + + 25 expr: var_string_list + 26 | expr '|' expr + 27 | expr '&' expr + 28 | '~' expr + 29 | '!' expr + 30 | '(' expr ')' + + 31 cfg_var_ref: TC_DOLLAR_CURLY TC_VARNAME '}' + + 32 constant_string: TC_CONSTANT + 33 | TC_RAW + 34 | TC_NUMBER + 35 | TC_STRING + 36 | TC_WHITESPACE Terminals, with rules where they appear $end (0) 0 -'\n' (10) 7 11 -'!' (33) 24 -'&' (38) 22 -'(' (40) 25 -')' (41) 25 -'=' (61) 3 4 -'|' (124) 21 -'}' (125) 19 -'~' (126) 23 +'!' (33) 29 +'"' (34) 21 24 +'$' (36) +'%' (37) +'&' (38) 27 +''' (39) +'(' (40) 30 +')' (41) 30 +'*' (42) +'+' (43) +',' (44) +'-' (45) +'.' (46) +'/' (47) +':' (58) +'<' (60) +'=' (61) 4 5 +'>' (62) +'?' (63) +'@' (64) +']' (93) 3 5 +'^' (94) +'{' (123) +'|' (124) 26 +'}' (125) 31 +'~' (126) 28 error (256) -TC_STRING (258) 3 4 5 19 26 -TC_ENCAPSULATED_STRING (259) 14 17 -BRACK (260) 4 -SECTION (261) 6 -CFG_TRUE (262) 9 -CFG_FALSE (263) 10 -TC_DOLLAR_CURLY (264) 19 +TC_SECTION (258) 3 +TC_RAW (259) 33 +TC_CONSTANT (260) 32 +TC_NUMBER (261) 34 +TC_STRING (262) 35 +TC_WHITESPACE (263) 36 +TC_LABEL (264) 4 6 +TC_OFFSET (265) 5 +TC_DOLLAR_CURLY (266) 31 +TC_VARNAME (267) 31 +TC_QUOTED_STRING (268) 17 +BOOL_TRUE (269) 11 +BOOL_FALSE (270) 12 +END_OF_LINE (271) 7 13 Nonterminals, with rules where they appear -$accept (19) +$accept (43) on left: 0 -statement_list (20) +statement_list (44) on left: 1 2, on right: 0 1 -statement (21) +statement (45) on left: 3 4 5 6 7, on right: 1 -string_or_value (22) - on left: 8 9 10 11 12, on right: 3 4 -var_string_list (23) - on left: 13 14 15 16 17 18, on right: 16 17 18 20 -cfg_var_ref (24) - on left: 19, on right: 13 16 -expr (25) - on left: 20 21 22 23 24 25, on right: 8 21 22 23 24 25 -constant_string (26) - on left: 26, on right: 15 18 +section_string_or_value (46) + on left: 8 9, on right: 3 +string_or_value (47) + on left: 10 11 12 13, on right: 4 5 +option_offset (48) + on left: 14 15, on right: 5 +encapsed_list (49) + on left: 16 17 18, on right: 16 17 21 24 +var_string_list (50) + on left: 19 20 21 22 23 24, on right: 8 14 22 23 24 25 +expr (51) + on left: 25 26 27 28 29 30, on right: 10 26 27 28 29 30 +cfg_var_ref (52) + on left: 31, on right: 16 19 22 +constant_string (53) + on left: 32 33 34 35 36, on right: 20 23 state 0 @@ -97,12 +155,13 @@ state 1 0 $accept: statement_list . $end 1 statement_list: statement_list . statement - $end shift, and go to state 2 - TC_STRING shift, and go to state 3 - SECTION shift, and go to state 4 - '\n' shift, and go to state 5 + $end shift, and go to state 2 + TC_SECTION shift, and go to state 3 + TC_LABEL shift, and go to state 4 + TC_OFFSET shift, and go to state 5 + END_OF_LINE shift, and go to state 6 - statement go to state 6 + statement go to state 7 state 2 @@ -114,363 +173,566 @@ state 2 state 3 - 3 statement: TC_STRING . '=' string_or_value - 4 | TC_STRING . BRACK '=' string_or_value - 5 | TC_STRING . + 3 statement: TC_SECTION . section_string_or_value ']' - BRACK shift, and go to state 7 - '=' shift, and go to state 8 + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 14 - $default reduce using rule 5 (statement) + $default reduce using rule 9 (section_string_or_value) + + section_string_or_value go to state 15 + var_string_list go to state 16 + cfg_var_ref go to state 17 + constant_string go to state 18 state 4 - 6 statement: SECTION . + 4 statement: TC_LABEL . '=' string_or_value + 6 | TC_LABEL . + + '=' shift, and go to state 19 $default reduce using rule 6 (statement) state 5 - 7 statement: '\n' . + 5 statement: TC_OFFSET . option_offset ']' '=' string_or_value - $default reduce using rule 7 (statement) + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 14 + + $default reduce using rule 15 (option_offset) + + option_offset go to state 20 + var_string_list go to state 21 + cfg_var_ref go to state 17 + constant_string go to state 18 state 6 - 1 statement_list: statement_list statement . + 7 statement: END_OF_LINE . - $default reduce using rule 1 (statement_list) + $default reduce using rule 7 (statement) state 7 - 4 statement: TC_STRING BRACK . '=' string_or_value + 1 statement_list: statement_list statement . - '=' shift, and go to state 9 + $default reduce using rule 1 (statement_list) state 8 - 3 statement: TC_STRING '=' . string_or_value + 33 constant_string: TC_RAW . - TC_STRING shift, and go to state 10 - TC_ENCAPSULATED_STRING shift, and go to state 11 - CFG_TRUE shift, and go to state 12 - CFG_FALSE shift, and go to state 13 - TC_DOLLAR_CURLY shift, and go to state 14 - '~' shift, and go to state 15 - '!' shift, and go to state 16 - '\n' shift, and go to state 17 - '(' shift, and go to state 18 - - TC_STRING [reduce using rule 12 (string_or_value)] - '\n' [reduce using rule 12 (string_or_value)] - $default reduce using rule 12 (string_or_value) - - string_or_value go to state 19 - var_string_list go to state 20 - cfg_var_ref go to state 21 - expr go to state 22 - constant_string go to state 23 + $default reduce using rule 33 (constant_string) state 9 - 4 statement: TC_STRING BRACK '=' . string_or_value - - TC_STRING shift, and go to state 10 - TC_ENCAPSULATED_STRING shift, and go to state 11 - CFG_TRUE shift, and go to state 12 - CFG_FALSE shift, and go to state 13 - TC_DOLLAR_CURLY shift, and go to state 14 - '~' shift, and go to state 15 - '!' shift, and go to state 16 - '\n' shift, and go to state 17 - '(' shift, and go to state 18 - - TC_STRING [reduce using rule 12 (string_or_value)] - '\n' [reduce using rule 12 (string_or_value)] - $default reduce using rule 12 (string_or_value) + 32 constant_string: TC_CONSTANT . - string_or_value go to state 24 - var_string_list go to state 20 - cfg_var_ref go to state 21 - expr go to state 22 - constant_string go to state 23 + $default reduce using rule 32 (constant_string) state 10 - 26 constant_string: TC_STRING . + 34 constant_string: TC_NUMBER . - $default reduce using rule 26 (constant_string) + $default reduce using rule 34 (constant_string) state 11 - 14 var_string_list: TC_ENCAPSULATED_STRING . + 35 constant_string: TC_STRING . - $default reduce using rule 14 (var_string_list) + $default reduce using rule 35 (constant_string) state 12 - 9 string_or_value: CFG_TRUE . + 36 constant_string: TC_WHITESPACE . - $default reduce using rule 9 (string_or_value) + $default reduce using rule 36 (constant_string) state 13 - 10 string_or_value: CFG_FALSE . + 31 cfg_var_ref: TC_DOLLAR_CURLY . TC_VARNAME '}' - $default reduce using rule 10 (string_or_value) + TC_VARNAME shift, and go to state 22 state 14 - 19 cfg_var_ref: TC_DOLLAR_CURLY . TC_STRING '}' + 21 var_string_list: '"' . encapsed_list '"' - TC_STRING shift, and go to state 25 + $default reduce using rule 18 (encapsed_list) + encapsed_list go to state 23 -state 15 - 23 expr: '~' . expr +state 15 - TC_STRING shift, and go to state 10 - TC_ENCAPSULATED_STRING shift, and go to state 11 - TC_DOLLAR_CURLY shift, and go to state 14 - '~' shift, and go to state 15 - '!' shift, and go to state 16 - '(' shift, and go to state 18 + 3 statement: TC_SECTION section_string_or_value . ']' - var_string_list go to state 20 - cfg_var_ref go to state 21 - expr go to state 26 - constant_string go to state 23 + ']' shift, and go to state 24 state 16 - 24 expr: '!' . expr + 8 section_string_or_value: var_string_list . + 22 var_string_list: var_string_list . cfg_var_ref + 23 | var_string_list . constant_string + 24 | var_string_list . '"' encapsed_list '"' - TC_STRING shift, and go to state 10 - TC_ENCAPSULATED_STRING shift, and go to state 11 - TC_DOLLAR_CURLY shift, and go to state 14 - '~' shift, and go to state 15 - '!' shift, and go to state 16 - '(' shift, and go to state 18 + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 25 - var_string_list go to state 20 - cfg_var_ref go to state 21 - expr go to state 27 - constant_string go to state 23 + $default reduce using rule 8 (section_string_or_value) + + cfg_var_ref go to state 26 + constant_string go to state 27 state 17 - 11 string_or_value: '\n' . + 19 var_string_list: cfg_var_ref . - $default reduce using rule 11 (string_or_value) + $default reduce using rule 19 (var_string_list) state 18 - 25 expr: '(' . expr ')' + 20 var_string_list: constant_string . - TC_STRING shift, and go to state 10 - TC_ENCAPSULATED_STRING shift, and go to state 11 - TC_DOLLAR_CURLY shift, and go to state 14 - '~' shift, and go to state 15 - '!' shift, and go to state 16 - '(' shift, and go to state 18 - - var_string_list go to state 20 - cfg_var_ref go to state 21 - expr go to state 28 - constant_string go to state 23 + $default reduce using rule 20 (var_string_list) state 19 - 3 statement: TC_STRING '=' string_or_value . - - $default reduce using rule 3 (statement) + 4 statement: TC_LABEL '=' . string_or_value + + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + BOOL_TRUE shift, and go to state 28 + BOOL_FALSE shift, and go to state 29 + END_OF_LINE shift, and go to state 30 + '"' shift, and go to state 14 + '~' shift, and go to state 31 + '!' shift, and go to state 32 + '(' shift, and go to state 33 + + string_or_value go to state 34 + var_string_list go to state 35 + expr go to state 36 + cfg_var_ref go to state 17 + constant_string go to state 18 state 20 - 16 var_string_list: var_string_list . cfg_var_ref - 17 | var_string_list . TC_ENCAPSULATED_STRING - 18 | var_string_list . constant_string - 20 expr: var_string_list . + 5 statement: TC_OFFSET option_offset . ']' '=' string_or_value - TC_STRING shift, and go to state 10 - TC_ENCAPSULATED_STRING shift, and go to state 29 - TC_DOLLAR_CURLY shift, and go to state 14 + ']' shift, and go to state 37 - TC_STRING [reduce using rule 20 (expr)] - $default reduce using rule 20 (expr) - cfg_var_ref go to state 30 - constant_string go to state 31 +state 21 + 14 option_offset: var_string_list . + 22 var_string_list: var_string_list . cfg_var_ref + 23 | var_string_list . constant_string + 24 | var_string_list . '"' encapsed_list '"' -state 21 + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 25 - 13 var_string_list: cfg_var_ref . + $default reduce using rule 14 (option_offset) - $default reduce using rule 13 (var_string_list) + cfg_var_ref go to state 26 + constant_string go to state 27 state 22 - 8 string_or_value: expr . - 21 expr: expr . '|' expr - 22 | expr . '&' expr - - '|' shift, and go to state 32 - '&' shift, and go to state 33 + 31 cfg_var_ref: TC_DOLLAR_CURLY TC_VARNAME . '}' - $default reduce using rule 8 (string_or_value) + '}' shift, and go to state 38 state 23 - 15 var_string_list: constant_string . + 16 encapsed_list: encapsed_list . cfg_var_ref + 17 | encapsed_list . TC_QUOTED_STRING + 21 var_string_list: '"' encapsed_list . '"' - $default reduce using rule 15 (var_string_list) + TC_DOLLAR_CURLY shift, and go to state 13 + TC_QUOTED_STRING shift, and go to state 39 + '"' shift, and go to state 40 + + cfg_var_ref go to state 41 state 24 - 4 statement: TC_STRING BRACK '=' string_or_value . + 3 statement: TC_SECTION section_string_or_value ']' . - $default reduce using rule 4 (statement) + $default reduce using rule 3 (statement) state 25 - 19 cfg_var_ref: TC_DOLLAR_CURLY TC_STRING . '}' + 24 var_string_list: var_string_list '"' . encapsed_list '"' + + $default reduce using rule 18 (encapsed_list) - '}' shift, and go to state 34 + encapsed_list go to state 42 state 26 - 21 expr: expr . '|' expr - 22 | expr . '&' expr - 23 | '~' expr . + 22 var_string_list: var_string_list cfg_var_ref . - $default reduce using rule 23 (expr) + $default reduce using rule 22 (var_string_list) state 27 - 21 expr: expr . '|' expr - 22 | expr . '&' expr - 24 | '!' expr . + 23 var_string_list: var_string_list constant_string . - $default reduce using rule 24 (expr) + $default reduce using rule 23 (var_string_list) state 28 - 21 expr: expr . '|' expr - 22 | expr . '&' expr - 25 | '(' expr . ')' + 11 string_or_value: BOOL_TRUE . - '|' shift, and go to state 32 - '&' shift, and go to state 33 - ')' shift, and go to state 35 + $default reduce using rule 11 (string_or_value) state 29 - 17 var_string_list: var_string_list TC_ENCAPSULATED_STRING . + 12 string_or_value: BOOL_FALSE . - $default reduce using rule 17 (var_string_list) + $default reduce using rule 12 (string_or_value) state 30 - 16 var_string_list: var_string_list cfg_var_ref . + 13 string_or_value: END_OF_LINE . - $default reduce using rule 16 (var_string_list) + $default reduce using rule 13 (string_or_value) state 31 - 18 var_string_list: var_string_list constant_string . + 28 expr: '~' . expr - $default reduce using rule 18 (var_string_list) + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 14 + '~' shift, and go to state 31 + '!' shift, and go to state 32 + '(' shift, and go to state 33 + + var_string_list go to state 35 + expr go to state 43 + cfg_var_ref go to state 17 + constant_string go to state 18 state 32 - 21 expr: expr '|' . expr + 29 expr: '!' . expr - TC_STRING shift, and go to state 10 - TC_ENCAPSULATED_STRING shift, and go to state 11 - TC_DOLLAR_CURLY shift, and go to state 14 - '~' shift, and go to state 15 - '!' shift, and go to state 16 - '(' shift, and go to state 18 + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 14 + '~' shift, and go to state 31 + '!' shift, and go to state 32 + '(' shift, and go to state 33 - var_string_list go to state 20 - cfg_var_ref go to state 21 - expr go to state 36 - constant_string go to state 23 + var_string_list go to state 35 + expr go to state 44 + cfg_var_ref go to state 17 + constant_string go to state 18 state 33 - 22 expr: expr '&' . expr + 30 expr: '(' . expr ')' - TC_STRING shift, and go to state 10 - TC_ENCAPSULATED_STRING shift, and go to state 11 - TC_DOLLAR_CURLY shift, and go to state 14 - '~' shift, and go to state 15 - '!' shift, and go to state 16 - '(' shift, and go to state 18 + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 14 + '~' shift, and go to state 31 + '!' shift, and go to state 32 + '(' shift, and go to state 33 - var_string_list go to state 20 - cfg_var_ref go to state 21 - expr go to state 37 - constant_string go to state 23 + var_string_list go to state 35 + expr go to state 45 + cfg_var_ref go to state 17 + constant_string go to state 18 state 34 - 19 cfg_var_ref: TC_DOLLAR_CURLY TC_STRING '}' . + 4 statement: TC_LABEL '=' string_or_value . - $default reduce using rule 19 (cfg_var_ref) + $default reduce using rule 4 (statement) state 35 - 25 expr: '(' expr ')' . + 22 var_string_list: var_string_list . cfg_var_ref + 23 | var_string_list . constant_string + 24 | var_string_list . '"' encapsed_list '"' + 25 expr: var_string_list . + + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 25 $default reduce using rule 25 (expr) + cfg_var_ref go to state 26 + constant_string go to state 27 + state 36 - 21 expr: expr . '|' expr - 21 | expr '|' expr . - 22 | expr . '&' expr + 10 string_or_value: expr . + 26 expr: expr . '|' expr + 27 | expr . '&' expr + + '|' shift, and go to state 46 + '&' shift, and go to state 47 - $default reduce using rule 21 (expr) + $default reduce using rule 10 (string_or_value) state 37 - 21 expr: expr . '|' expr - 22 | expr . '&' expr - 22 | expr '&' expr . + 5 statement: TC_OFFSET option_offset ']' . '=' string_or_value + + '=' shift, and go to state 48 + + +state 38 + + 31 cfg_var_ref: TC_DOLLAR_CURLY TC_VARNAME '}' . + + $default reduce using rule 31 (cfg_var_ref) + + +state 39 + + 17 encapsed_list: encapsed_list TC_QUOTED_STRING . + + $default reduce using rule 17 (encapsed_list) + + +state 40 + + 21 var_string_list: '"' encapsed_list '"' . + + $default reduce using rule 21 (var_string_list) + - $default reduce using rule 22 (expr) +state 41 + + 16 encapsed_list: encapsed_list cfg_var_ref . + + $default reduce using rule 16 (encapsed_list) + + +state 42 + + 16 encapsed_list: encapsed_list . cfg_var_ref + 17 | encapsed_list . TC_QUOTED_STRING + 24 var_string_list: var_string_list '"' encapsed_list . '"' + + TC_DOLLAR_CURLY shift, and go to state 13 + TC_QUOTED_STRING shift, and go to state 39 + '"' shift, and go to state 49 + + cfg_var_ref go to state 41 + + +state 43 + + 26 expr: expr . '|' expr + 27 | expr . '&' expr + 28 | '~' expr . + + $default reduce using rule 28 (expr) + + +state 44 + + 26 expr: expr . '|' expr + 27 | expr . '&' expr + 29 | '!' expr . + + $default reduce using rule 29 (expr) + + +state 45 + + 26 expr: expr . '|' expr + 27 | expr . '&' expr + 30 | '(' expr . ')' + + '|' shift, and go to state 46 + '&' shift, and go to state 47 + ')' shift, and go to state 50 + + +state 46 + + 26 expr: expr '|' . expr + + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 14 + '~' shift, and go to state 31 + '!' shift, and go to state 32 + '(' shift, and go to state 33 + + var_string_list go to state 35 + expr go to state 51 + cfg_var_ref go to state 17 + constant_string go to state 18 + + +state 47 + + 27 expr: expr '&' . expr + + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + '"' shift, and go to state 14 + '~' shift, and go to state 31 + '!' shift, and go to state 32 + '(' shift, and go to state 33 + + var_string_list go to state 35 + expr go to state 52 + cfg_var_ref go to state 17 + constant_string go to state 18 + + +state 48 + + 5 statement: TC_OFFSET option_offset ']' '=' . string_or_value + + TC_RAW shift, and go to state 8 + TC_CONSTANT shift, and go to state 9 + TC_NUMBER shift, and go to state 10 + TC_STRING shift, and go to state 11 + TC_WHITESPACE shift, and go to state 12 + TC_DOLLAR_CURLY shift, and go to state 13 + BOOL_TRUE shift, and go to state 28 + BOOL_FALSE shift, and go to state 29 + END_OF_LINE shift, and go to state 30 + '"' shift, and go to state 14 + '~' shift, and go to state 31 + '!' shift, and go to state 32 + '(' shift, and go to state 33 + + string_or_value go to state 53 + var_string_list go to state 35 + expr go to state 36 + cfg_var_ref go to state 17 + constant_string go to state 18 + + +state 49 + + 24 var_string_list: var_string_list '"' encapsed_list '"' . + + $default reduce using rule 24 (var_string_list) + + +state 50 + + 30 expr: '(' expr ')' . + + $default reduce using rule 30 (expr) + + +state 51 + + 26 expr: expr . '|' expr + 26 | expr '|' expr . + 27 | expr . '&' expr + + $default reduce using rule 26 (expr) + + +state 52 + + 26 expr: expr . '|' expr + 27 | expr . '&' expr + 27 | expr '&' expr . + + $default reduce using rule 27 (expr) + + +state 53 + + 5 statement: TC_OFFSET option_offset ']' '=' string_or_value . + + $default reduce using rule 5 (statement) diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 73fd50b05..42e292ea6 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -13,13 +13,15 @@ | obtain it through the world-wide-web, please send a note to | | license@zend.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Zeev Suraski | + | Authors: Zeev Suraski | + | Jani Taskinen | +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_parser.y,v 1.41.2.2.2.4 2008/12/31 11:16:12 sebastian Exp $ */ +/* $Id: zend_ini_parser.y,v 1.41.2.2.2.2.2.6 2008/12/31 11:13:47 sebastian Exp $ */ #define DEBUG_CFG_PARSER 0 + #include "zend.h" #include "zend_API.h" #include "zend_ini.h" @@ -27,32 +29,23 @@ #include "zend_ini_scanner.h" #include "zend_extensions.h" +#define YYERROR_VERBOSE #define YYSTYPE zval #ifdef ZTS #define YYPARSE_PARAM tsrm_ls #define YYLEX_PARAM tsrm_ls -#endif - -#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb -#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg - -int ini_lex(zval *ini_lval TSRMLS_DC); -#ifdef ZTS int ini_parse(void *arg); #else int ini_parse(void); #endif -zval yylval; - -#ifndef ZTS -extern int ini_lex(zval *ini_lval TSRMLS_DC); -extern FILE *ini_in; -extern void init_cfg_scanner(void); -#endif +#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb +#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg -void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) +/* {{{ zend_ini_do_op() +*/ +static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) { int i_result; int i_op1, i_op2; @@ -91,16 +84,22 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0; Z_TYPE_P(result) = IS_STRING; } +/* }}} */ -void zend_ini_init_string(zval *result) +/* {{{ zend_ini_init_string() +*/ +static void zend_ini_init_string(zval *result) { Z_STRVAL_P(result) = malloc(1); Z_STRVAL_P(result)[0] = 0; Z_STRLEN_P(result) = 0; Z_TYPE_P(result) = IS_STRING; } +/* }}} */ -void zend_ini_add_string(zval *result, zval *op1, zval *op2) +/* {{{ zend_ini_add_string() +*/ +static void zend_ini_add_string(zval *result, zval *op1, zval *op2) { int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); @@ -110,12 +109,15 @@ void zend_ini_add_string(zval *result, zval *op1, zval *op2) Z_STRLEN_P(result) = length; Z_TYPE_P(result) = IS_STRING; } +/* }}} */ -void zend_ini_get_constant(zval *result, zval *name) +/* {{{ zend_ini_get_constant() +*/ +static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC) { zval z_constant; - TSRMLS_FETCH(); + /* If name contains ':' it is not a constant. Bug #26893. */ if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name)) && zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) { /* z_constant is emalloc()'d */ @@ -129,16 +131,20 @@ void zend_ini_get_constant(zval *result, zval *name) *result = *name; } } +/* }}} */ -void zend_ini_get_var(zval *result, zval *name) +/* {{{ zend_ini_get_var() +*/ +static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC) { zval curval; char *envvar; - TSRMLS_FETCH(); + /* Fetch configuration option value */ if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name)+1, &curval) == SUCCESS) { Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRLEN(curval)); Z_STRLEN_P(result) = Z_STRLEN(curval); + /* ..or if not found, try ENV */ } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL || (envvar = getenv(Z_STRVAL_P(name))) != NULL) { Z_STRVAL_P(result) = strdup(envvar); @@ -147,9 +153,11 @@ void zend_ini_get_var(zval *result, zval *name) zend_ini_init_string(result); } } +/* }}} */ - -static void ini_error(char *str) +/* {{{ ini_error() +*/ +static void ini_error(char *msg) { char *error_buf; int error_buf_len; @@ -158,10 +166,10 @@ static void ini_error(char *str) currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C); if (currently_parsed_filename) { - error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */ + error_buf_len = 128 + strlen(msg) + strlen(currently_parsed_filename); /* should be more than enough */ error_buf = (char *) emalloc(error_buf_len); - sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); + sprintf(error_buf, "%s in %s on line %d\n", msg, currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); } else { error_buf = estrdup("Invalid configuration directive\n"); } @@ -177,68 +185,85 @@ static void ini_error(char *str) } efree(error_buf); } +/* }}} */ - -ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg) +/* {{{ zend_parse_ini_file() +*/ +ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC) { int retval; zend_ini_parser_param ini_parser_param; - TSRMLS_FETCH(); ini_parser_param.ini_parser_cb = ini_parser_cb; ini_parser_param.arg = arg; - CG(ini_parser_param) = &ini_parser_param; - if (zend_ini_open_file_for_scanning(fh TSRMLS_CC)==FAILURE) { + + if (zend_ini_open_file_for_scanning(fh, scanner_mode TSRMLS_CC) == FAILURE) { return FAILURE; } CG(ini_parser_unbuffered_errors) = unbuffered_errors; retval = ini_parse(TSRMLS_C); + zend_file_handle_dtor(fh TSRMLS_CC); - zend_ini_close_file(fh TSRMLS_CC); - - if (retval==0) { + shutdown_ini_scanner(TSRMLS_C); + + if (retval == 0) { return SUCCESS; } else { return FAILURE; } } +/* }}} */ - -ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg) +/* {{{ zend_parse_ini_string() +*/ +ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC) { + int retval; zend_ini_parser_param ini_parser_param; - TSRMLS_FETCH(); ini_parser_param.ini_parser_cb = ini_parser_cb; ini_parser_param.arg = arg; - CG(ini_parser_param) = &ini_parser_param; - if (zend_ini_prepare_string_for_scanning(str TSRMLS_CC)==FAILURE) { + + if (zend_ini_prepare_string_for_scanning(str, scanner_mode TSRMLS_CC) == FAILURE) { return FAILURE; } CG(ini_parser_unbuffered_errors) = unbuffered_errors; + retval = ini_parse(TSRMLS_C); - if (ini_parse(TSRMLS_C)) { + shutdown_ini_scanner(TSRMLS_C); + + if (retval == 0) { return SUCCESS; } else { return FAILURE; } } - +/* }}} */ %} +%expect 0 %pure_parser + +%token TC_SECTION +%token TC_RAW +%token TC_CONSTANT +%token TC_NUMBER %token TC_STRING -%token TC_ENCAPSULATED_STRING -%token BRACK -%token SECTION -%token CFG_TRUE -%token CFG_FALSE +%token TC_WHITESPACE +%token TC_LABEL +%token TC_OFFSET %token TC_DOLLAR_CURLY +%token TC_VARNAME +%token TC_QUOTED_STRING +%token BOOL_TRUE +%token BOOL_FALSE +%token END_OF_LINE +%token '=' ':' ',' '.' '"' '\'' '^' '+' '-' '/' '*' '%' '$' '~' '<' '>' '?' '@' '{' '}' %left '|' '&' %right '~' '!' @@ -250,61 +275,85 @@ statement_list: ; statement: - TC_STRING '=' string_or_value { + TC_SECTION section_string_or_value ']' { #if DEBUG_CFG_PARSER - printf("'%s' = '%s'\n", Z_STRVAL($1), Z_STRVAL($3)); + printf("SECTION: [%s]\n", Z_STRVAL($2)); #endif - ZEND_INI_PARSER_CB(&$1, &$3, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); + ZEND_INI_PARSER_CB(&$2, NULL, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG TSRMLS_CC); + free(Z_STRVAL($2)); + } + | TC_LABEL '=' string_or_value { +#if DEBUG_CFG_PARSER + printf("NORMAL: '%s' = '%s'\n", Z_STRVAL($1), Z_STRVAL($3)); +#endif + ZEND_INI_PARSER_CB(&$1, &$3, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); free(Z_STRVAL($1)); free(Z_STRVAL($3)); } - | TC_STRING BRACK '=' string_or_value { + | TC_OFFSET option_offset ']' '=' string_or_value { #if DEBUG_CFG_PARSER - printf("'%s'[ ] = '%s'\n", Z_STRVAL($1), Z_STRVAL($4)); + printf("OFFSET: '%s'[%s] = '%s'\n", Z_STRVAL($1), Z_STRVAL($2), Z_STRVAL($5)); #endif - ZEND_INI_PARSER_CB(&$1, &$4, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG); + ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); free(Z_STRVAL($1)); - free(Z_STRVAL($4)); + free(Z_STRVAL($2)); + free(Z_STRVAL($5)); } - | TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free(Z_STRVAL($1)); } - | SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free(Z_STRVAL($1)); } - | '\n' + | TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); free(Z_STRVAL($1)); } + | END_OF_LINE ; +section_string_or_value: + var_string_list { $$ = $1; } + | /* empty */ { zend_ini_init_string(&$$); } +; string_or_value: - expr { $$ = $1; } - | CFG_TRUE { $$ = $1; } - | CFG_FALSE { $$ = $1; } - | '\n' { zend_ini_init_string(&$$); } - | /* empty */ { zend_ini_init_string(&$$); } + expr { $$ = $1; } + | BOOL_TRUE { $$ = $1; } + | BOOL_FALSE { $$ = $1; } + | END_OF_LINE { zend_ini_init_string(&$$); } ; +option_offset: + var_string_list { $$ = $1; } + | /* empty */ { zend_ini_init_string(&$$); } +; -var_string_list: - cfg_var_ref { $$ = $1; } - | TC_ENCAPSULATED_STRING { $$ = $1; } - | constant_string { $$ = $1; } - | var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); } - | var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$, &$1, &$2); free(Z_STRVAL($2)); } - | var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); } +encapsed_list: + encapsed_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free(Z_STRVAL($2)); } + | encapsed_list TC_QUOTED_STRING { zend_ini_add_string(&$$, &$1, &$2); free(Z_STRVAL($2)); } + | /* empty */ { zend_ini_init_string(&$$); } ; -cfg_var_ref: - TC_DOLLAR_CURLY TC_STRING '}' { zend_ini_get_var(&$$, &$2); free($2.value.str.val); } +var_string_list: + cfg_var_ref { $$ = $1; } + | constant_string { $$ = $1; } + | '"' encapsed_list '"' { $$ = $2; } + | var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free(Z_STRVAL($2)); } + | var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); free(Z_STRVAL($2)); } + | var_string_list '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); free(Z_STRVAL($3)); } ; expr: - var_string_list { $$ = $1; } - | expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); } - | expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); } - | '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); } - | '!' expr { zend_ini_do_op('!', &$$, &$2, NULL); } - | '(' expr ')' { $$ = $2; } + var_string_list { $$ = $1; } + | expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); } + | expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); } + | '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); } + | '!' expr { zend_ini_do_op('!', &$$, &$2, NULL); } + | '(' expr ')' { $$ = $2; } +; + +cfg_var_ref: + TC_DOLLAR_CURLY TC_VARNAME '}' { zend_ini_get_var(&$$, &$2 TSRMLS_CC); free(Z_STRVAL($2)); } ; constant_string: - TC_STRING { zend_ini_get_constant(&$$, &$1); } + TC_CONSTANT { zend_ini_get_constant(&$$, &$1 TSRMLS_CC); } + | TC_RAW { $$ = $1; /*printf("TC_RAW: '%s'\n", Z_STRVAL($1));*/ } + | TC_NUMBER { $$ = $1; /*printf("TC_NUMBER: '%s'\n", Z_STRVAL($1));*/ } + | TC_STRING { $$ = $1; /*printf("TC_STRING: '%s'\n", Z_STRVAL($1));*/ } + | TC_WHITESPACE { $$ = $1; /*printf("TC_WHITESPACE: '%s'\n", Z_STRVAL($1));*/ } ; /* diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index 57f018cee..9f0a3b40f 100644 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@ -1,490 +1,10 @@ -#define yy_create_buffer ini__create_buffer -#define yy_delete_buffer ini__delete_buffer -#define yy_scan_buffer ini__scan_buffer -#define yy_scan_string ini__scan_string -#define yy_scan_bytes ini__scan_bytes -#define yy_flex_debug ini__flex_debug -#define yy_init_buffer ini__init_buffer -#define yy_flush_buffer ini__flush_buffer -#define yy_load_buffer_state ini__load_buffer_state -#define yy_switch_to_buffer ini__switch_to_buffer -#define yyin ini_in -#define yyleng ini_leng -#define yylex ini_lex -#define yyout ini_out -#define yyrestart ini_restart -#define yytext ini_text - -/* A Lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /repository/ZendEngine2/Attic/flex.skl,v 1.31 2003/08/11 05:24:41 fujimoto Exp $ - * vim:ft=lex: - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#if HAVE_UNISTD_H -#include -#endif - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -#undef YY_USE_PROTOS -#define YY_USE_PROTOS - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( SCNG(yy_in) TSRMLS_CC ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; - - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr TSRMLS_CC ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - struct _zend_file_handle *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -#define yy_current_buffer SCNG(current_buffer) -#define yy_hold_char SCNG(_yy_hold_char) - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ - -#if 0 -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -#endif - -/* Points to current character in buffer. */ -#define yy_c_buf_p SCNG(c_buf_p) -#define yy_init SCNG(init) -#define yy_start SCNG(start) - -#ifdef ZTS -#define TSRMLS_D void ***tsrm_ls -#define TSRMLS_DC , TSRMLS_D -#define TSRMLS_C tsrm_ls -#define TSRMLS_CC , TSRMLS_C -#else -#define TSRMLS_D -#define TSRMLS_DC -#define TSRMLS_C -#define TSRMLS_CC -#endif - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -/* static int yy_did_buffer_switch_on_eof; */ -#define yy_did_buffer_switch_on_eof SCNG(_yy_did_buffer_switch_on_eof) - -void yyrestart YY_PROTO(( struct _zend_file_handle *input_file TSRMLS_DC )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer TSRMLS_DC )); -void yy_load_buffer_state YY_PROTO(( TSRMLS_D )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( struct _zend_file_handle *file, int size TSRMLS_DC )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer TSRMLS_CC ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size TSRMLS_DC )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str TSRMLS_DC )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len TSRMLS_DC )); - - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - - -#define yywrap() 1 -#define YY_SKIP_YYWRAP -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext -#undef yyleng -#define yyleng SCNG(yy_leng) -#undef yytext -#define yytext SCNG(yy_text) -#undef yytext_ptr -#define yytext_ptr SCNG(yy_text) -#undef yyin -#define yyin SCNG(yy_in) -#undef yyout -#define yyout SCNG(yy_out) -#undef yy_last_accepting_state -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#undef yy_last_accepting_cpos -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#undef yy_more_flag -#define yy_more_flag SCNG(_yy_more_flag) -#undef yy_more_len -#define yy_more_len SCNG(_yy_more_len) - - -static yy_state_type yy_get_previous_state YY_PROTO(( TSRMLS_D )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state TSRMLS_DC )); -static int yy_get_next_buffer YY_PROTO(( TSRMLS_D )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -#undef TSRMLS_D -#undef TSRMLS_DC -#undef TSRMLS_C -#undef TSRMLS_CC - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#undef yyleng -#undef yytext -#undef yytext_ptr -#undef yyin -#undef yyout -#undef yy_last_accepting_state -#undef yy_last_accepting_cpos -#undef yy_more_flag -#undef yy_more_len - - -#define YY_NUM_RULES 15 -#define YY_END_OF_BUFFER 16 -static yyconst short int yy_accept[63] = - { 0, - 0, 0, 16, 9, 13, 10, 11, 9, 8, 14, - 8, 12, 10, 14, 9, 9, 9, 9, 9, 7, - 9, 11, 9, 0, 9, 9, 9, 9, 9, 0, - 5, 6, 12, 12, 12, 0, 0, 1, 9, 3, - 9, 9, 2, 9, 9, 0, 4, 1, 1, 9, - 3, 9, 9, 3, 2, 9, 4, 4, 4, 1, - 9, 0 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 5, 6, 7, 1, 8, 1, 6, 1, 6, - 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 9, 1, - 10, 1, 1, 1, 13, 1, 1, 1, 14, 15, - 1, 1, 1, 1, 1, 16, 1, 17, 18, 1, - 1, 19, 20, 21, 22, 1, 1, 1, 23, 1, - 11, 1, 12, 1, 1, 1, 13, 1, 1, 1, - - 14, 15, 1, 1, 1, 1, 1, 16, 1, 17, - 18, 1, 1, 19, 20, 21, 22, 1, 1, 1, - 23, 1, 24, 6, 25, 6, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[26] = - { 0, - 1, 2, 3, 2, 1, 2, 2, 2, 2, 2, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2 - } ; - -static yyconst short int yy_base[67] = - { 0, - 0, 0, 105, 0, 106, 106, 101, 21, 106, 96, - 78, 24, 106, 25, 88, 11, 26, 81, 85, 106, - 0, 106, 0, 35, 85, 13, 31, 78, 82, 88, - 106, 106, 46, 106, 91, 81, 40, 87, 75, 46, - 74, 74, 83, 65, 66, 48, 51, 54, 80, 64, - 78, 68, 65, 75, 74, 64, 106, 59, 61, 64, - 47, 106, 33, 69, 72, 75 - } ; - -static yyconst short int yy_def[67] = - { 0, - 62, 1, 62, 63, 62, 62, 62, 63, 62, 64, - 62, 65, 62, 66, 63, 63, 63, 63, 63, 62, - 63, 62, 8, 62, 63, 63, 63, 63, 63, 64, - 62, 62, 65, 62, 62, 66, 66, 62, 63, 63, - 63, 63, 63, 63, 63, 62, 62, 62, 62, 63, - 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, - 63, 0, 62, 62, 62, 62 - } ; - -static yyconst short int yy_nxt[132] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 4, 4, 4, 15, 4, 16, 17, 4, 4, - 18, 4, 19, 9, 20, 23, 34, 35, 40, 37, - 40, 24, 41, 21, 41, 25, 38, 26, 27, 46, - 42, 28, 43, 29, 37, 42, 38, 43, 34, 35, - 51, 48, 46, 57, 58, 59, 57, 58, 60, 38, - 54, 57, 52, 57, 58, 59, 57, 58, 60, 30, - 30, 30, 33, 33, 33, 36, 36, 43, 55, 51, - 54, 54, 51, 61, 49, 43, 56, 55, 54, 53, - 50, 49, 47, 34, 31, 45, 44, 39, 45, 44, - - 39, 32, 31, 22, 62, 3, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62 - } ; - -static yyconst short int yy_chk[132] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 8, 12, 12, 16, 14, - 26, 8, 16, 63, 26, 8, 14, 8, 8, 24, - 17, 8, 17, 8, 37, 27, 24, 27, 33, 33, - 40, 37, 46, 47, 47, 47, 48, 48, 48, 46, - 61, 58, 40, 59, 59, 59, 60, 60, 60, 64, - 64, 64, 65, 65, 65, 66, 66, 56, 55, 54, - 53, 52, 51, 50, 49, 45, 44, 43, 42, 41, - 39, 38, 36, 35, 30, 29, 28, 25, 19, 18, - - 15, 11, 10, 7, 3, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#define INITIAL 0 +/* Generated by re2c 0.13.6.dev on Mon Feb 2 19:23:18 2009 */ +#line 1 "Zend/zend_ini_scanner.l" /* +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -494,21 +14,15 @@ char *yytext; | obtain it through the world-wide-web, please send a note to | | license@zend.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Zeev Suraski | + | Authors: Zeev Suraski | + | Jani Taskinen | + | Marcus Boerger | + | Nuno Lopes | + | Scott MacVicar | +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_scanner.l,v 1.41.2.2.2.2 2007/07/23 16:17:10 jani Exp $ */ - -#define yyleng SCNG(yy_leng) -#define yytext SCNG(yy_text) -#define yytext_ptr SCNG(yy_text) -#define yyin SCNG(yy_in) -#define yyout SCNG(yy_out) -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#define yy_more_flag SCNG(_yy_more_flag) -#define yy_more_len SCNG(_yy_more_len) +/* $Id: zend_ini_scanner.c,v 1.1.2.17 2009/02/14 21:20:14 rasmus Exp $ */ #include #include "zend.h" @@ -516,1428 +30,4448 @@ char *yytext; #include #include "zend_ini_scanner.h" -#undef YYSTYPE -#define YYSTYPE zval +#if 0 +# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c) +#else +# define YYDEBUG(s, c) +#endif + +#include "zend_ini_scanner_defs.h" + +#define YYCTYPE unsigned char +/* allow the scanner to read one null byte after the end of the string (from ZEND_MMAP_AHEAD) + * so that if will be able to terminate to match the current token (e.g. non-enclosed string) */ +#define YYFILL(n) { if (YYCURSOR > YYLIMIT) return 0; } +#define YYCURSOR SCNG(yy_cursor) +#define YYLIMIT SCNG(yy_limit) +#define YYMARKER SCNG(yy_marker) + +#define YYGETCONDITION() SCNG(yy_state) +#define YYSETCONDITION(s) SCNG(yy_state) = s + +#define STATE(name) yyc##name + +/* emulate flex constructs */ +#define BEGIN(state) YYSETCONDITION(STATE(state)) +#define YYSTATE YYGETCONDITION() +#define yytext ((char*)SCNG(yy_text)) +#define yyleng SCNG(yy_leng) +#define yyless(x) YYCURSOR = yytext + x +/* #define yymore() goto yymore_restart */ + +/* perform sanity check. If this message is triggered you should + increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */ +#define YYMAXFILL 6 +#if ZEND_MMAP_AHEAD < (YYMAXFILL + 1) +# error ZEND_MMAP_AHEAD should be greater than YYMAXFILL +#endif + -#define YY_DECL int ini_lex(zval *ini_lval TSRMLS_DC) +/* How it works (for the core ini directives): + * =========================================== + * + * 1. Scanner scans file for tokens and passes them to parser. + * 2. Parser parses the tokens and passes the name/value pairs to the callback + * function which stores them in the configuration hash table. + * 3. Later REGISTER_INI_ENTRIES() is called which triggers the actual + * registering of ini entries and uses zend_get_configuration_directive() + * to fetch the previously stored name/value pair from configuration hash table + * and registers the static ini entries which match the name to the value + * into EG(ini_directives) hash table. + * 4. PATH section entries are used per-request from down to top, each overriding + * previous if one exists. zend_alter_ini_entry() is called for each entry. + * Settings in PATH section are ZEND_INI_SYSTEM accessible and thus mimics the + * php_admin_* directives used within Apache httpd.conf when PHP is compiled as + * module for Apache. + * 5. User defined ini files (like .htaccess for apache) are parsed for each request and + * stored in separate hash defined by SAPI. + */ + +/* TODO: (ordered by importance :-) + * =============================================================================== + * + * - Separate constant lookup totally from plain strings (using CONSTANT pattern) + * - Add #if .. #else .. #endif and ==, !=, <, > , <=, >= operators + * - Add #include "some.ini" + * - Allow variables to refer to options also when using parse_ini_file() + * + */ /* Globals Macros */ #define SCNG INI_SCNG #ifdef ZTS ZEND_API ts_rsrc_id ini_scanner_globals_id; #else -ZEND_API zend_scanner_globals ini_scanner_globals; +ZEND_API zend_ini_scanner_globals ini_scanner_globals; #endif -# define YY_INPUT(buf, result, max_size) \ - if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \ - && zend_stream_ferror( yyin TSRMLS_CC) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); +/* Eat trailing whitespace + extra char */ +#define EAT_TRAILING_WHITESPACE_EX(ch) \ + while (yyleng > 0 && ( \ + (ch != 'X' && yytext[yyleng - 1] == ch) || \ + yytext[yyleng - 1] == '\n' || \ + yytext[yyleng - 1] == '\r' || \ + yytext[yyleng - 1] == '\t' || \ + yytext[yyleng - 1] == ' ') \ + ) { \ + yyleng--; \ + } + +/* Eat trailing whitespace */ +#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X') -static char *ini_filename; +#define zend_ini_copy_value(retval, str, len) { \ + Z_STRVAL_P(retval) = zend_strndup(str, len); \ + Z_STRLEN_P(retval) = len; \ + Z_TYPE_P(retval) = IS_STRING; \ +} + +#define RETURN_TOKEN(type, str, len) { \ + zend_ini_copy_value(ini_lval, str, len); \ + return type; \ +} + +static void _yy_push_state(int new_state TSRMLS_DC) +{ + zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int)); + YYSETCONDITION(new_state); +} + +#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm) + +static void yy_pop_state(TSRMLS_D) +{ + int *stack_state; + zend_stack_top(&SCNG(state_stack), (void **) &stack_state); + YYSETCONDITION(*stack_state); + zend_stack_del_top(&SCNG(state_stack)); +} + +static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC) +{ + YYCURSOR = (YYCTYPE*)str; + SCNG(yy_start) = YYCURSOR; + YYLIMIT = YYCURSOR + len; +} + +#define ini_filename SCNG(filename) + +/* {{{ init_ini_scanner() +*/ +static void init_ini_scanner(TSRMLS_D) +{ + SCNG(lineno) = 1; + SCNG(scanner_mode) = ZEND_INI_SCANNER_NORMAL; + zend_stack_init(&SCNG(state_stack)); + BEGIN(INITIAL); +} +/* }}} */ -void init_ini_scanner(TSRMLS_D) +/* {{{ shutdown_ini_scanner() +*/ +void shutdown_ini_scanner(TSRMLS_D) { - SCNG(lineno)=1; + zend_stack_destroy(&SCNG(state_stack)); + if (ini_filename) { + free(ini_filename); + } } +/* }}} */ +/* {{{ zend_ini_scanner_get_lineno() +*/ int zend_ini_scanner_get_lineno(TSRMLS_D) { return SCNG(lineno); } +/* }}} */ +/* {{{ zend_ini_scanner_get_filename() +*/ char *zend_ini_scanner_get_filename(TSRMLS_D) { - return ini_filename; + return ini_filename ? ini_filename : "Unknown"; } +/* }}} */ -int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC) +/* {{{ zend_ini_open_file_for_scanning() +*/ +int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC) { - if (FAILURE == zend_stream_fixup(fh TSRMLS_CC)) { + char *buf; + size_t size; + + if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) { return FAILURE; } init_ini_scanner(TSRMLS_C); - yyin = fh; - yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC); - ini_filename = fh->filename; + SCNG(scanner_mode) = scanner_mode; + SCNG(yy_in) = fh; + yy_scan_buffer(buf, size TSRMLS_CC); + ini_filename = zend_strndup(fh->filename, strlen(fh->filename)); return SUCCESS; } +/* }}} */ -int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC) +/* {{{ zend_ini_prepare_string_for_scanning() +*/ +int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC) { int len = strlen(str); - yyin = NULL; - yy_scan_buffer(str, len + 2 TSRMLS_CC); + init_ini_scanner(TSRMLS_C); + SCNG(scanner_mode) = scanner_mode; + SCNG(yy_in) = NULL; + yy_scan_buffer(str, len TSRMLS_CC); ini_filename = NULL; return SUCCESS; } +/* }}} */ -void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC) -{ - zend_stream_close(fh); -} - -#define YY_NEVER_INTERACTIVE 1 - -/* Macros after this point can all be overridden by user definitions in - * section 1. +/* {{{ zend_ini_escape_string() */ +static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC) +{ + register char *s, *t; + char *end; -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr TSRMLS_DC )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int 3 YY_PROTO(( TSRMLS_D )); -#else -static int input YY_PROTO(( TSRMLS_D )); -#endif -#endif - -#if YY_STACK_USED -#define yy_start_stack_ptr SCNG(yy_start_stack_ptr) -#define yy_start_stack_depth SCNG(yy_start_stack_depth) -#define yy_start_stack SCNG(yy_start_stack) -/* -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -*/ -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state TSRMLS_DC )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( TSRMLS_D )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( TSRMLS_D )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -/* Zend file handle reading */ -#ifndef ECHO -#define ECHO /* There is no output */ -#endif - -#ifdef ZEND_MULTIBYTE -# define YY_INPUT(buf, result, max_size) \ - if ( ((result = zend_multibyte_yyinput(yyin, buf, max_size TSRMLS_CC)) == 0) \ - && zend_stream_ferror( yyin TSRMLS_CC) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#else -# define YY_INPUT(buf, result, max_size) \ - if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \ - && zend_stream_ferror( yyin TSRMLS_CC) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif + zend_ini_copy_value(lval, str, len); -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yy_out) ) -#endif + /* convert escape sequences */ + s = t = Z_STRVAL_P(lval); + end = s + Z_STRLEN_P(lval); -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ + while (s < end) { + if (*s == '\\') { + s++; + if (s >= end) { + *t++ = '\\'; + continue; + } + switch (*s) { + case '"': + if (*s != quote_type) { + *t++ = '\\'; + *t++ = *s; + break; + } + case '\\': + case '$': + *t++ = *s; + Z_STRLEN_P(lval)--; + break; + default: + *t++ = '\\'; + *t++ = *s; + break; + } + } else { + *t++ = *s; } -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - - - - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - -#if 0 - if ( ! SCNG(yy_in) ) - SCNG(yy_in) = stdin; - - if ( ! SCNG(yy_out) ) - SCNG(yy_out) = stdout; -#endif - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); - - yy_load_buffer_state(TSRMLS_C); + if (*s == '\n' || (*s == '\r' && (*(s+1) != '\n'))) { + SCNG(lineno)++; } + s++; + } + *t = 0; +} +/* }}} */ - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; +int ini_lex(zval *ini_lval TSRMLS_DC) +{ +restart: + SCNG(yy_text) = YYCURSOR; + +/* yymore_restart: */ + /* detect EOF */ + if (YYCURSOR >= YYLIMIT) { + if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) { + BEGIN(INITIAL); + return 0; + } + return 0; + } - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 63 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 106 ); + /* Eat any UTF-8 BOM we find in the first 3 bytes */ + if (YYCURSOR == SCNG(yy_start) && YYCURSOR + 3 < YYLIMIT) { + if (memcmp(YYCURSOR, "\xef\xbb\xbf", 3) == 0) { + YYCURSOR += 3; + goto restart; + } + } -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; +#line 305 "Zend/zend_ini_scanner.c" +{ + YYCTYPE yych; + unsigned int yyaccept = 0; + if (YYGETCONDITION() < 4) { + if (YYGETCONDITION() < 2) { + if (YYGETCONDITION() < 1) { + goto yyc_INITIAL; + } else { + goto yyc_ST_OFFSET; } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -{ - return BRACK; -} - YY_BREAK -case 2: -YY_RULE_SETUP -{ - Z_STRVAL_P(ini_lval) = zend_strndup("1", 1); - Z_STRLEN_P(ini_lval) = 1; - Z_TYPE_P(ini_lval) = IS_STRING; - return CFG_TRUE; -} - YY_BREAK -case 3: -YY_RULE_SETUP -{ - Z_STRVAL_P(ini_lval) = zend_strndup("", 0); - Z_STRLEN_P(ini_lval) = 0; - Z_TYPE_P(ini_lval) = IS_STRING; - return CFG_FALSE; -} - YY_BREAK -case 4: -YY_RULE_SETUP -{ - /* SECTION */ - - /* eat trailing ] and spaces */ - while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']' || yytext[yyleng-1]==' ')) { - yyleng--; - yytext[yyleng]=0; + } else { + if (YYGETCONDITION() < 3) { + goto yyc_ST_SECTION_VALUE; + } else { + goto yyc_ST_VALUE; + } + } + } else { + if (YYGETCONDITION() < 6) { + if (YYGETCONDITION() < 5) { + goto yyc_ST_SECTION_RAW; + } else { + goto yyc_ST_DOUBLE_QUOTES; + } + } else { + if (YYGETCONDITION() < 7) { + goto yyc_ST_VARNAME; + } else { + goto yyc_ST_RAW; + } + } } - +/* *********************************** */ +yyc_INITIAL: + { + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 192, 0, 128, 128, 0, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 192, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 160, 128, 128, 160, 160, 128, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 128, 128, 128, 128, 128, 128, + 128, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 128, 128, 128, 128, 160, + 128, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + YYDEBUG(1, *YYCURSOR); + YYFILL(6); + yych = *YYCURSOR; + YYDEBUG(-1, yych); + switch (yych) { + case '\t': + case ' ': goto yy5; + case '\n': goto yy7; + case '\r': goto yy9; + case '!': + case '"': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case '<': + case '>': + case '?': + case '@': + case ']': + case '^': + case '{': + case '|': + case '}': + case '~': goto yy10; + case '#': goto yy12; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'p': + case 'q': + case 'r': + case 's': + case 'u': + case 'v': + case 'w': + case 'x': + case 'z': goto yy13; + case ';': goto yy15; + case '=': goto yy16; + case 'F': + case 'f': goto yy18; + case 'N': + case 'n': goto yy19; + case 'O': + case 'o': goto yy20; + case 'T': + case 't': goto yy21; + case 'Y': + case 'y': goto yy22; + case '[': goto yy23; + default: goto yy3; + } +yy3: + YYDEBUG(3, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(4, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 502 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 487 "Zend/zend_ini_scanner.c" +yy5: + YYDEBUG(5, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy63; +yy6: + YYDEBUG(6, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 474 "Zend/zend_ini_scanner.l" + { + /* eat whitespace */ + goto restart; +} +#line 501 "Zend/zend_ini_scanner.c" +yy7: + YYDEBUG(7, *YYCURSOR); + ++YYCURSOR; +yy8: + YYDEBUG(8, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 479 "Zend/zend_ini_scanner.l" + { SCNG(lineno)++; - - /* eat leading [ */ - yytext++; - yyleng--; - - Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng); - Z_STRLEN_P(ini_lval) = yyleng; - Z_TYPE_P(ini_lval) = IS_STRING; - return SECTION; -} - YY_BREAK -case 5: -YY_RULE_SETUP -{ - char *p = yytext; - - /* ENCAPSULATED TC_STRING */ - - while ((p = strpbrk(p, "\r\n"))) { - if (*p == '\r' && *(p + 1) == '\n') { - p++; + return END_OF_LINE; +} +#line 513 "Zend/zend_ini_scanner.c" +yy9: + YYDEBUG(9, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy61; + goto yy8; +yy10: + YYDEBUG(10, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(11, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 429 "Zend/zend_ini_scanner.l" + { /* Disallow these chars outside option values */ + return yytext[0]; +} +#line 528 "Zend/zend_ini_scanner.c" +yy12: + YYDEBUG(12, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy57; +yy13: + YYDEBUG(13, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy26; +yy14: + YYDEBUG(14, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 389 "Zend/zend_ini_scanner.l" + { /* Get option name */ + RETURN_TOKEN(TC_LABEL, yytext, yyleng); +} +#line 546 "Zend/zend_ini_scanner.c" +yy15: + YYDEBUG(15, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy52; +yy16: + YYDEBUG(16, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy50; +yy17: + YYDEBUG(17, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 393 "Zend/zend_ini_scanner.l" + { /* Start option value */ + if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { + yy_push_state(ST_RAW TSRMLS_CC); + } else { + yy_push_state(ST_VALUE TSRMLS_CC); + } + return '='; +} +#line 569 "Zend/zend_ini_scanner.c" +yy18: + YYDEBUG(18, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy46; + if (yych == 'a') goto yy46; + goto yy26; +yy19: + YYDEBUG(19, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'U') { + if (yych == 'O') goto yy42; + if (yych <= 'T') goto yy26; + goto yy43; + } else { + if (yych <= 'o') { + if (yych <= 'n') goto yy26; + goto yy42; + } else { + if (yych == 'u') goto yy43; + goto yy26; + } + } +yy20: + YYDEBUG(20, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'N') { + if (yych == 'F') goto yy37; + if (yych <= 'M') goto yy26; + goto yy31; + } else { + if (yych <= 'f') { + if (yych <= 'e') goto yy26; + goto yy37; + } else { + if (yych == 'n') goto yy31; + goto yy26; + } } - SCNG(lineno)++; - p++; +yy21: + YYDEBUG(21, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy35; + if (yych == 'r') goto yy35; + goto yy26; +yy22: + YYDEBUG(22, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy27; + if (yych == 'e') goto yy27; + goto yy26; +yy23: + YYDEBUG(23, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(24, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 327 "Zend/zend_ini_scanner.l" + { /* Section start */ + /* Enter section data lookup state */ + if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { + yy_push_state(ST_SECTION_RAW TSRMLS_CC); + } else { + yy_push_state(ST_SECTION_VALUE TSRMLS_CC); } + return TC_SECTION; +} +#line 635 "Zend/zend_ini_scanner.c" +yy25: + YYDEBUG(25, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy26: + YYDEBUG(26, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy25; + } + if (yych == '[') goto yy28; + goto yy14; +yy27: + YYDEBUG(27, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy31; + if (yych == 's') goto yy31; + goto yy26; +yy28: + YYDEBUG(28, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(29, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy28; + } + YYDEBUG(30, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 352 "Zend/zend_ini_scanner.l" + { /* Start of option with offset */ + /* Eat trailing whitespace and [ */ + EAT_TRAILING_WHITESPACE_EX('['); - /* eat trailing " */ - yytext[yyleng-1]=0; - - /* eat leading " */ - yytext++; + /* Enter offset lookup state */ + yy_push_state(ST_OFFSET TSRMLS_CC); - Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng - 2); - Z_STRLEN_P(ini_lval) = yyleng - 2; - Z_TYPE_P(ini_lval) = IS_STRING; - return TC_ENCAPSULATED_STRING; -} - YY_BREAK -case 6: -YY_RULE_SETUP -{ - return TC_DOLLAR_CURLY; + RETURN_TOKEN(TC_OFFSET, yytext, yyleng); } - YY_BREAK -case 7: -YY_RULE_SETUP -{ - Z_LVAL_P(ini_lval) = (long) yytext[0]; - return yytext[0]; +#line 675 "Zend/zend_ini_scanner.c" +yy31: + YYDEBUG(31, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 32) { + goto yy25; + } + if (yych == '[') goto yy28; + goto yy34; +yy32: + YYDEBUG(32, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 381 "Zend/zend_ini_scanner.l" + { /* TRUE value (when used outside option value/offset this causes parse error!) */ + RETURN_TOKEN(BOOL_TRUE, "1", 1); } - YY_BREAK -case 8: -YY_RULE_SETUP -{ - return yytext[0]; +#line 691 "Zend/zend_ini_scanner.c" +yy33: + YYDEBUG(33, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy34: + YYDEBUG(34, *YYCURSOR); + if (yych == '\t') goto yy33; + if (yych == ' ') goto yy33; + goto yy32; +yy35: + YYDEBUG(35, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy36; + if (yych != 'u') goto yy26; +yy36: + YYDEBUG(36, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy31; + if (yych == 'e') goto yy31; + goto yy26; +yy37: + YYDEBUG(37, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy38; + if (yych != 'f') goto yy26; +yy38: + YYDEBUG(38, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 32) { + goto yy25; + } + if (yych == '[') goto yy28; + goto yy41; +yy39: + YYDEBUG(39, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 385 "Zend/zend_ini_scanner.l" + { /* FALSE value (when used outside option value/offset this causes parse error!)*/ + RETURN_TOKEN(BOOL_FALSE, "", 0); } - YY_BREAK -case 9: -YY_RULE_SETUP -{ - /* STRING */ - register int i; - - /* eat trailing whitespace */ - for (i=yyleng-1; i>=0; i--) { - if (yytext[i]==' ' || yytext[i]=='\t') { - yytext[i]=0; - yyleng--; +#line 733 "Zend/zend_ini_scanner.c" +yy40: + YYDEBUG(40, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy41: + YYDEBUG(41, *YYCURSOR); + if (yych == '\t') goto yy40; + if (yych == ' ') goto yy40; + goto yy39; +yy42: + YYDEBUG(42, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'N') { + if (yych <= '.') { + if (yych == '*') goto yy25; + if (yych <= ',') goto yy41; + goto yy25; + } else { + if (yych <= '9') { + if (yych <= '/') goto yy41; + goto yy25; + } else { + if (yych <= '@') goto yy41; + if (yych <= 'M') goto yy25; + goto yy45; + } + } + } else { + if (yych <= '_') { + if (yych <= 'Z') goto yy25; + if (yych <= '[') goto yy28; + if (yych <= '^') goto yy41; + goto yy25; + } else { + if (yych <= 'm') { + if (yych <= '`') goto yy41; + goto yy25; + } else { + if (yych <= 'n') goto yy45; + if (yych <= 'z') goto yy25; + goto yy41; + } + } + } +yy43: + YYDEBUG(43, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy44; + if (yych != 'l') goto yy26; +yy44: + YYDEBUG(44, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy38; + if (yych == 'l') goto yy38; + goto yy26; +yy45: + YYDEBUG(45, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy38; + if (yych == 'e') goto yy38; + goto yy26; +yy46: + YYDEBUG(46, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy47; + if (yych != 'l') goto yy26; +yy47: + YYDEBUG(47, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy48; + if (yych != 's') goto yy26; +yy48: + YYDEBUG(48, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy38; + if (yych == 'e') goto yy38; + goto yy26; +yy49: + YYDEBUG(49, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy50: + YYDEBUG(50, *YYCURSOR); + if (yych == '\t') goto yy49; + if (yych == ' ') goto yy49; + goto yy17; +yy51: + YYDEBUG(51, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy52: + YYDEBUG(52, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy51; + } + if (yych >= '\r') goto yy55; +yy53: + YYDEBUG(53, *YYCURSOR); + ++YYCURSOR; +yy54: + YYDEBUG(54, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 484 "Zend/zend_ini_scanner.l" + { /* Comment */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 845 "Zend/zend_ini_scanner.c" +yy55: + YYDEBUG(55, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy53; + goto yy54; +yy56: + YYDEBUG(56, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy57: + YYDEBUG(57, *YYCURSOR); + if (yych == '\n') goto yy58; + if (yych == '\r') goto yy60; + goto yy56; +yy58: + YYDEBUG(58, *YYCURSOR); + ++YYCURSOR; +yy59: + YYDEBUG(59, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 490 "Zend/zend_ini_scanner.l" + { /* #Comment */ + zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno)); + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 874 "Zend/zend_ini_scanner.c" +yy60: + YYDEBUG(60, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy58; + goto yy59; +yy61: + YYDEBUG(61, *YYCURSOR); + yych = *++YYCURSOR; + goto yy8; +yy62: + YYDEBUG(62, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy63: + YYDEBUG(63, *YYCURSOR); + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x08) goto yy6; + if (yych <= '\t') goto yy62; + goto yy61; + } else { + if (yych == '\r') goto yy64; + if (yych <= 0x1F) goto yy6; + goto yy62; + } } else { - break; + if (yych <= ':') { + if (yych == '#') goto yy56; + goto yy6; + } else { + if (yych <= ';') goto yy51; + if (yych == '=') goto yy49; + goto yy6; + } } +yy64: + YYDEBUG(64, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy61; + goto yy8; } - /* eat leading whitespace */ - while (yytext[0]) { - if (yytext[0]==' ' || yytext[0]=='\t') { - yytext++; - yyleng--; +/* *********************************** */ +yyc_ST_DOUBLE_QUOTES: + { + static const unsigned char yybm[] = { + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 144, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 144, 16, 0, 16, 32, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 64, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + }; + YYDEBUG(65, *YYCURSOR); + YYFILL(3); + yych = *YYCURSOR; + if (yych <= '#') { + if (yych == '"') goto yy69; } else { - break; + if (yych <= '$') goto yy71; + if (yych == '\\') goto yy73; } + YYDEBUG(67, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy77; +yy68: + YYDEBUG(68, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 456 "Zend/zend_ini_scanner.l" + { /* Escape double quoted string contents */ + if(yyleng > 1 && yytext[yyleng-1] == '"' && yytext[yyleng-2] == '\\') { + yyless(yyleng-1); + yyleng--; } - if (yyleng!=0) { - Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng); - Z_STRLEN_P(ini_lval) = yyleng; - Z_TYPE_P(ini_lval) = IS_STRING; - return TC_STRING; - } else { - /* whitespace */ - } + zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC); + return TC_QUOTED_STRING; } - YY_BREAK -case 10: -YY_RULE_SETUP -{ - if (yytext[0] == '\n') { - SCNG(lineno)++; +#line 980 "Zend/zend_ini_scanner.c" +yy69: + YYDEBUG(69, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy91; +yy70: + YYDEBUG(70, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 465 "Zend/zend_ini_scanner.l" + { /* Double quoted '"' string ends */ + yy_pop_state(TSRMLS_C); + return '"'; +} +#line 994 "Zend/zend_ini_scanner.c" +yy71: + YYDEBUG(71, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '\\') { + if (yych <= 0x00) goto yy72; + if (yych <= '[') goto yy76; + goto yy80; + } else { + if (yych == '{') goto yy88; + goto yy76; + } +yy72: + YYDEBUG(72, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 502 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 1013 "Zend/zend_ini_scanner.c" +yy73: + YYDEBUG(73, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != '"') goto yy76; + YYDEBUG(74, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy75; + if (yych != '\r') goto yy76; +yy75: + YYDEBUG(75, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept == 0) { + goto yy68; + } else { + goto yy72; + } +yy76: + YYDEBUG(76, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy77: + YYDEBUG(77, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy76; + } + if (yych <= '#') goto yy68; + if (yych <= '$') goto yy79; + YYDEBUG(78, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych == '"') goto yy85; + goto yy76; +yy79: + YYDEBUG(79, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy75; + if (yych <= '[') goto yy76; + } else { + if (yych == '{') goto yy75; + goto yy76; + } +yy80: + YYDEBUG(80, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy81; + } + if (yych == '\\') goto yy83; + goto yy76; +yy81: + YYDEBUG(81, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(82, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy81; + } + if (yych == '\\') goto yy86; + goto yy76; +yy83: + YYDEBUG(83, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(84, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy76; + } + if (yych <= '#') goto yy85; + if (yych <= '$') goto yy81; + goto yy83; +yy85: + YYDEBUG(85, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych == '\n') goto yy68; + if (yych == '\r') goto yy68; + goto yy76; +yy86: + YYDEBUG(86, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy76; + } + if (yych <= '#') goto yy87; + if (yych <= '$') goto yy81; + goto yy83; +yy87: + YYDEBUG(87, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy81; + } + if (yych == '\\') goto yy83; + goto yy76; +yy88: + YYDEBUG(88, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(89, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 367 "Zend/zend_ini_scanner.l" + { /* Variable start */ + yy_push_state(ST_VARNAME TSRMLS_CC); + return TC_DOLLAR_CURLY; +} +#line 1134 "Zend/zend_ini_scanner.c" +yy90: + YYDEBUG(90, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy91: + YYDEBUG(91, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy90; + } + goto yy70; } - return yytext[0]; +/* *********************************** */ +yyc_ST_OFFSET: + { + static const unsigned char yybm[] = { + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 194, 64, 66, 66, 64, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 194, 66, 64, 66, 68, 66, 66, 0, + 66, 66, 66, 66, 66, 66, 66, 66, + 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 66, 64, 66, 66, 66, 66, + 66, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 66, 72, 64, 66, 82, + 66, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + }; + YYDEBUG(92, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= ',') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x08) goto yy94; + if (yych <= '\t') goto yy96; + goto yy97; + } else { + if (yych == '\r') goto yy97; + if (yych >= ' ') goto yy96; + } + } else { + if (yych <= '#') { + if (yych == '"') goto yy99; + } else { + if (yych <= '$') goto yy101; + if (yych == '\'') goto yy102; + } + } + } else { + if (yych <= '@') { + if (yych <= '/') { + if (yych <= '-') goto yy103; + if (yych <= '.') goto yy104; + } else { + if (yych <= '9') goto yy105; + if (yych == ';') goto yy97; + } + } else { + if (yych <= '\\') { + if (yych <= 'Z') goto yy107; + if (yych >= '\\') goto yy109; + } else { + if (yych <= ']') goto yy110; + if (yych <= '`') goto yy94; + if (yych <= 'z') goto yy107; + } + } + } +yy94: + YYDEBUG(94, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy113; +yy95: + YYDEBUG(95, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 447 "Zend/zend_ini_scanner.l" + { /* Get rest as section/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); } - YY_BREAK -case 11: -YY_RULE_SETUP -{ - SCNG(lineno)++; - return '\n'; +#line 1237 "Zend/zend_ini_scanner.c" +yy96: + YYDEBUG(96, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy139; + } + if (yych == '"') goto yy141; + if (yych == ']') goto yy142; + goto yy113; +yy97: + YYDEBUG(97, *YYCURSOR); + ++YYCURSOR; +yy98: + YYDEBUG(98, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 502 "Zend/zend_ini_scanner.l" + { + return 0; } - YY_BREAK -case 12: -YY_RULE_SETUP -{ - /* comment */ - SCNG(lineno)++; - return '\n'; +#line 1258 "Zend/zend_ini_scanner.c" +yy99: + YYDEBUG(99, *YYCURSOR); + ++YYCURSOR; +yy100: + YYDEBUG(100, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 451 "Zend/zend_ini_scanner.l" + { /* Double quoted '"' string start */ + yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); + return '"'; } - YY_BREAK -case 13: -YY_RULE_SETUP -{ - /* eat whitespace */ +#line 1270 "Zend/zend_ini_scanner.c" +yy101: + YYDEBUG(101, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy98; + if (yych <= '[') goto yy112; + goto yy117; + } else { + if (yych == '{') goto yy137; + goto yy112; + } +yy102: + YYDEBUG(102, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy133; + } + goto yy98; +yy103: + YYDEBUG(103, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy113; + if (yych <= '9') goto yy131; + goto yy113; +yy104: + YYDEBUG(104, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy113; + if (yych <= '9') goto yy129; + goto yy113; +yy105: + YYDEBUG(105, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '\'') { + if (yych <= '\r') { + if (yych == '\n') goto yy106; + if (yych <= '\f') goto yy113; + } else { + if (yych == '"') goto yy106; + if (yych <= '&') goto yy113; + } + } else { + if (yych <= '9') { + if (yych == '.') goto yy125; + if (yych <= '/') goto yy113; + goto yy127; + } else { + if (yych <= ';') { + if (yych <= ':') goto yy113; + } else { + if (yych != ']') goto yy113; + } + } + } +yy106: + YYDEBUG(106, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 425 "Zend/zend_ini_scanner.l" + { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } - YY_BREAK -case 14: -YY_RULE_SETUP -{ -#if DEBUG - php_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n", yylineno, yytext, yytext[0]); -#endif +#line 1336 "Zend/zend_ini_scanner.c" +yy107: + YYDEBUG(107, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy123; + } + if (yych <= '"') { + if (yych <= '\f') { + if (yych != '\n') goto yy113; + } else { + if (yych <= '\r') goto yy108; + if (yych <= '!') goto yy113; + } + } else { + if (yych <= ':') { + if (yych != '\'') goto yy113; + } else { + if (yych <= ';') goto yy108; + if (yych != ']') goto yy113; + } + } +yy108: + YYDEBUG(108, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 421 "Zend/zend_ini_scanner.l" + { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } - YY_BREAK -case YY_STATE_EOF(INITIAL): -{ - yy_delete_buffer(YY_CURRENT_BUFFER TSRMLS_CC); - yyterminate(); -} - YY_BREAK -case 15: -YY_RULE_SETUP -ECHO; - YY_BREAK - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = SCNG(yy_in); - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; +#line 1366 "Zend/zend_ini_scanner.c" +yy109: + YYDEBUG(109, *YYCURSOR); + yych = *++YYCURSOR; + goto yy112; +yy110: + YYDEBUG(110, *YYCURSOR); + ++YYCURSOR; +yy111: + YYDEBUG(111, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 362 "Zend/zend_ini_scanner.l" + { /* End of section or an option offset */ + BEGIN(INITIAL); + return ']'; +} +#line 1382 "Zend/zend_ini_scanner.c" +yy112: + YYDEBUG(112, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy113: + YYDEBUG(113, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy112; + } + if (yych == '$') goto yy115; + if (yych != '\\') goto yy95; +yy114: + YYDEBUG(114, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + goto yy112; +yy115: + YYDEBUG(115, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy116; + if (yych <= '[') goto yy112; + goto yy117; + } else { + if (yych != '{') goto yy112; + } +yy116: + YYDEBUG(116, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept == 0) { + goto yy95; + } else { + goto yy98; } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state TSRMLS_CC ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; + } else { + if (yyaccept == 2) { + goto yy106; + } else { + goto yy108; + } + } +yy117: + YYDEBUG(117, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy118; + } + if (yych == '\\') goto yy120; + goto yy112; +yy118: + YYDEBUG(118, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(119, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy118; + } + if (yych == '\\') goto yy122; + goto yy112; +yy120: + YYDEBUG(120, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(121, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy118; + } + if (yych == '\\') goto yy120; + goto yy112; +yy122: + YYDEBUG(122, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy118; + } + if (yych == '\\') goto yy120; + goto yy112; +yy123: + YYDEBUG(123, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(124, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy123; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy108; + if (yych <= '\f') goto yy112; + goto yy108; + } else { + if (yych == '"') goto yy108; + if (yych <= '#') goto yy112; + goto yy115; + } + } else { + if (yych <= ';') { + if (yych == '\'') goto yy108; + if (yych <= ':') goto yy112; + goto yy108; + } else { + if (yych <= '[') goto yy112; + if (yych <= '\\') goto yy114; + if (yych <= ']') goto yy108; + goto yy112; + } + } +yy125: + YYDEBUG(125, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(126, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy125; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy106; + if (yych <= '\f') goto yy112; + goto yy106; + } else { + if (yych == '"') goto yy106; + if (yych <= '#') goto yy112; + goto yy115; + } + } else { + if (yych <= ';') { + if (yych == '\'') goto yy106; + if (yych <= ':') goto yy112; + goto yy106; + } else { + if (yych <= '[') goto yy112; + if (yych <= '\\') goto yy114; + if (yych <= ']') goto yy106; + goto yy112; + } + } +yy127: + YYDEBUG(127, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(128, *YYCURSOR); + if (yych <= '\'') { + if (yych <= '!') { + if (yych <= '\n') { + if (yych <= '\t') goto yy112; + goto yy106; + } else { + if (yych == '\r') goto yy106; + goto yy112; } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; + } else { + if (yych <= '#') { + if (yych <= '"') goto yy106; + goto yy112; + } else { + if (yych <= '$') goto yy115; + if (yych <= '&') goto yy112; + goto yy106; } } - - else switch ( yy_get_next_buffer(TSRMLS_C) ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; + } else { + if (yych <= ':') { + if (yych <= '.') { + if (yych <= '-') goto yy112; + goto yy125; + } else { + if (yych <= '/') goto yy112; + if (yych <= '9') goto yy127; + goto yy112; + } + } else { + if (yych <= '[') { + if (yych <= ';') goto yy106; + goto yy112; + } else { + if (yych <= '\\') goto yy114; + if (yych <= ']') goto yy106; + goto yy112; } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)]; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; } - break; } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer(TSRMLS_D) - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; +yy129: + YYDEBUG(129, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(130, *YYCURSOR); + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy106; + if (yych <= '\f') goto yy112; + goto yy106; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy112; + goto yy106; + } else { + if (yych == '$') goto yy115; + goto yy112; + } } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy106; + if (yych <= '/') goto yy112; + if (yych <= '9') goto yy129; + goto yy112; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy106; + goto yy112; + } else { + if (yych <= '\\') goto yy114; + if (yych <= ']') goto yy106; + goto yy112; + } } } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars) = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif +yy131: + YYDEBUG(131, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(132, *YYCURSOR); + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy106; + if (yych <= '\f') goto yy112; + goto yy106; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy112; + goto yy106; + } else { + if (yych == '$') goto yy115; + goto yy112; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy106; + if (yych <= '/') goto yy112; + if (yych <= '9') goto yy131; + goto yy112; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy106; + goto yy112; + } else { + if (yych <= '\\') goto yy114; + if (yych <= ']') goto yy106; + goto yy112; + } } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - SCNG(yy_n_chars), num_to_read ); - - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars); } - - if ( SCNG(yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( SCNG(yy_in) TSRMLS_CC ); +yy133: + YYDEBUG(133, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(134, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy133; + } + YYDEBUG(135, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(136, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 337 "Zend/zend_ini_scanner.l" + { /* Raw string */ + /* Eat leading and trailing single quotes */ + if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { + SCNG(yy_text)++; + yyleng = yyleng - 2; + } + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 1681 "Zend/zend_ini_scanner.c" +yy137: + YYDEBUG(137, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(138, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 367 "Zend/zend_ini_scanner.l" + { /* Variable start */ + yy_push_state(ST_VARNAME TSRMLS_CC); + return TC_DOLLAR_CURLY; +} +#line 1692 "Zend/zend_ini_scanner.c" +yy139: + YYDEBUG(139, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(140, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy139; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy95; + if (yych <= '\f') goto yy112; + goto yy95; + } else { + if (yych == '"') goto yy141; + if (yych <= '#') goto yy112; + goto yy115; } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; + } else { + if (yych <= ';') { + if (yych == '\'') goto yy95; + if (yych <= ':') goto yy112; + goto yy95; + } else { + if (yych <= '[') goto yy112; + if (yych <= '\\') goto yy114; + if (yych <= ']') goto yy142; + goto yy112; } } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - SCNG(yy_n_chars) += number_to_move; - yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; +yy141: + YYDEBUG(141, *YYCURSOR); + yych = *++YYCURSOR; + goto yy100; +yy142: + YYDEBUG(142, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy111; } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state(TSRMLS_D) +/* *********************************** */ +yyc_ST_RAW: { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + static const unsigned char yybm[] = { + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 224, 0, 160, 160, 0, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 224, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 32, 160, 32, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + }; + YYDEBUG(143, *YYCURSOR); + YYFILL(3); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) goto yy145; + if (yych <= '\t') goto yy147; + goto yy148; + } else { + if (yych == '\r') goto yy150; } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 63 ) - yy_c = yy_meta[(unsigned int) yy_c]; + } else { + if (yych <= ';') { + if (yych <= ' ') goto yy147; + if (yych >= ';') goto yy151; + } else { + if (yych == '=') goto yy153; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } - - return yy_current_state; +yy145: + YYDEBUG(145, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy164; +yy146: + YYDEBUG(146, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 402 "Zend/zend_ini_scanner.l" + { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ + /* Eat leading and trailing double quotes */ + if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { + SCNG(yy_text)++; + yyleng = yyleng - 2; } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state TSRMLS_CC ) -yy_state_type yy_current_state; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 1808 "Zend/zend_ini_scanner.c" +yy147: + YYDEBUG(147, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy160; } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 63 ) - yy_c = yy_meta[(unsigned int) yy_c]; + if (yych <= '\f') { + if (yych == '\n') goto yy159; + goto yy164; + } else { + if (yych <= '\r') goto yy162; + if (yych == ';') goto yy154; + goto yy164; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 62); - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp TSRMLS_DC ) -#else -static void yyunput( c, yy_bp TSRMLS_CC ) -int c; -register char *yy_bp; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif +yy148: + YYDEBUG(148, *YYCURSOR); + ++YYCURSOR; +yy149: + YYDEBUG(149, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 415 "Zend/zend_ini_scanner.l" + { /* End of option value */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 1836 "Zend/zend_ini_scanner.c" +yy150: + YYDEBUG(150, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy159; + goto yy149; +yy151: + YYDEBUG(151, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy155; +yy152: + YYDEBUG(152, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 497 "Zend/zend_ini_scanner.l" + { /* End of option value (if EOF is reached before EOL */ + BEGIN(INITIAL); + return END_OF_LINE; +} +#line 1855 "Zend/zend_ini_scanner.c" +yy153: + YYDEBUG(153, *YYCURSOR); + yych = *++YYCURSOR; + goto yy152; +yy154: + YYDEBUG(154, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy155: + YYDEBUG(155, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy154; + } + if (yych >= '\r') goto yy158; +yy156: + YYDEBUG(156, *YYCURSOR); + ++YYCURSOR; +yy157: + YYDEBUG(157, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 484 "Zend/zend_ini_scanner.l" + { /* Comment */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 1883 "Zend/zend_ini_scanner.c" +yy158: + YYDEBUG(158, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy156; + goto yy157; +yy159: + YYDEBUG(159, *YYCURSOR); + yych = *++YYCURSOR; + goto yy149; +yy160: + YYDEBUG(160, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; + YYDEBUG(161, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy160; + } + if (yych <= '\r') { + if (yych == '\n') goto yy159; + if (yych <= '\f') goto yy163; + } else { + if (yych <= ';') { + if (yych <= ':') goto yy163; + goto yy154; + } else { + if (yych == '=') goto yy146; + goto yy163; + } + } +yy162: + YYDEBUG(162, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy159; + goto yy149; +yy163: + YYDEBUG(163, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy164: + YYDEBUG(164, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy163; + } + goto yy146; + } +/* *********************************** */ +yyc_ST_SECTION_RAW: { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = SCNG(yy_n_chars) + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - SCNG(yy_n_chars) = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 192, 0, 128, 128, 0, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 192, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 0, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + YYDEBUG(165, *YYCURSOR); + YYFILL(3); + yych = *YYCURSOR; + if (yych <= '\f') { + if (yych == '\n') goto yy169; + } else { + if (yych <= '\r') goto yy169; + if (yych == ']') goto yy171; } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; + YYDEBUG(167, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy178; +yy168: + YYDEBUG(168, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 411 "Zend/zend_ini_scanner.l" + { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 1989 "Zend/zend_ini_scanner.c" +yy169: + YYDEBUG(169, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(170, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 502 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 1999 "Zend/zend_ini_scanner.c" +yy171: + YYDEBUG(171, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy174; +yy172: + YYDEBUG(172, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 346 "Zend/zend_ini_scanner.l" + { /* End of section */ + BEGIN(INITIAL); + SCNG(lineno)++; + return ']'; +} +#line 2014 "Zend/zend_ini_scanner.c" +yy173: + YYDEBUG(173, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy174: + YYDEBUG(174, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy173; + } + if (yych == '\n') goto yy175; + if (yych == '\r') goto yy176; + goto yy172; +yy175: + YYDEBUG(175, *YYCURSOR); + yych = *++YYCURSOR; + goto yy172; +yy176: + YYDEBUG(176, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy175; + goto yy172; +yy177: + YYDEBUG(177, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy178: + YYDEBUG(178, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy177; + } + goto yy168; } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput(TSRMLS_D) -#else -static int input(TSRMLS_C) -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif +/* *********************************** */ +yyc_ST_SECTION_VALUE: { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + static const unsigned char yybm[] = { + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 134, 128, 132, 132, 128, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 134, 132, 128, 132, 136, 132, 132, 0, + 132, 132, 132, 132, 132, 132, 132, 132, + 228, 228, 228, 228, 228, 228, 228, 228, + 228, 228, 132, 128, 132, 132, 132, 132, + 132, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 132, 144, 128, 132, 164, + 132, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + }; + YYDEBUG(179, *YYCURSOR); + YYFILL(3); + yych = *YYCURSOR; + if (yych <= ',') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x08) goto yy181; + if (yych <= '\t') goto yy183; + goto yy184; + } else { + if (yych == '\r') goto yy184; + if (yych >= ' ') goto yy183; + } + } else { + if (yych <= '#') { + if (yych == '"') goto yy186; + } else { + if (yych <= '$') goto yy188; + if (yych == '\'') goto yy189; + } + } + } else { + if (yych <= '@') { + if (yych <= '/') { + if (yych <= '-') goto yy190; + if (yych <= '.') goto yy191; + } else { + if (yych <= '9') goto yy192; + if (yych == ';') goto yy184; + } + } else { + if (yych <= '\\') { + if (yych <= 'Z') goto yy194; + if (yych >= '\\') goto yy196; + } else { + if (yych <= ']') goto yy197; + if (yych <= '`') goto yy181; + if (yych <= 'z') goto yy194; + } + } + } +yy181: + YYDEBUG(181, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy204; +yy182: + YYDEBUG(182, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 447 "Zend/zend_ini_scanner.l" + { /* Get rest as section/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} +#line 2139 "Zend/zend_ini_scanner.c" +yy183: + YYDEBUG(183, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy230; + goto yy204; + } else { + if (yych <= ' ') goto yy230; + if (yych == '"') goto yy232; + goto yy204; + } +yy184: + YYDEBUG(184, *YYCURSOR); + ++YYCURSOR; +yy185: + YYDEBUG(185, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 502 "Zend/zend_ini_scanner.l" { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer(TSRMLS_C) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( SCNG(yy_in) TSRMLS_CC ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(TSRMLS_C); -#else - return input(TSRMLS_C); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; + return 0; +} +#line 2162 "Zend/zend_ini_scanner.c" +yy186: + YYDEBUG(186, *YYCURSOR); + ++YYCURSOR; +yy187: + YYDEBUG(187, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 451 "Zend/zend_ini_scanner.l" + { /* Double quoted '"' string start */ + yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); + return '"'; +} +#line 2174 "Zend/zend_ini_scanner.c" +yy188: + YYDEBUG(188, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy185; + if (yych <= '[') goto yy203; + goto yy208; + } else { + if (yych == '{') goto yy228; + goto yy203; + } +yy189: + YYDEBUG(189, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy224; + } + goto yy185; +yy190: + YYDEBUG(190, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy204; + if (yych <= '9') goto yy222; + goto yy204; +yy191: + YYDEBUG(191, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy204; + if (yych <= '9') goto yy220; + goto yy204; +yy192: + YYDEBUG(192, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '\'') { + if (yych <= '\r') { + if (yych == '\n') goto yy193; + if (yych <= '\f') goto yy204; + } else { + if (yych == '"') goto yy193; + if (yych <= '&') goto yy204; + } + } else { + if (yych <= '9') { + if (yych == '.') goto yy216; + if (yych <= '/') goto yy204; + goto yy218; + } else { + if (yych <= ';') { + if (yych <= ':') goto yy204; + } else { + if (yych != ']') goto yy204; } } } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; +yy193: + YYDEBUG(193, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 425 "Zend/zend_ini_scanner.l" + { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); +} +#line 2240 "Zend/zend_ini_scanner.c" +yy194: + YYDEBUG(194, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy214; + } + if (yych <= '"') { + if (yych <= '\f') { + if (yych != '\n') goto yy204; + } else { + if (yych <= '\r') goto yy195; + if (yych <= '!') goto yy204; + } + } else { + if (yych <= ':') { + if (yych != '\'') goto yy204; + } else { + if (yych <= ';') goto yy195; + if (yych != ']') goto yy204; + } + } +yy195: + YYDEBUG(195, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 421 "Zend/zend_ini_scanner.l" + { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); +} +#line 2270 "Zend/zend_ini_scanner.c" +yy196: + YYDEBUG(196, *YYCURSOR); + yych = *++YYCURSOR; + goto yy203; +yy197: + YYDEBUG(197, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy200; +yy198: + YYDEBUG(198, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 346 "Zend/zend_ini_scanner.l" + { /* End of section */ + BEGIN(INITIAL); + SCNG(lineno)++; + return ']'; +} +#line 2289 "Zend/zend_ini_scanner.c" +yy199: + YYDEBUG(199, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy200: + YYDEBUG(200, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy199; + } + if (yych == '\n') goto yy201; + if (yych == '\r') goto yy202; + goto yy198; +yy201: + YYDEBUG(201, *YYCURSOR); + yych = *++YYCURSOR; + goto yy198; +yy202: + YYDEBUG(202, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy201; + goto yy198; +yy203: + YYDEBUG(203, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy204: + YYDEBUG(204, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy203; + } + if (yych == '$') goto yy206; + if (yych != '\\') goto yy182; +yy205: + YYDEBUG(205, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + goto yy203; +yy206: + YYDEBUG(206, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy207; + if (yych <= '[') goto yy203; + goto yy208; + } else { + if (yych != '{') goto yy203; + } +yy207: + YYDEBUG(207, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept == 0) { + goto yy182; + } else { + goto yy185; + } + } else { + if (yyaccept == 2) { + goto yy193; + } else { + goto yy195; + } + } +yy208: + YYDEBUG(208, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy209; + } + if (yych == '\\') goto yy211; + goto yy203; +yy209: + YYDEBUG(209, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(210, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy209; + } + if (yych == '\\') goto yy213; + goto yy203; +yy211: + YYDEBUG(211, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(212, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy209; + } + if (yych == '\\') goto yy211; + goto yy203; +yy213: + YYDEBUG(213, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy209; + } + if (yych == '\\') goto yy211; + goto yy203; +yy214: + YYDEBUG(214, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(215, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy214; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy195; + if (yych <= '\f') goto yy203; + goto yy195; + } else { + if (yych == '"') goto yy195; + if (yych <= '#') goto yy203; + goto yy206; + } + } else { + if (yych <= ';') { + if (yych == '\'') goto yy195; + if (yych <= ':') goto yy203; + goto yy195; + } else { + if (yych <= '[') goto yy203; + if (yych <= '\\') goto yy205; + if (yych <= ']') goto yy195; + goto yy203; + } + } +yy216: + YYDEBUG(216, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(217, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy216; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy193; + if (yych <= '\f') goto yy203; + goto yy193; + } else { + if (yych == '"') goto yy193; + if (yych <= '#') goto yy203; + goto yy206; + } + } else { + if (yych <= ';') { + if (yych == '\'') goto yy193; + if (yych <= ':') goto yy203; + goto yy193; + } else { + if (yych <= '[') goto yy203; + if (yych <= '\\') goto yy205; + if (yych <= ']') goto yy193; + goto yy203; + } + } +yy218: + YYDEBUG(218, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(219, *YYCURSOR); + if (yych <= '\'') { + if (yych <= '!') { + if (yych <= '\n') { + if (yych <= '\t') goto yy203; + goto yy193; + } else { + if (yych == '\r') goto yy193; + goto yy203; + } + } else { + if (yych <= '#') { + if (yych <= '"') goto yy193; + goto yy203; + } else { + if (yych <= '$') goto yy206; + if (yych <= '&') goto yy203; + goto yy193; + } + } + } else { + if (yych <= ':') { + if (yych <= '.') { + if (yych <= '-') goto yy203; + goto yy216; + } else { + if (yych <= '/') goto yy203; + if (yych <= '9') goto yy218; + goto yy203; + } + } else { + if (yych <= '[') { + if (yych <= ';') goto yy193; + goto yy203; + } else { + if (yych <= '\\') goto yy205; + if (yych <= ']') goto yy193; + goto yy203; + } + } + } +yy220: + YYDEBUG(220, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(221, *YYCURSOR); + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy193; + if (yych <= '\f') goto yy203; + goto yy193; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy203; + goto yy193; + } else { + if (yych == '$') goto yy206; + goto yy203; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy193; + if (yych <= '/') goto yy203; + if (yych <= '9') goto yy220; + goto yy203; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy193; + goto yy203; + } else { + if (yych <= '\\') goto yy205; + if (yych <= ']') goto yy193; + goto yy203; + } + } + } +yy222: + YYDEBUG(222, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(223, *YYCURSOR); + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy193; + if (yych <= '\f') goto yy203; + goto yy193; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy203; + goto yy193; + } else { + if (yych == '$') goto yy206; + goto yy203; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy193; + if (yych <= '/') goto yy203; + if (yych <= '9') goto yy222; + goto yy203; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy193; + goto yy203; + } else { + if (yych <= '\\') goto yy205; + if (yych <= ']') goto yy193; + goto yy203; + } + } + } +yy224: + YYDEBUG(224, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(225, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy224; + } + YYDEBUG(226, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(227, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 337 "Zend/zend_ini_scanner.l" + { /* Raw string */ + /* Eat leading and trailing single quotes */ + if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { + SCNG(yy_text)++; + yyleng = yyleng - 2; } - - -#ifdef YY_USE_PROTOS -void yyrestart( struct _zend_file_handle *input_file TSRMLS_DC ) -#else -void yyrestart( input_file TSRMLS_CC ) -struct _zend_file_handle *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); - - yy_init_buffer( yy_current_buffer, input_file TSRMLS_CC ); - yy_load_buffer_state(TSRMLS_C); + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 2610 "Zend/zend_ini_scanner.c" +yy228: + YYDEBUG(228, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(229, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 367 "Zend/zend_ini_scanner.l" + { /* Variable start */ + yy_push_state(ST_VARNAME TSRMLS_CC); + return TC_DOLLAR_CURLY; +} +#line 2621 "Zend/zend_ini_scanner.c" +yy230: + YYDEBUG(230, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(231, *YYCURSOR); + if (yych <= '"') { + if (yych <= '\f') { + if (yych <= 0x08) goto yy203; + if (yych <= '\t') goto yy230; + if (yych <= '\n') goto yy182; + goto yy203; + } else { + if (yych <= 0x1F) { + if (yych <= '\r') goto yy182; + goto yy203; + } else { + if (yych <= ' ') goto yy230; + if (yych <= '!') goto yy203; + } + } + } else { + if (yych <= ':') { + if (yych <= '$') { + if (yych <= '#') goto yy203; + goto yy206; + } else { + if (yych == '\'') goto yy182; + goto yy203; + } + } else { + if (yych <= '[') { + if (yych <= ';') goto yy182; + goto yy203; + } else { + if (yych <= '\\') goto yy205; + if (yych <= ']') goto yy182; + goto yy203; + } + } + } +yy232: + YYDEBUG(232, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy187; } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC) -#else -void yy_switch_to_buffer( new_buffer TSRMLS_CC) -YY_BUFFER_STATE new_buffer; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif +/* *********************************** */ +yyc_ST_VALUE: { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) + static const unsigned char yybm[] = { + 160, 162, 162, 162, 162, 162, 162, 162, + 162, 176, 128, 162, 162, 128, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 176, 160, 160, 162, 168, 162, 160, 32, + 160, 160, 162, 162, 162, 162, 162, 162, + 230, 230, 230, 230, 230, 230, 230, 230, + 230, 230, 162, 160, 162, 160, 162, 162, + 162, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 162, 162, 162, 162, 166, + 162, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 162, 160, 162, 160, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + }; + YYDEBUG(233, *YYCURSOR); + YYFILL(6); + yych = *YYCURSOR; + YYDEBUG(-1, yych); + switch (yych) { + case 0x00: goto yy235; + case '\t': + case ' ': goto yy239; + case '\n': goto yy241; + case '\r': goto yy243; + case '!': + case '&': + case '(': + case ')': + case '|': + case '~': goto yy244; + case '"': goto yy246; + case '$': goto yy248; + case '\'': goto yy249; + case '-': goto yy250; + case '.': goto yy251; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy252; + case ';': goto yy254; + case '=': goto yy255; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Z': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'p': + case 'q': + case 'r': + case 's': + case 'u': + case 'v': + case 'w': + case 'x': + case 'z': goto yy257; + case 'F': + case 'f': goto yy259; + case 'N': + case 'n': goto yy260; + case 'O': + case 'o': goto yy261; + case 'T': + case 't': goto yy262; + case 'Y': + case 'y': goto yy263; + default: goto yy237; + } +yy235: + YYDEBUG(235, *YYCURSOR); + ++YYCURSOR; +yy236: + YYDEBUG(236, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 497 "Zend/zend_ini_scanner.l" + { /* End of option value (if EOF is reached before EOL */ + BEGIN(INITIAL); + return END_OF_LINE; +} +#line 2805 "Zend/zend_ini_scanner.c" +yy237: + YYDEBUG(237, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy265; +yy238: + YYDEBUG(238, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 443 "Zend/zend_ini_scanner.l" + { /* Get everything else as option/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} +#line 2818 "Zend/zend_ini_scanner.c" +yy239: + YYDEBUG(239, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy315; +yy240: + YYDEBUG(240, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 470 "Zend/zend_ini_scanner.l" { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars); + RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); +} +#line 2831 "Zend/zend_ini_scanner.c" +yy241: + YYDEBUG(241, *YYCURSOR); + ++YYCURSOR; +yy242: + YYDEBUG(242, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 415 "Zend/zend_ini_scanner.l" + { /* End of option value */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 2844 "Zend/zend_ini_scanner.c" +yy243: + YYDEBUG(243, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy313; + goto yy242; +yy244: + YYDEBUG(244, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy312; +yy245: + YYDEBUG(245, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 433 "Zend/zend_ini_scanner.l" + { /* Boolean operators */ + return yytext[0]; +} +#line 2862 "Zend/zend_ini_scanner.c" +yy246: + YYDEBUG(246, *YYCURSOR); + ++YYCURSOR; +yy247: + YYDEBUG(247, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 451 "Zend/zend_ini_scanner.l" + { /* Double quoted '"' string start */ + yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); + return '"'; +} +#line 2874 "Zend/zend_ini_scanner.c" +yy248: + YYDEBUG(248, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy236; + if (yych <= '[') goto yy264; + goto yy271; + } else { + if (yych == '{') goto yy309; + goto yy264; } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(TSRMLS_C); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( TSRMLS_D ) -#else -void yy_load_buffer_state(TSRMLS_C) -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - SCNG(yy_in) = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( struct _zend_file_handle *file, int size TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size TSRMLS_CC ) -struct _zend_file_handle *file; -int size; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file TSRMLS_CC ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -#else -void yy_delete_buffer( b TSRMLS_CC ) -YY_BUFFER_STATE b; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC ) -#else -void yy_init_buffer( b, file TSRMLS_CC ) -YY_BUFFER_STATE b; -struct _zend_file_handle *file; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - - - { - yy_flush_buffer( b TSRMLS_CC ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file->handle.stream.interactive; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -#else -void yy_flush_buffer( b TSRMLS_CC ) -YY_BUFFER_STATE b; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(TSRMLS_C); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size TSRMLS_CC ) -char *base; -yy_size_t size; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b TSRMLS_CC ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str TSRMLS_CC ) -yyconst char *yy_str; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len TSRMLS_CC ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len TSRMLS_CC ) -yyconst char *bytes; -int len; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n TSRMLS_CC); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state TSRMLS_DC ) -#else -static void yy_push_state( new_state TSRMLS_CC ) -int new_state; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); +yy249: + YYDEBUG(249, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy305; } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state(TSRMLS_D) - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state(TSRMLS_D) - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); + goto yy236; +yy250: + YYDEBUG(250, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy265; + if (yych <= '9') goto yy303; + goto yy265; +yy251: + YYDEBUG(251, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy265; + if (yych <= '9') goto yy301; + goto yy265; +yy252: + YYDEBUG(252, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '.') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych >= 0x01) goto yy265; + } else { + if (yych <= '\n') goto yy253; + if (yych <= '\f') goto yy265; + } + } else { + if (yych <= '%') { + if (yych <= 0x1F) goto yy265; + if (yych >= '#') goto yy265; + } else { + if (yych <= ')') goto yy253; + if (yych <= '-') goto yy265; + goto yy297; + } + } + } else { + if (yych <= '<') { + if (yych <= '9') { + if (yych <= '/') goto yy265; + goto yy299; + } else { + if (yych != ';') goto yy265; + } + } else { + if (yych <= '|') { + if (yych <= '=') goto yy253; + if (yych <= '{') goto yy265; + } else { + if (yych != '~') goto yy265; + } + } + } +yy253: + YYDEBUG(253, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 425 "Zend/zend_ini_scanner.l" + { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); +} +#line 2954 "Zend/zend_ini_scanner.c" +yy254: + YYDEBUG(254, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + goto yy293; +yy255: + YYDEBUG(255, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(256, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 437 "Zend/zend_ini_scanner.l" + { /* Make = used in option value to trigger error */ + yyless(0); + BEGIN(INITIAL); + return END_OF_LINE; +} +#line 2971 "Zend/zend_ini_scanner.c" +yy257: + YYDEBUG(257, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy266; + } + if (yych <= ')') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + if (yych >= '\v') goto yy265; + } else { + if (yych <= 0x1F) { + if (yych >= 0x0E) goto yy265; + } else { + if (yych <= '"') goto yy258; + if (yych <= '%') goto yy265; + } + } + } else { + if (yych <= '=') { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + } else { + if (yych <= '|') { + if (yych <= '{') goto yy265; + } else { + if (yych != '~') goto yy265; + } + } + } +yy258: + YYDEBUG(258, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 421 "Zend/zend_ini_scanner.l" + { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); +} +#line 3011 "Zend/zend_ini_scanner.c" +yy259: + YYDEBUG(259, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '<') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '/') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + goto yy265; + } else { + if (yych <= '9') goto yy266; + if (yych == ';') goto yy258; + goto yy265; + } + } + } else { + if (yych <= '`') { + if (yych <= 'A') { + if (yych <= '=') goto yy258; + if (yych <= '@') goto yy265; + goto yy289; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych <= 'a') goto yy289; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy260: + YYDEBUG(260, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'N') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + if (yych <= '\n') goto yy258; + goto yy265; + } else { + if (yych <= '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + if (yych <= '"') goto yy258; + goto yy265; + } + } else { + if (yych <= ':') { + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + if (yych <= '9') goto yy266; + goto yy265; + } else { + if (yych <= '<') { + if (yych <= ';') goto yy258; + goto yy265; + } else { + if (yych <= '=') goto yy258; + if (yych <= '@') goto yy265; + goto yy266; + } + } + } + } else { + if (yych <= 'n') { + if (yych <= 'Z') { + if (yych <= 'O') goto yy285; + if (yych == 'U') goto yy286; + goto yy266; + } else { + if (yych == '_') goto yy266; + if (yych <= '`') goto yy265; + goto yy266; + } + } else { + if (yych <= 'z') { + if (yych <= 'o') goto yy285; + if (yych == 'u') goto yy286; + goto yy266; + } else { + if (yych <= '|') { + if (yych <= '{') goto yy265; + goto yy258; + } else { + if (yych == '~') goto yy258; + goto yy265; + } + } + } + } +yy261: + YYDEBUG(261, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'E') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + if (yych <= '\n') goto yy258; + goto yy265; + } else { + if (yych <= '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + if (yych <= '"') goto yy258; + goto yy265; + } + } else { + if (yych <= ':') { + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + if (yych <= '9') goto yy266; + goto yy265; + } else { + if (yych <= '<') { + if (yych <= ';') goto yy258; + goto yy265; + } else { + if (yych <= '=') goto yy258; + if (yych <= '@') goto yy265; + goto yy266; + } + } + } + } else { + if (yych <= 'e') { + if (yych <= 'Z') { + if (yych <= 'F') goto yy280; + if (yych == 'N') goto yy274; + goto yy266; + } else { + if (yych == '_') goto yy266; + if (yych <= '`') goto yy265; + goto yy266; + } + } else { + if (yych <= 'z') { + if (yych <= 'f') goto yy280; + if (yych == 'n') goto yy274; + goto yy266; + } else { + if (yych <= '|') { + if (yych <= '{') goto yy265; + goto yy258; + } else { + if (yych == '~') goto yy258; + goto yy265; + } + } + } + } +yy262: + YYDEBUG(262, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'R') { + if (yych <= '@') goto yy265; + if (yych <= 'Q') goto yy266; + goto yy278; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'r') goto yy278; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy263: + YYDEBUG(263, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy265; + if (yych <= 'D') goto yy266; + goto yy268; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy268; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy264: + YYDEBUG(264, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy265: + YYDEBUG(265, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy264; + } + if (yych == '$') goto yy269; + goto yy238; +yy266: + YYDEBUG(266, *YYCURSOR); + yyaccept = 4; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(267, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy266; + } + if (yych <= '%') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy258; + goto yy264; + } else { + if (yych <= '\n') goto yy258; + if (yych <= '\f') goto yy264; + goto yy258; + } + } else { + if (yych <= '"') { + if (yych <= 0x1F) goto yy264; + goto yy258; + } else { + if (yych == '$') goto yy269; + goto yy264; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych <= ')') goto yy258; + goto yy264; + } else { + if (yych == '<') goto yy264; + goto yy258; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy264; + goto yy258; + } else { + if (yych == '~') goto yy258; + goto yy264; + } + } + } +yy268: + YYDEBUG(268, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'S') { + if (yych <= '@') goto yy265; + if (yych <= 'R') goto yy266; + goto yy274; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 's') goto yy274; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy269: + YYDEBUG(269, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy270; + if (yych <= '[') goto yy264; + goto yy271; + } else { + if (yych != '{') goto yy264; + } +yy270: + YYDEBUG(270, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 3) { + if (yyaccept <= 1) { + if (yyaccept == 0) { + goto yy238; + } else { + goto yy240; + } + } else { + if (yyaccept == 2) { + goto yy236; + } else { + goto yy253; + } + } + } else { + if (yyaccept <= 5) { + if (yyaccept == 4) { + goto yy258; + } else { + goto yy275; + } + } else { + goto yy282; + } + } +yy271: + YYDEBUG(271, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy272; + } + goto yy264; +yy272: + YYDEBUG(272, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(273, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy272; + } + if (yych <= 0x00) goto yy238; + if (yych == '\\') goto yy271; + goto yy264; +yy274: + YYDEBUG(274, *YYCURSOR); + yyaccept = 5; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy276; + } + if (yych <= ';') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy275; + if (yych <= '\t') goto yy265; + } else { + if (yych != '\r') goto yy265; + } + } else { + if (yych <= ')') { + if (yych <= '"') goto yy275; + if (yych <= '%') goto yy265; + } else { + if (yych <= '/') goto yy265; + if (yych <= '9') goto yy266; + if (yych <= ':') goto yy265; + } + } + } else { + if (yych <= '_') { + if (yych <= '@') { + if (yych != '=') goto yy265; + } else { + if (yych <= 'Z') goto yy266; + if (yych <= '^') goto yy265; + goto yy266; + } + } else { + if (yych <= '{') { + if (yych <= '`') goto yy265; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych >= 0x7F) goto yy265; + } + } + } +yy275: + YYDEBUG(275, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 381 "Zend/zend_ini_scanner.l" + { /* TRUE value (when used outside option value/offset this causes parse error!) */ + RETURN_TOKEN(BOOL_TRUE, "1", 1); +} +#line 3507 "Zend/zend_ini_scanner.c" +yy276: + YYDEBUG(276, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(277, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy276; + } + goto yy275; +yy278: + YYDEBUG(278, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'U') { + if (yych <= '@') goto yy265; + if (yych <= 'T') goto yy266; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'u') goto yy279; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy279: + YYDEBUG(279, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy265; + if (yych <= 'D') goto yy266; + goto yy274; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy274; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy280: + YYDEBUG(280, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'F') { + if (yych <= '@') goto yy265; + if (yych <= 'E') goto yy266; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'f') goto yy281; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy281: + YYDEBUG(281, *YYCURSOR); + yyaccept = 6; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy266; + } + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x08) { + if (yych >= 0x01) goto yy265; + } else { + if (yych <= '\t') goto yy283; + if (yych >= '\v') goto yy265; + } + } else { + if (yych <= 0x1F) { + if (yych >= 0x0E) goto yy265; + } else { + if (yych <= ' ') goto yy283; + if (yych >= '#') goto yy265; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych >= '*') goto yy265; + } else { + if (yych == '<') goto yy265; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy265; + } else { + if (yych != '~') goto yy265; + } + } + } +yy282: + YYDEBUG(282, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 385 "Zend/zend_ini_scanner.l" + { /* FALSE value (when used outside option value/offset this causes parse error!)*/ + RETURN_TOKEN(BOOL_FALSE, "", 0); +} +#line 3711 "Zend/zend_ini_scanner.c" +yy283: + YYDEBUG(283, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(284, *YYCURSOR); + if (yych == '\t') goto yy283; + if (yych == ' ') goto yy283; + goto yy282; +yy285: + YYDEBUG(285, *YYCURSOR); + yyaccept = 6; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '<') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy282; + if (yych <= 0x08) goto yy265; + if (yych <= '\t') goto yy283; + goto yy282; + } else { + if (yych == '\r') goto yy282; + if (yych <= 0x1F) goto yy265; + goto yy283; + } + } else { + if (yych <= '/') { + if (yych <= '"') goto yy282; + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy282; + goto yy265; + } else { + if (yych <= '9') goto yy266; + if (yych == ';') goto yy282; + goto yy265; + } + } + } else { + if (yych <= '`') { + if (yych <= 'N') { + if (yych <= '=') goto yy282; + if (yych <= '@') goto yy265; + if (yych <= 'M') goto yy266; + goto yy288; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'n') goto yy288; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy282; + goto yy265; + } + } + } +yy286: + YYDEBUG(286, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'L') { + if (yych <= '@') goto yy265; + if (yych <= 'K') goto yy266; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'l') goto yy287; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy287: + YYDEBUG(287, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'L') { + if (yych <= '@') goto yy265; + if (yych <= 'K') goto yy266; + goto yy281; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'l') goto yy281; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy288: + YYDEBUG(288, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy265; + if (yych <= 'D') goto yy266; + goto yy281; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy281; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy289: + YYDEBUG(289, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'L') { + if (yych <= '@') goto yy265; + if (yych <= 'K') goto yy266; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'l') goto yy290; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy290: + YYDEBUG(290, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'S') { + if (yych <= '@') goto yy265; + if (yych <= 'R') goto yy266; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 's') goto yy291; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy291: + YYDEBUG(291, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy258; + if (yych <= 0x08) goto yy265; + goto yy258; + } else { + if (yych == '\r') goto yy258; + if (yych <= 0x1F) goto yy265; + goto yy258; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy265; + if (yych <= ')') goto yy258; + if (yych <= '/') goto yy265; + goto yy266; + } else { + if (yych == ';') goto yy258; + if (yych <= '<') goto yy265; + goto yy258; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy265; + if (yych <= 'D') goto yy266; + goto yy281; + } else { + if (yych <= 'Z') goto yy266; + if (yych == '_') goto yy266; + goto yy265; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy281; + if (yych <= 'z') goto yy266; + goto yy265; + } else { + if (yych == '}') goto yy265; + if (yych <= '~') goto yy258; + goto yy265; + } + } + } +yy292: + YYDEBUG(292, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy293: + YYDEBUG(293, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy292; + } + if (yych >= '\r') goto yy296; +yy294: + YYDEBUG(294, *YYCURSOR); + ++YYCURSOR; +yy295: + YYDEBUG(295, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 484 "Zend/zend_ini_scanner.l" + { /* Comment */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 4093 "Zend/zend_ini_scanner.c" +yy296: + YYDEBUG(296, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy294; + goto yy295; +yy297: + YYDEBUG(297, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(298, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy297; + } + if (yych <= '%') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy253; + goto yy264; + } else { + if (yych <= '\n') goto yy253; + if (yych <= '\f') goto yy264; + goto yy253; + } + } else { + if (yych <= '"') { + if (yych <= 0x1F) goto yy264; + goto yy253; + } else { + if (yych == '$') goto yy269; + goto yy264; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych <= ')') goto yy253; + goto yy264; + } else { + if (yych == '<') goto yy264; + goto yy253; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy264; + goto yy253; + } else { + if (yych == '~') goto yy253; + goto yy264; + } + } + } +yy299: + YYDEBUG(299, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(300, *YYCURSOR); + if (yych <= '-') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x00) goto yy253; + if (yych <= 0x08) goto yy264; + goto yy253; + } else { + if (yych == '\r') goto yy253; + goto yy264; + } + } else { + if (yych <= '$') { + if (yych <= '"') goto yy253; + if (yych <= '#') goto yy264; + goto yy269; + } else { + if (yych <= '%') goto yy264; + if (yych <= ')') goto yy253; + goto yy264; + } + } + } else { + if (yych <= '<') { + if (yych <= '9') { + if (yych <= '.') goto yy297; + if (yych <= '/') goto yy264; + goto yy299; + } else { + if (yych == ';') goto yy253; + goto yy264; + } + } else { + if (yych <= '|') { + if (yych <= '=') goto yy253; + if (yych <= '{') goto yy264; + goto yy253; + } else { + if (yych == '~') goto yy253; + goto yy264; + } + } + } +yy301: + YYDEBUG(301, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(302, *YYCURSOR); + if (yych <= ')') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy253; + goto yy264; + } else { + if (yych <= '\n') goto yy253; + if (yych <= '\f') goto yy264; + goto yy253; + } + } else { + if (yych <= '#') { + if (yych <= 0x1F) goto yy264; + if (yych <= '"') goto yy253; + goto yy264; + } else { + if (yych <= '$') goto yy269; + if (yych <= '%') goto yy264; + goto yy253; + } + } + } else { + if (yych <= '<') { + if (yych <= '9') { + if (yych <= '/') goto yy264; + goto yy301; + } else { + if (yych == ';') goto yy253; + goto yy264; + } + } else { + if (yych <= '|') { + if (yych <= '=') goto yy253; + if (yych <= '{') goto yy264; + goto yy253; + } else { + if (yych == '~') goto yy253; + goto yy264; + } + } + } +yy303: + YYDEBUG(303, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(304, *YYCURSOR); + if (yych <= ')') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy253; + goto yy264; + } else { + if (yych <= '\n') goto yy253; + if (yych <= '\f') goto yy264; + goto yy253; + } + } else { + if (yych <= '#') { + if (yych <= 0x1F) goto yy264; + if (yych <= '"') goto yy253; + goto yy264; + } else { + if (yych <= '$') goto yy269; + if (yych <= '%') goto yy264; + goto yy253; + } + } + } else { + if (yych <= '<') { + if (yych <= '9') { + if (yych <= '/') goto yy264; + goto yy303; + } else { + if (yych == ';') goto yy253; + goto yy264; + } + } else { + if (yych <= '|') { + if (yych <= '=') goto yy253; + if (yych <= '{') goto yy264; + goto yy253; + } else { + if (yych == '~') goto yy253; + goto yy264; + } + } + } +yy305: + YYDEBUG(305, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(306, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy305; + } + YYDEBUG(307, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(308, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 337 "Zend/zend_ini_scanner.l" + { /* Raw string */ + /* Eat leading and trailing single quotes */ + if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { + SCNG(yy_text)++; + yyleng = yyleng - 2; } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 4314 "Zend/zend_ini_scanner.c" +yy309: + YYDEBUG(309, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(310, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 367 "Zend/zend_ini_scanner.l" + { /* Variable start */ + yy_push_state(ST_VARNAME TSRMLS_CC); + return TC_DOLLAR_CURLY; +} +#line 4325 "Zend/zend_ini_scanner.c" +yy311: + YYDEBUG(311, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy312: + YYDEBUG(312, *YYCURSOR); + if (yych == '\t') goto yy311; + if (yych == ' ') goto yy311; + goto yy245; +yy313: + YYDEBUG(313, *YYCURSOR); + yych = *++YYCURSOR; + goto yy242; +yy314: + YYDEBUG(314, *YYCURSOR); + yyaccept = 1; + YYMARKER = ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy315: + YYDEBUG(315, *YYCURSOR); + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) goto yy240; + if (yych <= '\t') goto yy314; + goto yy313; + } else { + if (yych == '\r') goto yy317; + goto yy240; + } + } else { + if (yych <= '"') { + if (yych <= ' ') goto yy314; + if (yych <= '!') goto yy240; + } else { + if (yych == ';') goto yy292; + goto yy240; + } + } + YYDEBUG(316, *YYCURSOR); + yych = *++YYCURSOR; + goto yy247; +yy317: + YYDEBUG(317, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy313; + goto yy242; } - -#if YY_MAIN -int main() +/* *********************************** */ +yyc_ST_VARNAME: { - yylex(); + static const unsigned char yybm[] = { + 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, 128, 0, 0, 128, 128, 0, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 128, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 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, 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, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + YYDEBUG(318, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= '^') { + if (yych <= '9') { + if (yych >= '0') goto yy322; + } else { + if (yych <= '@') goto yy320; + if (yych <= 'Z') goto yy322; + } + } else { + if (yych <= 'z') { + if (yych != '`') goto yy322; + } else { + if (yych == '}') goto yy324; + } + } +yy320: + YYDEBUG(320, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(321, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 502 "Zend/zend_ini_scanner.l" + { return 0; +} +#line 4438 "Zend/zend_ini_scanner.c" +yy322: + YYDEBUG(322, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy327; +yy323: + YYDEBUG(323, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 372 "Zend/zend_ini_scanner.l" + { /* Variable name */ + RETURN_TOKEN(TC_VARNAME, yytext, yyleng); +} +#line 4451 "Zend/zend_ini_scanner.c" +yy324: + YYDEBUG(324, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(325, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 376 "Zend/zend_ini_scanner.l" + { /* Variable end */ + yy_pop_state(TSRMLS_C); + return '}'; +} +#line 4462 "Zend/zend_ini_scanner.c" +yy326: + YYDEBUG(326, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy327: + YYDEBUG(327, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy326; + } + goto yy323; } -#endif +} +#line 506 "Zend/zend_ini_scanner.l" + +} diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h index 3824790f7..cef499fa5 100644 --- a/Zend/zend_ini_scanner.h +++ b/Zend/zend_ini_scanner.h @@ -17,18 +17,22 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_scanner.h,v 1.14.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_ini_scanner.h,v 1.14.2.1.2.2.2.4 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef _ZEND_INI_SCANNER_H #define _ZEND_INI_SCANNER_H +/* Scanner modes */ +#define ZEND_INI_SCANNER_NORMAL 0 /* Normal mode. [DEFAULT] */ +#define ZEND_INI_SCANNER_RAW 1 /* Raw mode. Option values are not parsed */ + BEGIN_EXTERN_C() int zend_ini_scanner_get_lineno(TSRMLS_D); char *zend_ini_scanner_get_filename(TSRMLS_D); -int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC); -int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC); -void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC); +int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC); +int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC); int ini_lex(zval *ini_lval TSRMLS_DC); +void shutdown_ini_scanner(TSRMLS_D); END_EXTERN_C() #endif /* _ZEND_INI_SCANNER_H */ diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 6546e4788..4485bec4c 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -1,9 +1,8 @@ -%{ /* +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -13,21 +12,15 @@ | obtain it through the world-wide-web, please send a note to | | license@zend.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Zeev Suraski | + | Authors: Zeev Suraski | + | Jani Taskinen | + | Marcus Boerger | + | Nuno Lopes | + | Scott MacVicar | +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_scanner.l,v 1.41.2.2.2.2 2007/07/23 16:17:10 jani Exp $ */ - -#define yyleng SCNG(yy_leng) -#define yytext SCNG(yy_text) -#define yytext_ptr SCNG(yy_text) -#define yyin SCNG(yy_in) -#define yyout SCNG(yy_out) -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#define yy_more_flag SCNG(_yy_more_flag) -#define yy_more_len SCNG(_yy_more_len) +/* $Id: zend_ini_scanner.l,v 1.41.2.2.2.2.2.16 2009/02/02 19:23:13 nlopess Exp $ */ #include #include "zend.h" @@ -35,217 +28,480 @@ #include #include "zend_ini_scanner.h" -#undef YYSTYPE -#define YYSTYPE zval +#if 0 +# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c) +#else +# define YYDEBUG(s, c) +#endif -#define YY_DECL int ini_lex(zval *ini_lval TSRMLS_DC) +#include "zend_ini_scanner_defs.h" + +#define YYCTYPE unsigned char +/* allow the scanner to read one null byte after the end of the string (from ZEND_MMAP_AHEAD) + * so that if will be able to terminate to match the current token (e.g. non-enclosed string) */ +#define YYFILL(n) { if (YYCURSOR > YYLIMIT) return 0; } +#define YYCURSOR SCNG(yy_cursor) +#define YYLIMIT SCNG(yy_limit) +#define YYMARKER SCNG(yy_marker) + +#define YYGETCONDITION() SCNG(yy_state) +#define YYSETCONDITION(s) SCNG(yy_state) = s + +#define STATE(name) yyc##name + +/* emulate flex constructs */ +#define BEGIN(state) YYSETCONDITION(STATE(state)) +#define YYSTATE YYGETCONDITION() +#define yytext ((char*)SCNG(yy_text)) +#define yyleng SCNG(yy_leng) +#define yyless(x) YYCURSOR = yytext + x +/* #define yymore() goto yymore_restart */ + +/* perform sanity check. If this message is triggered you should + increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */ +/*!max:re2c */ +#if ZEND_MMAP_AHEAD < (YYMAXFILL + 1) +# error ZEND_MMAP_AHEAD should be greater than YYMAXFILL +#endif + + +/* How it works (for the core ini directives): + * =========================================== + * + * 1. Scanner scans file for tokens and passes them to parser. + * 2. Parser parses the tokens and passes the name/value pairs to the callback + * function which stores them in the configuration hash table. + * 3. Later REGISTER_INI_ENTRIES() is called which triggers the actual + * registering of ini entries and uses zend_get_configuration_directive() + * to fetch the previously stored name/value pair from configuration hash table + * and registers the static ini entries which match the name to the value + * into EG(ini_directives) hash table. + * 4. PATH section entries are used per-request from down to top, each overriding + * previous if one exists. zend_alter_ini_entry() is called for each entry. + * Settings in PATH section are ZEND_INI_SYSTEM accessible and thus mimics the + * php_admin_* directives used within Apache httpd.conf when PHP is compiled as + * module for Apache. + * 5. User defined ini files (like .htaccess for apache) are parsed for each request and + * stored in separate hash defined by SAPI. + */ + +/* TODO: (ordered by importance :-) + * =============================================================================== + * + * - Separate constant lookup totally from plain strings (using CONSTANT pattern) + * - Add #if .. #else .. #endif and ==, !=, <, > , <=, >= operators + * - Add #include "some.ini" + * - Allow variables to refer to options also when using parse_ini_file() + * + */ /* Globals Macros */ #define SCNG INI_SCNG #ifdef ZTS ZEND_API ts_rsrc_id ini_scanner_globals_id; #else -ZEND_API zend_scanner_globals ini_scanner_globals; +ZEND_API zend_ini_scanner_globals ini_scanner_globals; #endif -# define YY_INPUT(buf, result, max_size) \ - if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \ - && zend_stream_ferror( yyin TSRMLS_CC) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); +/* Eat trailing whitespace + extra char */ +#define EAT_TRAILING_WHITESPACE_EX(ch) \ + while (yyleng > 0 && ( \ + (ch != 'X' && yytext[yyleng - 1] == ch) || \ + yytext[yyleng - 1] == '\n' || \ + yytext[yyleng - 1] == '\r' || \ + yytext[yyleng - 1] == '\t' || \ + yytext[yyleng - 1] == ' ') \ + ) { \ + yyleng--; \ + } -static char *ini_filename; +/* Eat trailing whitespace */ +#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X') + +#define zend_ini_copy_value(retval, str, len) { \ + Z_STRVAL_P(retval) = zend_strndup(str, len); \ + Z_STRLEN_P(retval) = len; \ + Z_TYPE_P(retval) = IS_STRING; \ +} + +#define RETURN_TOKEN(type, str, len) { \ + zend_ini_copy_value(ini_lval, str, len); \ + return type; \ +} + +static void _yy_push_state(int new_state TSRMLS_DC) +{ + zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int)); + YYSETCONDITION(new_state); +} + +#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm) + +static void yy_pop_state(TSRMLS_D) +{ + int *stack_state; + zend_stack_top(&SCNG(state_stack), (void **) &stack_state); + YYSETCONDITION(*stack_state); + zend_stack_del_top(&SCNG(state_stack)); +} + +static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC) +{ + YYCURSOR = (YYCTYPE*)str; + SCNG(yy_start) = YYCURSOR; + YYLIMIT = YYCURSOR + len; +} + +#define ini_filename SCNG(filename) + +/* {{{ init_ini_scanner() +*/ +static void init_ini_scanner(TSRMLS_D) +{ + SCNG(lineno) = 1; + SCNG(scanner_mode) = ZEND_INI_SCANNER_NORMAL; + zend_stack_init(&SCNG(state_stack)); + BEGIN(INITIAL); +} +/* }}} */ -void init_ini_scanner(TSRMLS_D) +/* {{{ shutdown_ini_scanner() +*/ +void shutdown_ini_scanner(TSRMLS_D) { - SCNG(lineno)=1; + zend_stack_destroy(&SCNG(state_stack)); + if (ini_filename) { + free(ini_filename); + } } +/* }}} */ +/* {{{ zend_ini_scanner_get_lineno() +*/ int zend_ini_scanner_get_lineno(TSRMLS_D) { return SCNG(lineno); } +/* }}} */ +/* {{{ zend_ini_scanner_get_filename() +*/ char *zend_ini_scanner_get_filename(TSRMLS_D) { - return ini_filename; + return ini_filename ? ini_filename : "Unknown"; } +/* }}} */ -int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC) +/* {{{ zend_ini_open_file_for_scanning() +*/ +int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC) { - if (FAILURE == zend_stream_fixup(fh TSRMLS_CC)) { + char *buf; + size_t size; + + if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) { return FAILURE; } init_ini_scanner(TSRMLS_C); - yyin = fh; - yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC); - ini_filename = fh->filename; + SCNG(scanner_mode) = scanner_mode; + SCNG(yy_in) = fh; + yy_scan_buffer(buf, size TSRMLS_CC); + ini_filename = zend_strndup(fh->filename, strlen(fh->filename)); return SUCCESS; } +/* }}} */ -int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC) +/* {{{ zend_ini_prepare_string_for_scanning() +*/ +int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC) { int len = strlen(str); - yyin = NULL; - yy_scan_buffer(str, len + 2 TSRMLS_CC); + init_ini_scanner(TSRMLS_C); + SCNG(scanner_mode) = scanner_mode; + SCNG(yy_in) = NULL; + yy_scan_buffer(str, len TSRMLS_CC); ini_filename = NULL; return SUCCESS; } +/* }}} */ -void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC) +/* {{{ zend_ini_escape_string() + */ +static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC) { - zend_stream_close(fh); + register char *s, *t; + char *end; + + zend_ini_copy_value(lval, str, len); + + /* convert escape sequences */ + s = t = Z_STRVAL_P(lval); + end = s + Z_STRLEN_P(lval); + + while (s < end) { + if (*s == '\\') { + s++; + if (s >= end) { + *t++ = '\\'; + continue; + } + switch (*s) { + case '"': + if (*s != quote_type) { + *t++ = '\\'; + *t++ = *s; + break; + } + case '\\': + case '$': + *t++ = *s; + Z_STRLEN_P(lval)--; + break; + default: + *t++ = '\\'; + *t++ = *s; + break; + } + } else { + *t++ = *s; + } + if (*s == '\n' || (*s == '\r' && (*(s+1) != '\n'))) { + SCNG(lineno)++; + } + s++; + } + *t = 0; } +/* }}} */ -%} - -NEWLINE ("\r"|"\n"|"\r\n") - -%option noyywrap -%option never-interactive +int ini_lex(zval *ini_lval TSRMLS_DC) +{ +restart: + SCNG(yy_text) = YYCURSOR; + +/* yymore_restart: */ + /* detect EOF */ + if (YYCURSOR >= YYLIMIT) { + if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) { + BEGIN(INITIAL); + return 0; + } + return 0; + } -%% + /* Eat any UTF-8 BOM we find in the first 3 bytes */ + if (YYCURSOR == SCNG(yy_start) && YYCURSOR + 3 < YYLIMIT) { + if (memcmp(YYCURSOR, "\xef\xbb\xbf", 3) == 0) { + YYCURSOR += 3; + goto restart; + } + } +/*!re2c +re2c:yyfill:check = 0; +LNUM [0-9]+ +DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*) +NUMBER [-]?{LNUM}|{DNUM} +ANY_CHAR (.|[\n\t]) +NEWLINE ("\r"|"\n"|"\r\n") +TABS_AND_SPACES [ \t] +WHITESPACE [ \t]+ +CONSTANT [a-zA-Z][a-zA-Z0-9_]* +LABEL [a-zA-Z0-9_][a-zA-Z0-9*._-]* +TOKENS [:,.\[\]"'()|^&+-/*=%$!~<>?@{}] +OPERATORS [&|~()!] +DOLLAR_CURLY "${" + +SECTION_RAW_CHARS [^\]\n\r] +SINGLE_QUOTED_CHARS [^'] +RAW_VALUE_CHARS [^=\n\r;] + +LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR}))) +VALUE_CHARS ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR}) +SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) +DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"[^"])|{LITERAL_DOLLAR}|"\\"["][^\r\n]) + + := yyleng = YYCURSOR - SCNG(yy_text); + +"[" { /* Section start */ + /* Enter section data lookup state */ + if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { + yy_push_state(ST_SECTION_RAW TSRMLS_CC); + } else { + yy_push_state(ST_SECTION_VALUE TSRMLS_CC); + } + return TC_SECTION; +} -[ ]*[\[][ ]*[\]][ ]* { - return BRACK; +"'"{SINGLE_QUOTED_CHARS}+"'" { /* Raw string */ + /* Eat leading and trailing single quotes */ + if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { + SCNG(yy_text)++; + yyleng = yyleng - 2; + } + RETURN_TOKEN(TC_RAW, yytext, yyleng); } -[ ]*("true"|"on"|"yes")[ ]* { - Z_STRVAL_P(ini_lval) = zend_strndup("1", 1); - Z_STRLEN_P(ini_lval) = 1; - Z_TYPE_P(ini_lval) = IS_STRING; - return CFG_TRUE; +"]"{TABS_AND_SPACES}*{NEWLINE}? { /* End of section */ + BEGIN(INITIAL); + SCNG(lineno)++; + return ']'; } +{LABEL}"["{TABS_AND_SPACES}* { /* Start of option with offset */ + /* Eat trailing whitespace and [ */ + EAT_TRAILING_WHITESPACE_EX('['); -[ ]*("false"|"off"|"no"|"none"|"null")[ ]* { - Z_STRVAL_P(ini_lval) = zend_strndup("", 0); - Z_STRLEN_P(ini_lval) = 0; - Z_TYPE_P(ini_lval) = IS_STRING; - return CFG_FALSE; + /* Enter offset lookup state */ + yy_push_state(ST_OFFSET TSRMLS_CC); + + RETURN_TOKEN(TC_OFFSET, yytext, yyleng); } -[[][^\]\n]+[\]][ ]*{NEWLINE}? { - /* SECTION */ +{TABS_AND_SPACES}*"]" { /* End of section or an option offset */ + BEGIN(INITIAL); + return ']'; +} - /* eat trailing ] and spaces */ - while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']' || yytext[yyleng-1]==' ')) { - yyleng--; - yytext[yyleng]=0; - } +{DOLLAR_CURLY} { /* Variable start */ + yy_push_state(ST_VARNAME TSRMLS_CC); + return TC_DOLLAR_CURLY; +} - SCNG(lineno)++; +{LABEL} { /* Variable name */ + RETURN_TOKEN(TC_VARNAME, yytext, yyleng); +} - /* eat leading [ */ - yytext++; - yyleng--; +"}" { /* Variable end */ + yy_pop_state(TSRMLS_C); + return '}'; +} - Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng); - Z_STRLEN_P(ini_lval) = yyleng; - Z_TYPE_P(ini_lval) = IS_STRING; - return SECTION; +("true"|"on"|"yes"){TABS_AND_SPACES}* { /* TRUE value (when used outside option value/offset this causes parse error!) */ + RETURN_TOKEN(BOOL_TRUE, "1", 1); } -["][^"]*["] { - char *p = yytext; +("false"|"off"|"no"|"none"|"null"){TABS_AND_SPACES}* { /* FALSE value (when used outside option value/offset this causes parse error!)*/ + RETURN_TOKEN(BOOL_FALSE, "", 0); +} - /* ENCAPSULATED TC_STRING */ +{LABEL} { /* Get option name */ + RETURN_TOKEN(TC_LABEL, yytext, yyleng); +} - while ((p = strpbrk(p, "\r\n"))) { - if (*p == '\r' && *(p + 1) == '\n') { - p++; - } - SCNG(lineno)++; - p++; +{TABS_AND_SPACES}*[=]{TABS_AND_SPACES}* { /* Start option value */ + if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { + yy_push_state(ST_RAW TSRMLS_CC); + } else { + yy_push_state(ST_VALUE TSRMLS_CC); } + return '='; +} - /* eat trailing " */ - yytext[yyleng-1]=0; +{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ + /* Eat leading and trailing double quotes */ + if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { + SCNG(yy_text)++; + yyleng = yyleng - 2; + } + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} - /* eat leading " */ - yytext++; +{SECTION_RAW_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} - Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng - 2); - Z_STRLEN_P(ini_lval) = yyleng - 2; - Z_TYPE_P(ini_lval) = IS_STRING; - return TC_ENCAPSULATED_STRING; +{TABS_AND_SPACES}*{NEWLINE} { /* End of option value */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; } -"${" { - return TC_DOLLAR_CURLY; +{CONSTANT} { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -"}" { - Z_LVAL_P(ini_lval) = (long) yytext[0]; +{NUMBER} { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); +} + +{TOKENS} { /* Disallow these chars outside option values */ return yytext[0]; } -[&|~$(){}!] { +{OPERATORS}{TABS_AND_SPACES}* { /* Boolean operators */ return yytext[0]; } -[^=\n\r\t;|&$~(){}!"\[]+ { - /* STRING */ - register int i; +[=] { /* Make = used in option value to trigger error */ + yyless(0); + BEGIN(INITIAL); + return END_OF_LINE; +} - /* eat trailing whitespace */ - for (i=yyleng-1; i>=0; i--) { - if (yytext[i]==' ' || yytext[i]=='\t') { - yytext[i]=0; - yyleng--; - } else { - break; - } - } - /* eat leading whitespace */ - while (yytext[0]) { - if (yytext[0]==' ' || yytext[0]=='\t') { - yytext++; - yyleng--; - } else { - break; - } - } - if (yyleng!=0) { - Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng); - Z_STRLEN_P(ini_lval) = yyleng; - Z_TYPE_P(ini_lval) = IS_STRING; - return TC_STRING; - } else { - /* whitespace */ - } +{VALUE_CHARS}+ { /* Get everything else as option/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} + +{SECTION_VALUE_CHARS}+ { /* Get rest as section/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} + +{TABS_AND_SPACES}*["] { /* Double quoted '"' string start */ + yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); + return '"'; } -[=\n] { - if (yytext[0] == '\n') { - SCNG(lineno)++; +{DOUBLE_QUOTES_CHARS}+("\\"["])? { /* Escape double quoted string contents */ + if(yyleng > 1 && yytext[yyleng-1] == '"' && yytext[yyleng-2] == '\\') { + yyless(yyleng-1); + yyleng--; } - return yytext[0]; + zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC); + return TC_QUOTED_STRING; +} + +["]{TABS_AND_SPACES}* { /* Double quoted '"' string ends */ + yy_pop_state(TSRMLS_C); + return '"'; +} + +{WHITESPACE} { + RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); +} + +{TABS_AND_SPACES}+ { + /* eat whitespace */ + goto restart; } -{NEWLINE} { +{TABS_AND_SPACES}*{NEWLINE} { SCNG(lineno)++; - return '\n'; + return END_OF_LINE; } -[;][^\r\n]*{NEWLINE}? { - /* comment */ +{TABS_AND_SPACES}*[;][^\r\n]*{NEWLINE} { /* Comment */ + BEGIN(INITIAL); SCNG(lineno)++; - return '\n'; + return END_OF_LINE; } -[ \t] { - /* eat whitespace */ +{TABS_AND_SPACES}*[#][^\r\n]*{NEWLINE} { /* #Comment */ + zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno)); + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; } -. { -#if DEBUG - php_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n", yylineno, yytext, yytext[0]); -#endif +[^] { /* End of option value (if EOF is reached before EOL */ + BEGIN(INITIAL); + return END_OF_LINE; } -<> { - yy_delete_buffer(YY_CURRENT_BUFFER TSRMLS_CC); - yyterminate(); +<*>[^] { + return 0; +} + +*/ } diff --git a/Zend/zend_ini_scanner_defs.h b/Zend/zend_ini_scanner_defs.h new file mode 100644 index 000000000..46676e897 --- /dev/null +++ b/Zend/zend_ini_scanner_defs.h @@ -0,0 +1,13 @@ +/* Generated by re2c 0.13.6.dev on Mon Feb 2 19:23:18 2009 */ +#line 3 "Zend/zend_ini_scanner_defs.h" + +enum YYCONDTYPE { + yycINITIAL, + yycST_OFFSET, + yycST_SECTION_VALUE, + yycST_VALUE, + yycST_SECTION_RAW, + yycST_DOUBLE_QUOTES, + yycST_VARNAME, + yycST_RAW, +}; diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index d7ed87015..212dc2aad 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_interfaces.c,v 1.33.2.4.2.8 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_interfaces.c,v 1.33.2.4.2.6.2.12 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" #include "zend_API.h" @@ -46,7 +46,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend fci.size = sizeof(fci); /*fci.function_table = NULL; will be read form zend_class_entry of object if needed */ - fci.object_pp = object_pp; + fci.object_ptr = object_pp ? *object_pp : NULL; fci.function_name = &z_fname; fci.retval_ptr_ptr = retval_ptr_ptr ? retval_ptr_ptr : &retval; fci.param_count = param_count; @@ -84,7 +84,8 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend fcic.function_handler = *fn_proxy; } fcic.calling_scope = obj_ce; - fcic.object_pp = object_pp; + fcic.called_scope = object_pp ? obj_ce : EG(called_scope); + fcic.object_ptr = object_pp ? *object_pp : NULL; result = zend_call_function(&fci, &fcic TSRMLS_CC); } if (result == FAILURE) { @@ -274,7 +275,7 @@ static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zva iterator = emalloc(sizeof(zend_user_iterator)); - object->refcount++; + Z_ADDREF_P(object); iterator->it.data = (void*)object; iterator->it.funcs = ce->iterator_funcs.funcs; iterator->ce = Z_OBJCE_P(object); @@ -404,7 +405,7 @@ static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_en /* }}}*/ /* {{{ zend_user_serialize */ -int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) +ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) { zend_class_entry * ce = Z_OBJCE_P(object); zval *retval; @@ -422,7 +423,7 @@ int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len zval_ptr_dtor(&retval); return FAILURE; case IS_STRING: - *buffer = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + *buffer = (unsigned char*)estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); *buf_len = Z_STRLEN_P(retval); result = SUCCESS; break; @@ -441,7 +442,7 @@ int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len /* }}} */ /* {{{ zend_user_unserialize */ -int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) +ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) { zval * zdata; @@ -462,27 +463,46 @@ int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned ch } /* }}} */ +ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Serialization of '%s' is not allowed", ce->name); + return FAILURE; +} +/* }}} */ + +ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ +{ + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Unserialization of '%s' is not allowed", ce->name); + return FAILURE; +} +/* }}} */ + /* {{{ zend_implement_serializable */ static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC) { - if ((class_type->serialize && class_type->serialize != zend_user_serialize) - || (class_type->unserialize && class_type->unserialize != zend_user_unserialize) - ) { + if (class_type->parent + && (class_type->parent->serialize || class_type->parent->unserialize) + && !instanceof_function_ex(class_type->parent, zend_ce_serializable, 1 TSRMLS_CC)) { return FAILURE; } - class_type->serialize = zend_user_serialize; - class_type->unserialize = zend_user_unserialize; + if (!class_type->serialize) { + class_type->serialize = zend_user_serialize; + } + if (!class_type->unserialize) { + class_type->unserialize = zend_user_unserialize; + } return SUCCESS; } /* }}}*/ /* {{{ function tables */ -zend_function_entry zend_funcs_aggregate[] = { +const zend_function_entry zend_funcs_aggregate[] = { ZEND_ABSTRACT_ME(iterator, getIterator, NULL) {NULL, NULL, NULL} }; -zend_function_entry zend_funcs_iterator[] = { +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) @@ -491,25 +511,22 @@ zend_function_entry zend_funcs_iterator[] = { {NULL, NULL, NULL} }; -zend_function_entry *zend_funcs_traversable = NULL; +const zend_function_entry *zend_funcs_traversable = NULL; -static ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset, 0, 0, 1) ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -static 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() -static 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() -zend_function_entry zend_funcs_arrayaccess[] = { +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) @@ -517,12 +534,11 @@ zend_function_entry zend_funcs_arrayaccess[] = { {NULL, NULL, NULL} }; -static ZEND_BEGIN_ARG_INFO(arginfo_serializable_serialize, 0) ZEND_ARG_INFO(0, serialized) ZEND_END_ARG_INFO() -zend_function_entry zend_funcs_serializable[] = { +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_ACC_CTOR) {NULL, NULL, NULL} diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index 87ba8e151..774d16742 100755 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_interfaces.h,v 1.11.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_interfaces.h,v 1.11.2.1.2.2.2.4 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_INTERFACES_H #define ZEND_INTERFACES_H @@ -61,6 +61,12 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c ZEND_API void zend_register_interfaces(TSRMLS_D); +ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); +ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); + +ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); +ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); + END_EXTERN_C() #endif /* ZEND_INTERFACES_H */ diff --git a/Zend/zend_istdiostream.h b/Zend/zend_istdiostream.h index db6e5d908..6cdc4c8e4 100644 --- a/Zend/zend_istdiostream.h +++ b/Zend/zend_istdiostream.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_istdiostream.h,v 1.6.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_istdiostream.h,v 1.6.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef _ZEND_STDIOSTREAM #define _ZEND_STDIOSTREAM diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c index 18156e392..9d3d8009e 100755 --- a/Zend/zend_iterators.c +++ b/Zend/zend_iterators.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_iterators.c,v 1.12.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_iterators.c,v 1.12.2.1.2.2.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" #include "zend_API.h" diff --git a/Zend/zend_iterators.h b/Zend/zend_iterators.h index 579d55181..becc47e74 100755 --- a/Zend/zend_iterators.h +++ b/Zend/zend_iterators.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_iterators.h,v 1.10.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_iterators.h,v 1.10.2.1.2.2.2.2 2008/12/31 11:15:32 sebastian Exp $ */ /* These iterators were designed to operate within the foreach() * structures provided by the engine, but could be extended for use diff --git a/Zend/zend_language_parser.c b/Zend/zend_language_parser.c index 898e5e56e..d95a760b0 100644 --- a/Zend/zend_language_parser.c +++ b/Zend/zend_language_parser.c @@ -149,49 +149,54 @@ T_DEFAULT = 330, T_BREAK = 331, T_CONTINUE = 332, - T_FUNCTION = 333, - T_CONST = 334, - T_RETURN = 335, - T_TRY = 336, - T_CATCH = 337, - T_THROW = 338, - T_USE = 339, - T_GLOBAL = 340, - T_PUBLIC = 341, - T_PROTECTED = 342, - T_PRIVATE = 343, - T_FINAL = 344, - T_ABSTRACT = 345, - T_STATIC = 346, - T_VAR = 347, - T_UNSET = 348, - T_ISSET = 349, - T_EMPTY = 350, - T_HALT_COMPILER = 351, - T_CLASS = 352, - T_INTERFACE = 353, - T_EXTENDS = 354, - T_IMPLEMENTS = 355, - T_OBJECT_OPERATOR = 356, - T_DOUBLE_ARROW = 357, - T_LIST = 358, - T_ARRAY = 359, - T_CLASS_C = 360, - T_METHOD_C = 361, - T_FUNC_C = 362, - T_LINE = 363, - T_FILE = 364, - T_COMMENT = 365, - T_DOC_COMMENT = 366, - T_OPEN_TAG = 367, - T_OPEN_TAG_WITH_ECHO = 368, - T_CLOSE_TAG = 369, - T_WHITESPACE = 370, - T_START_HEREDOC = 371, - T_END_HEREDOC = 372, - T_DOLLAR_OPEN_CURLY_BRACES = 373, - T_CURLY_OPEN = 374, - T_PAAMAYIM_NEKUDOTAYIM = 375 + T_GOTO = 333, + T_FUNCTION = 334, + T_CONST = 335, + T_RETURN = 336, + T_TRY = 337, + T_CATCH = 338, + T_THROW = 339, + T_USE = 340, + T_GLOBAL = 341, + T_PUBLIC = 342, + T_PROTECTED = 343, + T_PRIVATE = 344, + T_FINAL = 345, + T_ABSTRACT = 346, + T_STATIC = 347, + T_VAR = 348, + T_UNSET = 349, + T_ISSET = 350, + T_EMPTY = 351, + T_HALT_COMPILER = 352, + T_CLASS = 353, + T_INTERFACE = 354, + T_EXTENDS = 355, + T_IMPLEMENTS = 356, + T_OBJECT_OPERATOR = 357, + T_DOUBLE_ARROW = 358, + T_LIST = 359, + T_ARRAY = 360, + T_CLASS_C = 361, + T_METHOD_C = 362, + T_FUNC_C = 363, + T_LINE = 364, + T_FILE = 365, + T_COMMENT = 366, + T_DOC_COMMENT = 367, + T_OPEN_TAG = 368, + T_OPEN_TAG_WITH_ECHO = 369, + T_CLOSE_TAG = 370, + T_WHITESPACE = 371, + T_START_HEREDOC = 372, + T_END_HEREDOC = 373, + T_DOLLAR_OPEN_CURLY_BRACES = 374, + T_CURLY_OPEN = 375, + T_PAAMAYIM_NEKUDOTAYIM = 376, + T_NAMESPACE = 377, + T_NS_C = 378, + T_DIR = 379, + T_NS_SEPARATOR = 380 }; #endif /* Tokens. */ @@ -270,49 +275,54 @@ #define T_DEFAULT 330 #define T_BREAK 331 #define T_CONTINUE 332 -#define T_FUNCTION 333 -#define T_CONST 334 -#define T_RETURN 335 -#define T_TRY 336 -#define T_CATCH 337 -#define T_THROW 338 -#define T_USE 339 -#define T_GLOBAL 340 -#define T_PUBLIC 341 -#define T_PROTECTED 342 -#define T_PRIVATE 343 -#define T_FINAL 344 -#define T_ABSTRACT 345 -#define T_STATIC 346 -#define T_VAR 347 -#define T_UNSET 348 -#define T_ISSET 349 -#define T_EMPTY 350 -#define T_HALT_COMPILER 351 -#define T_CLASS 352 -#define T_INTERFACE 353 -#define T_EXTENDS 354 -#define T_IMPLEMENTS 355 -#define T_OBJECT_OPERATOR 356 -#define T_DOUBLE_ARROW 357 -#define T_LIST 358 -#define T_ARRAY 359 -#define T_CLASS_C 360 -#define T_METHOD_C 361 -#define T_FUNC_C 362 -#define T_LINE 363 -#define T_FILE 364 -#define T_COMMENT 365 -#define T_DOC_COMMENT 366 -#define T_OPEN_TAG 367 -#define T_OPEN_TAG_WITH_ECHO 368 -#define T_CLOSE_TAG 369 -#define T_WHITESPACE 370 -#define T_START_HEREDOC 371 -#define T_END_HEREDOC 372 -#define T_DOLLAR_OPEN_CURLY_BRACES 373 -#define T_CURLY_OPEN 374 -#define T_PAAMAYIM_NEKUDOTAYIM 375 +#define T_GOTO 333 +#define T_FUNCTION 334 +#define T_CONST 335 +#define T_RETURN 336 +#define T_TRY 337 +#define T_CATCH 338 +#define T_THROW 339 +#define T_USE 340 +#define T_GLOBAL 341 +#define T_PUBLIC 342 +#define T_PROTECTED 343 +#define T_PRIVATE 344 +#define T_FINAL 345 +#define T_ABSTRACT 346 +#define T_STATIC 347 +#define T_VAR 348 +#define T_UNSET 349 +#define T_ISSET 350 +#define T_EMPTY 351 +#define T_HALT_COMPILER 352 +#define T_CLASS 353 +#define T_INTERFACE 354 +#define T_EXTENDS 355 +#define T_IMPLEMENTS 356 +#define T_OBJECT_OPERATOR 357 +#define T_DOUBLE_ARROW 358 +#define T_LIST 359 +#define T_ARRAY 360 +#define T_CLASS_C 361 +#define T_METHOD_C 362 +#define T_FUNC_C 363 +#define T_LINE 364 +#define T_FILE 365 +#define T_COMMENT 366 +#define T_DOC_COMMENT 367 +#define T_OPEN_TAG 368 +#define T_OPEN_TAG_WITH_ECHO 369 +#define T_CLOSE_TAG 370 +#define T_WHITESPACE 371 +#define T_START_HEREDOC 372 +#define T_END_HEREDOC 373 +#define T_DOLLAR_OPEN_CURLY_BRACES 374 +#define T_CURLY_OPEN 375 +#define T_PAAMAYIM_NEKUDOTAYIM 376 +#define T_NAMESPACE 377 +#define T_NS_C 378 +#define T_DIR 379 +#define T_NS_SEPARATOR 380 @@ -324,7 +334,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -339,12 +349,12 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_parser.y,v 1.160.2.4.2.11 2008/07/24 11:47:12 dmitry Exp $ */ +/* $Id: zend_language_parser.y,v 1.160.2.4.2.8.2.34 2009/01/26 22:54:20 cseiler Exp $ */ /* * LALR shift/reduce conflicts and how they are resolved: * - * - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift. + * - 2 shift/reduce conflicts due to the dangling elseif/else ambiguity. Solved by shift. * */ @@ -613,20 +623,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 3964 +#define YYLAST 5168 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 149 +#define YYNTOKENS 154 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 166 +#define YYNNTS 181 /* YYNRULES -- Number of rules. */ -#define YYNRULES 410 +#define YYNRULES 464 /* YYNRULES -- Number of states. */ -#define YYNSTATES 771 +#define YYNSTATES 894 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 375 +#define YYMAXUTOK 380 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -637,16 +647,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 48, 147, 2, 145, 47, 31, 2, - 140, 141, 45, 42, 8, 43, 44, 46, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 26, 142, + 2, 2, 2, 48, 152, 2, 150, 47, 31, 2, + 145, 146, 45, 42, 8, 43, 44, 46, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 26, 147, 36, 13, 37, 25, 51, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 61, 2, 148, 30, 2, 146, 2, 2, 2, + 2, 61, 2, 153, 30, 2, 151, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 143, 29, 144, 50, 2, 2, 2, + 2, 2, 2, 148, 29, 149, 50, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -671,7 +681,8 @@ static const yytype_uint8 yytranslate[] = 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139 + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144 }; #if YYDEBUG @@ -679,233 +690,262 @@ static const yytype_uint8 yytranslate[] = YYRHS. */ static const yytype_uint16 yyprhs[] = { - 0, 0, 3, 5, 6, 10, 11, 13, 15, 17, - 22, 23, 27, 28, 30, 32, 34, 39, 41, 45, - 46, 47, 57, 58, 59, 72, 73, 74, 82, 83, - 84, 94, 95, 96, 97, 110, 111, 118, 121, 125, - 128, 132, 135, 139, 143, 147, 151, 155, 157, 160, - 164, 170, 171, 172, 183, 184, 185, 196, 197, 204, - 206, 207, 208, 209, 210, 211, 230, 234, 236, 237, - 239, 242, 243, 244, 255, 257, 261, 263, 265, 269, - 271, 273, 274, 276, 277, 278, 290, 291, 300, 301, - 309, 311, 314, 317, 318, 321, 323, 324, 327, 328, - 331, 333, 337, 338, 341, 343, 346, 348, 353, 355, - 360, 362, 367, 371, 377, 381, 386, 391, 397, 398, - 399, 406, 407, 413, 415, 417, 419, 424, 425, 426, - 434, 435, 436, 445, 446, 449, 450, 454, 456, 457, - 460, 464, 470, 475, 480, 486, 494, 501, 502, 504, - 506, 508, 509, 511, 513, 516, 520, 524, 529, 533, - 535, 537, 540, 545, 549, 555, 557, 561, 564, 565, - 566, 571, 574, 575, 576, 587, 589, 593, 595, 597, - 598, 600, 602, 605, 607, 609, 611, 613, 615, 617, - 621, 627, 629, 633, 639, 644, 648, 650, 651, 653, - 654, 659, 661, 662, 670, 674, 679, 680, 688, 689, - 694, 697, 701, 705, 709, 713, 717, 721, 725, 729, - 733, 737, 741, 744, 747, 750, 753, 754, 759, 760, - 765, 766, 771, 772, 777, 781, 785, 789, 793, 797, - 801, 805, 809, 813, 817, 821, 825, 828, 831, 834, - 837, 841, 845, 849, 853, 857, 861, 865, 869, 873, - 877, 878, 879, 887, 889, 892, 895, 898, 901, 904, - 907, 910, 913, 914, 918, 920, 925, 929, 932, 933, - 939, 940, 948, 949, 957, 958, 964, 966, 968, 970, - 971, 972, 979, 981, 984, 985, 988, 989, 992, 996, - 997, 1001, 1003, 1005, 1007, 1009, 1011, 1013, 1015, 1017, - 1019, 1021, 1024, 1027, 1032, 1034, 1038, 1040, 1042, 1044, - 1046, 1050, 1054, 1055, 1058, 1059, 1061, 1067, 1071, 1075, - 1077, 1079, 1081, 1083, 1085, 1087, 1088, 1089, 1097, 1099, - 1102, 1103, 1104, 1109, 1110, 1115, 1116, 1118, 1121, 1125, - 1127, 1129, 1131, 1134, 1136, 1141, 1146, 1148, 1150, 1155, - 1156, 1158, 1160, 1161, 1164, 1169, 1174, 1176, 1178, 1182, - 1184, 1187, 1191, 1193, 1195, 1196, 1202, 1203, 1204, 1207, - 1213, 1217, 1221, 1223, 1230, 1235, 1240, 1243, 1246, 1249, - 1250, 1252, 1253, 1259, 1263, 1267, 1274, 1278, 1280, 1282, - 1284, 1289, 1294, 1297, 1300, 1305, 1308, 1311, 1313, 1314, - 1319 + 0, 0, 3, 5, 6, 10, 11, 13, 17, 19, + 21, 23, 28, 32, 33, 40, 41, 47, 51, 54, + 58, 60, 62, 66, 69, 74, 80, 85, 86, 90, + 91, 93, 95, 97, 102, 104, 107, 111, 112, 113, + 123, 124, 125, 138, 139, 140, 148, 149, 150, 160, + 161, 162, 163, 176, 177, 184, 187, 191, 194, 198, + 201, 205, 209, 213, 217, 221, 223, 226, 232, 233, + 234, 245, 246, 247, 258, 259, 266, 268, 269, 270, + 271, 272, 273, 292, 296, 300, 302, 303, 305, 308, + 309, 310, 321, 323, 327, 329, 331, 333, 334, 336, + 337, 348, 349, 358, 359, 367, 369, 372, 375, 376, + 379, 381, 382, 385, 386, 389, 391, 395, 396, 399, + 401, 404, 406, 411, 413, 418, 420, 425, 429, 435, + 439, 444, 449, 455, 456, 457, 464, 465, 471, 473, + 475, 477, 482, 483, 484, 492, 493, 494, 503, 504, + 507, 508, 512, 514, 515, 518, 522, 528, 533, 538, + 544, 552, 559, 560, 562, 564, 566, 567, 569, 571, + 574, 578, 582, 587, 591, 593, 595, 598, 603, 607, + 613, 615, 619, 622, 623, 624, 629, 632, 633, 643, + 645, 649, 651, 653, 654, 656, 658, 661, 663, 665, + 667, 669, 671, 673, 677, 683, 685, 689, 695, 700, + 704, 706, 707, 709, 710, 715, 717, 718, 726, 730, + 735, 736, 744, 745, 750, 753, 757, 761, 765, 769, + 773, 777, 781, 785, 789, 793, 797, 800, 803, 806, + 809, 810, 815, 816, 821, 822, 827, 828, 833, 837, + 841, 845, 849, 853, 857, 861, 865, 869, 873, 877, + 881, 884, 887, 890, 893, 897, 901, 905, 909, 913, + 917, 921, 925, 929, 933, 934, 935, 943, 944, 950, + 952, 955, 958, 961, 964, 967, 970, 973, 976, 977, + 981, 983, 988, 992, 995, 996, 1007, 1009, 1010, 1015, + 1019, 1024, 1026, 1029, 1030, 1036, 1037, 1045, 1046, 1053, + 1054, 1062, 1063, 1071, 1072, 1080, 1081, 1089, 1090, 1096, + 1098, 1100, 1104, 1107, 1109, 1113, 1116, 1118, 1120, 1121, + 1122, 1129, 1131, 1134, 1135, 1138, 1139, 1142, 1146, 1147, + 1149, 1151, 1152, 1156, 1158, 1160, 1162, 1164, 1166, 1168, + 1170, 1172, 1174, 1176, 1180, 1183, 1185, 1187, 1191, 1194, + 1197, 1200, 1205, 1207, 1211, 1213, 1215, 1217, 1221, 1224, + 1226, 1230, 1234, 1235, 1238, 1239, 1241, 1247, 1251, 1255, + 1257, 1259, 1261, 1263, 1265, 1267, 1268, 1269, 1277, 1279, + 1282, 1283, 1284, 1289, 1290, 1295, 1296, 1298, 1301, 1305, + 1309, 1311, 1313, 1315, 1317, 1320, 1322, 1327, 1332, 1334, + 1336, 1341, 1342, 1344, 1346, 1347, 1350, 1355, 1360, 1362, + 1364, 1368, 1370, 1373, 1377, 1379, 1381, 1382, 1388, 1389, + 1390, 1393, 1399, 1403, 1407, 1409, 1416, 1421, 1426, 1429, + 1432, 1435, 1437, 1440, 1442, 1443, 1449, 1453, 1457, 1464, + 1468, 1470, 1472, 1474, 1479, 1484, 1487, 1490, 1495, 1498, + 1501, 1503, 1504, 1509, 1513 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 150, 0, -1, 151, -1, -1, 151, 152, 153, -1, - -1, 157, -1, 189, -1, 190, -1, 115, 140, 141, - 142, -1, -1, 154, 155, 156, -1, -1, 157, -1, - 189, -1, 190, -1, 115, 140, 141, 142, -1, 158, - -1, 143, 154, 144, -1, -1, -1, 65, 140, 278, - 141, 159, 157, 160, 216, 220, -1, -1, -1, 65, - 140, 278, 141, 26, 161, 154, 162, 218, 221, 68, - 142, -1, -1, -1, 82, 140, 163, 278, 141, 164, - 215, -1, -1, -1, 81, 165, 157, 82, 140, 166, - 278, 141, 142, -1, -1, -1, -1, 84, 140, 243, - 142, 167, 243, 142, 168, 243, 141, 169, 206, -1, - -1, 91, 140, 278, 141, 170, 210, -1, 95, 142, - -1, 95, 278, 142, -1, 96, 142, -1, 96, 278, - 142, -1, 99, 142, -1, 99, 246, 142, -1, 99, - 282, 142, -1, 104, 227, 142, -1, 110, 229, 142, - -1, 80, 242, 142, -1, 75, -1, 278, 142, -1, - 103, 188, 142, -1, 112, 140, 186, 141, 142, -1, - -1, -1, 86, 140, 282, 90, 171, 205, 204, 141, - 172, 207, -1, -1, -1, 86, 140, 246, 90, 173, - 282, 204, 141, 174, 207, -1, -1, 88, 175, 140, - 209, 141, 208, -1, 142, -1, -1, -1, -1, -1, - -1, 100, 176, 143, 154, 144, 101, 140, 177, 262, - 178, 73, 141, 179, 143, 154, 144, 180, 181, -1, - 102, 278, 142, -1, 182, -1, -1, 183, -1, 182, - 183, -1, -1, -1, 101, 140, 262, 184, 73, 141, - 185, 143, 154, 144, -1, 187, -1, 186, 8, 187, - -1, 282, -1, 79, -1, 140, 79, 141, -1, 192, - -1, 195, -1, -1, 31, -1, -1, -1, 97, 193, - 191, 71, 194, 140, 222, 141, 143, 154, 144, -1, - -1, 198, 71, 199, 196, 202, 143, 230, 144, -1, - -1, 200, 71, 197, 201, 143, 230, 144, -1, 116, - -1, 109, 116, -1, 108, 116, -1, -1, 118, 262, - -1, 117, -1, -1, 118, 203, -1, -1, 119, 203, - -1, 262, -1, 203, 8, 262, -1, -1, 121, 205, - -1, 282, -1, 31, 282, -1, 157, -1, 26, 154, - 85, 142, -1, 157, -1, 26, 154, 87, 142, -1, - 157, -1, 26, 154, 89, 142, -1, 71, 13, 272, - -1, 209, 8, 71, 13, 272, -1, 143, 211, 144, - -1, 143, 142, 211, 144, -1, 26, 211, 92, 142, - -1, 26, 142, 211, 92, 142, -1, -1, -1, 211, - 93, 278, 214, 212, 154, -1, -1, 211, 94, 214, - 213, 154, -1, 26, -1, 142, -1, 157, -1, 26, - 154, 83, 142, -1, -1, -1, 216, 66, 140, 278, - 141, 217, 157, -1, -1, -1, 218, 66, 140, 278, - 141, 26, 219, 154, -1, -1, 67, 157, -1, -1, - 67, 26, 154, -1, 223, -1, -1, 224, 73, -1, - 224, 31, 73, -1, 224, 31, 73, 13, 272, -1, - 224, 73, 13, 272, -1, 223, 8, 224, 73, -1, - 223, 8, 224, 31, 73, -1, 223, 8, 224, 31, - 73, 13, 272, -1, 223, 8, 224, 73, 13, 272, - -1, -1, 71, -1, 123, -1, 226, -1, -1, 246, - -1, 282, -1, 31, 280, -1, 226, 8, 246, -1, - 226, 8, 282, -1, 226, 8, 31, 280, -1, 227, - 8, 228, -1, 228, -1, 73, -1, 145, 279, -1, - 145, 143, 278, 144, -1, 229, 8, 73, -1, 229, - 8, 73, 13, 272, -1, 73, -1, 73, 13, 272, - -1, 230, 231, -1, -1, -1, 236, 232, 240, 142, - -1, 241, 142, -1, -1, -1, 237, 97, 233, 191, - 71, 234, 140, 222, 141, 235, -1, 142, -1, 143, - 154, 144, -1, 238, -1, 111, -1, -1, 238, -1, - 239, -1, 238, 239, -1, 105, -1, 106, -1, 107, - -1, 110, -1, 109, -1, 108, -1, 240, 8, 73, - -1, 240, 8, 73, 13, 272, -1, 73, -1, 73, - 13, 272, -1, 241, 8, 71, 13, 272, -1, 98, - 71, 13, 272, -1, 242, 8, 278, -1, 278, -1, - -1, 244, -1, -1, 244, 8, 245, 278, -1, 278, - -1, -1, 122, 140, 247, 302, 141, 13, 278, -1, - 282, 13, 278, -1, 282, 13, 31, 282, -1, -1, - 282, 13, 31, 63, 263, 248, 270, -1, -1, 63, - 263, 249, 270, -1, 62, 278, -1, 282, 24, 278, - -1, 282, 23, 278, -1, 282, 22, 278, -1, 282, - 21, 278, -1, 282, 20, 278, -1, 282, 19, 278, - -1, 282, 18, 278, -1, 282, 17, 278, -1, 282, - 16, 278, -1, 282, 15, 278, -1, 282, 14, 278, - -1, 281, 60, -1, 60, 281, -1, 281, 59, -1, - 59, 281, -1, -1, 278, 27, 250, 278, -1, -1, - 278, 28, 251, 278, -1, -1, 278, 9, 252, 278, - -1, -1, 278, 11, 253, 278, -1, 278, 10, 278, - -1, 278, 29, 278, -1, 278, 31, 278, -1, 278, - 30, 278, -1, 278, 44, 278, -1, 278, 42, 278, - -1, 278, 43, 278, -1, 278, 45, 278, -1, 278, - 46, 278, -1, 278, 47, 278, -1, 278, 41, 278, - -1, 278, 40, 278, -1, 42, 278, -1, 43, 278, - -1, 48, 278, -1, 50, 278, -1, 278, 33, 278, - -1, 278, 32, 278, -1, 278, 35, 278, -1, 278, - 34, 278, -1, 278, 36, 278, -1, 278, 39, 278, - -1, 278, 37, 278, -1, 278, 38, 278, -1, 278, - 49, 263, -1, 140, 278, 141, -1, -1, -1, 278, - 25, 254, 278, 26, 255, 278, -1, 311, -1, 58, - 278, -1, 57, 278, -1, 56, 278, -1, 55, 278, - -1, 54, 278, -1, 53, 278, -1, 52, 278, -1, - 64, 269, -1, -1, 51, 256, 278, -1, 274, -1, - 123, 140, 305, 141, -1, 146, 307, 146, -1, 12, - 278, -1, -1, 71, 140, 258, 225, 141, -1, -1, - 262, 139, 71, 140, 259, 225, 141, -1, -1, 262, - 139, 290, 140, 260, 225, 141, -1, -1, 290, 140, - 261, 225, 141, -1, 71, -1, 71, -1, 264, -1, - -1, -1, 293, 120, 265, 297, 266, 267, -1, 293, - -1, 267, 268, -1, -1, 120, 297, -1, -1, 140, - 141, -1, 140, 278, 141, -1, -1, 140, 225, 141, - -1, 69, -1, 70, -1, 79, -1, 127, -1, 128, - -1, 124, -1, 125, -1, 126, -1, 271, -1, 71, - -1, 42, 272, -1, 43, 272, -1, 123, 140, 275, - 141, -1, 273, -1, 71, 139, 71, -1, 71, -1, - 72, -1, 314, -1, 271, -1, 147, 307, 147, -1, - 135, 307, 136, -1, -1, 277, 276, -1, -1, 8, - -1, 277, 8, 272, 121, 272, -1, 277, 8, 272, - -1, 272, 121, 272, -1, 272, -1, 279, -1, 246, - -1, 282, -1, 282, -1, 282, -1, -1, -1, 292, - 120, 283, 297, 284, 288, 285, -1, 292, -1, 285, - 286, -1, -1, -1, 120, 297, 287, 288, -1, -1, - 140, 289, 225, 141, -1, -1, 294, -1, 301, 294, - -1, 262, 139, 290, -1, 293, -1, 257, -1, 294, - -1, 301, 294, -1, 291, -1, 294, 61, 296, 148, - -1, 294, 143, 278, 144, -1, 295, -1, 73, -1, - 145, 143, 278, 144, -1, -1, 278, -1, 299, -1, - -1, 290, 298, -1, 299, 61, 296, 148, -1, 299, - 143, 278, 144, -1, 300, -1, 71, -1, 143, 278, - 144, -1, 145, -1, 301, 145, -1, 302, 8, 303, - -1, 303, -1, 282, -1, -1, 122, 140, 304, 302, - 141, -1, -1, -1, 306, 276, -1, 306, 8, 278, - 121, 278, -1, 306, 8, 278, -1, 278, 121, 278, - -1, 278, -1, 306, 8, 278, 121, 31, 280, -1, - 306, 8, 31, 280, -1, 278, 121, 31, 280, -1, - 31, 280, -1, 307, 308, -1, 307, 78, -1, -1, - 73, -1, -1, 73, 61, 309, 310, 148, -1, 73, - 120, 71, -1, 137, 278, 144, -1, 137, 72, 61, - 278, 148, 144, -1, 138, 282, 144, -1, 71, -1, - 74, -1, 73, -1, 113, 140, 312, 141, -1, 114, - 140, 282, 141, -1, 7, 278, -1, 6, 278, -1, - 5, 140, 278, 141, -1, 4, 278, -1, 3, 278, - -1, 282, -1, -1, 312, 8, 313, 282, -1, 262, - 139, 71, -1 + 155, 0, -1, 156, -1, -1, 156, 157, 159, -1, + -1, 71, -1, 158, 144, 71, -1, 168, -1, 199, + -1, 200, -1, 116, 145, 146, 147, -1, 141, 158, + 147, -1, -1, 141, 158, 148, 160, 156, 149, -1, + -1, 141, 148, 161, 156, 149, -1, 104, 162, 147, + -1, 164, 147, -1, 162, 8, 163, -1, 163, -1, + 158, -1, 158, 90, 71, -1, 144, 158, -1, 144, + 158, 90, 71, -1, 164, 8, 71, 13, 291, -1, + 99, 71, 13, 291, -1, -1, 165, 166, 167, -1, + -1, 168, -1, 199, -1, 200, -1, 116, 145, 146, + 147, -1, 169, -1, 71, 26, -1, 148, 165, 149, + -1, -1, -1, 65, 145, 297, 146, 170, 168, 171, + 225, 229, -1, -1, -1, 65, 145, 297, 146, 26, + 172, 165, 173, 227, 230, 68, 147, -1, -1, -1, + 82, 145, 174, 297, 146, 175, 224, -1, -1, -1, + 81, 176, 168, 82, 145, 177, 297, 146, 147, -1, + -1, -1, -1, 84, 145, 251, 147, 178, 251, 147, + 179, 251, 146, 180, 215, -1, -1, 91, 145, 297, + 146, 181, 219, -1, 95, 147, -1, 95, 297, 147, + -1, 96, 147, -1, 96, 297, 147, -1, 100, 147, + -1, 100, 254, 147, -1, 100, 301, 147, -1, 105, + 236, 147, -1, 111, 238, 147, -1, 80, 250, 147, + -1, 75, -1, 297, 147, -1, 113, 145, 197, 146, + 147, -1, -1, -1, 86, 145, 301, 90, 182, 214, + 213, 146, 183, 216, -1, -1, -1, 86, 145, 254, + 90, 184, 301, 213, 146, 185, 216, -1, -1, 88, + 186, 145, 218, 146, 217, -1, 147, -1, -1, -1, + -1, -1, -1, 101, 187, 148, 165, 149, 102, 145, + 188, 280, 189, 73, 146, 190, 148, 165, 149, 191, + 192, -1, 103, 297, 147, -1, 97, 71, 147, -1, + 193, -1, -1, 194, -1, 193, 194, -1, -1, -1, + 102, 145, 280, 195, 73, 146, 196, 148, 165, 149, + -1, 198, -1, 197, 8, 198, -1, 301, -1, 202, + -1, 204, -1, -1, 31, -1, -1, 267, 201, 71, + 203, 145, 231, 146, 148, 165, 149, -1, -1, 207, + 71, 208, 205, 211, 148, 239, 149, -1, -1, 209, + 71, 206, 210, 148, 239, 149, -1, 117, -1, 110, + 117, -1, 109, 117, -1, -1, 119, 280, -1, 118, + -1, -1, 119, 212, -1, -1, 120, 212, -1, 280, + -1, 212, 8, 280, -1, -1, 122, 214, -1, 301, + -1, 31, 301, -1, 168, -1, 26, 165, 85, 147, + -1, 168, -1, 26, 165, 87, 147, -1, 168, -1, + 26, 165, 89, 147, -1, 71, 13, 291, -1, 218, + 8, 71, 13, 291, -1, 148, 220, 149, -1, 148, + 147, 220, 149, -1, 26, 220, 92, 147, -1, 26, + 147, 220, 92, 147, -1, -1, -1, 220, 93, 297, + 223, 221, 165, -1, -1, 220, 94, 223, 222, 165, + -1, 26, -1, 147, -1, 168, -1, 26, 165, 83, + 147, -1, -1, -1, 225, 66, 145, 297, 146, 226, + 168, -1, -1, -1, 227, 66, 145, 297, 146, 26, + 228, 165, -1, -1, 67, 168, -1, -1, 67, 26, + 165, -1, 232, -1, -1, 233, 73, -1, 233, 31, + 73, -1, 233, 31, 73, 13, 291, -1, 233, 73, + 13, 291, -1, 232, 8, 233, 73, -1, 232, 8, + 233, 31, 73, -1, 232, 8, 233, 31, 73, 13, + 291, -1, 232, 8, 233, 73, 13, 291, -1, -1, + 280, -1, 124, -1, 235, -1, -1, 254, -1, 301, + -1, 31, 299, -1, 235, 8, 254, -1, 235, 8, + 301, -1, 235, 8, 31, 299, -1, 236, 8, 237, + -1, 237, -1, 73, -1, 150, 298, -1, 150, 148, + 297, 149, -1, 238, 8, 73, -1, 238, 8, 73, + 13, 291, -1, 73, -1, 73, 13, 291, -1, 239, + 240, -1, -1, -1, 244, 241, 248, 147, -1, 249, + 147, -1, -1, 245, 267, 201, 71, 242, 145, 231, + 146, 243, -1, 147, -1, 148, 165, 149, -1, 246, + -1, 112, -1, -1, 246, -1, 247, -1, 246, 247, + -1, 106, -1, 107, -1, 108, -1, 111, -1, 110, + -1, 109, -1, 248, 8, 73, -1, 248, 8, 73, + 13, 291, -1, 73, -1, 73, 13, 291, -1, 249, + 8, 71, 13, 291, -1, 99, 71, 13, 291, -1, + 250, 8, 297, -1, 297, -1, -1, 252, -1, -1, + 252, 8, 253, 297, -1, 297, -1, -1, 123, 145, + 255, 322, 146, 13, 297, -1, 301, 13, 297, -1, + 301, 13, 31, 301, -1, -1, 301, 13, 31, 63, + 281, 256, 289, -1, -1, 63, 281, 257, 289, -1, + 62, 297, -1, 301, 24, 297, -1, 301, 23, 297, + -1, 301, 22, 297, -1, 301, 21, 297, -1, 301, + 20, 297, -1, 301, 19, 297, -1, 301, 18, 297, + -1, 301, 17, 297, -1, 301, 16, 297, -1, 301, + 15, 297, -1, 301, 14, 297, -1, 300, 60, -1, + 60, 300, -1, 300, 59, -1, 59, 300, -1, -1, + 297, 27, 258, 297, -1, -1, 297, 28, 259, 297, + -1, -1, 297, 9, 260, 297, -1, -1, 297, 11, + 261, 297, -1, 297, 10, 297, -1, 297, 29, 297, + -1, 297, 31, 297, -1, 297, 30, 297, -1, 297, + 44, 297, -1, 297, 42, 297, -1, 297, 43, 297, + -1, 297, 45, 297, -1, 297, 46, 297, -1, 297, + 47, 297, -1, 297, 41, 297, -1, 297, 40, 297, + -1, 42, 297, -1, 43, 297, -1, 48, 297, -1, + 50, 297, -1, 297, 33, 297, -1, 297, 32, 297, + -1, 297, 35, 297, -1, 297, 34, 297, -1, 297, + 36, 297, -1, 297, 39, 297, -1, 297, 37, 297, + -1, 297, 38, 297, -1, 297, 49, 281, -1, 145, + 297, 146, -1, -1, -1, 297, 25, 262, 297, 26, + 263, 297, -1, -1, 297, 25, 26, 264, 297, -1, + 331, -1, 58, 297, -1, 57, 297, -1, 56, 297, + -1, 55, 297, -1, 54, 297, -1, 53, 297, -1, + 52, 297, -1, 64, 287, -1, -1, 51, 265, 297, + -1, 293, -1, 124, 145, 325, 146, -1, 151, 288, + 151, -1, 12, 297, -1, -1, 267, 201, 145, 266, + 231, 146, 268, 148, 165, 149, -1, 98, -1, -1, + 104, 145, 269, 146, -1, 269, 8, 73, -1, 269, + 8, 31, 73, -1, 73, -1, 31, 73, -1, -1, + 158, 145, 271, 234, 146, -1, -1, 141, 144, 158, + 145, 272, 234, 146, -1, -1, 144, 158, 145, 273, + 234, 146, -1, -1, 279, 140, 71, 145, 274, 234, + 146, -1, -1, 279, 140, 309, 145, 275, 234, 146, + -1, -1, 311, 140, 71, 145, 276, 234, 146, -1, + -1, 311, 140, 309, 145, 277, 234, 146, -1, -1, + 309, 145, 278, 234, 146, -1, 111, -1, 158, -1, + 141, 144, 158, -1, 144, 158, -1, 158, -1, 141, + 144, 158, -1, 144, 158, -1, 279, -1, 282, -1, + -1, -1, 313, 121, 283, 317, 284, 285, -1, 313, + -1, 285, 286, -1, -1, 121, 317, -1, -1, 145, + 146, -1, 145, 297, 146, -1, -1, 78, -1, 327, + -1, -1, 145, 234, 146, -1, 69, -1, 70, -1, + 79, -1, 128, -1, 129, -1, 143, -1, 125, -1, + 126, -1, 127, -1, 142, -1, 136, 78, 137, -1, + 136, 137, -1, 290, -1, 158, -1, 141, 144, 158, + -1, 144, 158, -1, 42, 291, -1, 43, 291, -1, + 124, 145, 294, 146, -1, 292, -1, 279, 140, 71, + -1, 72, -1, 334, -1, 158, -1, 141, 144, 158, + -1, 144, 158, -1, 290, -1, 152, 327, 152, -1, + 136, 327, 137, -1, -1, 296, 295, -1, -1, 8, + -1, 296, 8, 291, 122, 291, -1, 296, 8, 291, + -1, 291, 122, 291, -1, 291, -1, 298, -1, 254, + -1, 301, -1, 301, -1, 301, -1, -1, -1, 312, + 121, 302, 317, 303, 307, 304, -1, 312, -1, 304, + 305, -1, -1, -1, 121, 317, 306, 307, -1, -1, + 145, 308, 234, 146, -1, -1, 314, -1, 321, 314, + -1, 279, 140, 309, -1, 311, 140, 309, -1, 314, + -1, 313, -1, 270, -1, 314, -1, 321, 314, -1, + 310, -1, 314, 61, 316, 153, -1, 314, 148, 297, + 149, -1, 315, -1, 73, -1, 150, 148, 297, 149, + -1, -1, 297, -1, 319, -1, -1, 309, 318, -1, + 319, 61, 316, 153, -1, 319, 148, 297, 149, -1, + 320, -1, 71, -1, 148, 297, 149, -1, 150, -1, + 321, 150, -1, 322, 8, 323, -1, 323, -1, 301, + -1, -1, 123, 145, 324, 322, 146, -1, -1, -1, + 326, 295, -1, 326, 8, 297, 122, 297, -1, 326, + 8, 297, -1, 297, 122, 297, -1, 297, -1, 326, + 8, 297, 122, 31, 299, -1, 326, 8, 31, 299, + -1, 297, 122, 31, 299, -1, 31, 299, -1, 327, + 328, -1, 327, 78, -1, 328, -1, 78, 328, -1, + 73, -1, -1, 73, 61, 329, 330, 153, -1, 73, + 121, 71, -1, 138, 297, 149, -1, 138, 72, 61, + 297, 153, 149, -1, 139, 301, 149, -1, 71, -1, + 74, -1, 73, -1, 114, 145, 332, 146, -1, 115, + 145, 301, 146, -1, 7, 297, -1, 6, 297, -1, + 5, 145, 297, 146, -1, 4, 297, -1, 3, 297, + -1, 301, -1, -1, 332, 8, 333, 301, -1, 279, + 140, 71, -1, 311, 140, 71, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 150, 150, 154, 154, 155, 160, 161, 162, 163, - 168, 168, 169, 174, 175, 176, 177, 182, 186, 187, - 187, 187, 188, 188, 188, 189, 189, 189, 190, 190, - 190, 194, 196, 198, 191, 200, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 216, 217, 215, 220, 221, 219, 223, 223, 224, - 225, 226, 227, 228, 229, 225, 231, 236, 237, 241, - 242, 247, 247, 247, 252, 253, 257, 261, 262, 267, - 271, 276, 277, 282, 282, 282, 288, 287, 294, 293, - 303, 304, 305, 309, 310, 314, 317, 319, 322, 324, - 328, 329, 333, 334, 339, 340, 344, 345, 350, 351, - 356, 357, 362, 363, 368, 369, 370, 371, 376, 377, - 377, 378, 378, 383, 384, 389, 390, 395, 397, 397, - 401, 403, 403, 407, 409, 413, 415, 420, 421, 426, - 427, 428, 429, 430, 431, 432, 433, 438, 439, 440, - 445, 446, 451, 452, 453, 454, 455, 456, 460, 461, - 466, 467, 468, 473, 474, 475, 476, 482, 483, 488, - 488, 489, 490, 490, 490, 496, 497, 501, 502, 506, - 507, 511, 512, 516, 517, 518, 519, 520, 521, 525, - 526, 527, 528, 532, 533, 537, 538, 543, 544, 548, - 548, 549, 553, 553, 554, 555, 556, 556, 557, 557, - 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, - 568, 569, 570, 571, 572, 573, 574, 574, 575, 575, - 576, 576, 577, 577, 578, 579, 580, 581, 582, 583, - 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, - 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, - 604, 605, 604, 607, 608, 609, 610, 611, 612, 613, - 614, 615, 616, 616, 617, 618, 619, 620, 624, 624, - 627, 627, 630, 630, 633, 633, 639, 643, 644, 649, - 650, 649, 652, 657, 658, 663, 667, 668, 669, 674, - 675, 680, 681, 682, 683, 684, 685, 686, 687, 692, - 693, 694, 695, 696, 697, 701, 705, 706, 707, 708, - 709, 710, 715, 716, 719, 721, 725, 726, 727, 728, - 732, 733, 738, 743, 748, 753, 754, 753, 756, 760, - 761, 766, 766, 770, 770, 774, 778, 779, 783, 788, - 789, 794, 795, 796, 800, 801, 802, 807, 808, 812, - 813, 818, 819, 819, 823, 824, 825, 829, 830, 834, - 835, 839, 840, 845, 846, 846, 847, 852, 853, 857, - 858, 859, 860, 861, 862, 863, 864, 868, 869, 870, - 877, 878, 878, 879, 880, 881, 882, 887, 888, 889, - 894, 895, 896, 897, 898, 899, 900, 904, 905, 905, - 909 + 0, 155, 155, 159, 159, 160, 164, 165, 169, 170, + 171, 172, 173, 174, 174, 176, 176, 178, 179, 183, + 184, 188, 189, 190, 191, 195, 196, 200, 200, 201, + 206, 207, 208, 209, 214, 215, 219, 220, 220, 220, + 221, 221, 221, 222, 222, 222, 223, 223, 223, 227, + 229, 231, 224, 233, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 248, 249, + 247, 252, 253, 251, 255, 255, 256, 257, 258, 259, + 260, 261, 257, 263, 264, 269, 270, 274, 275, 280, + 280, 280, 285, 286, 290, 294, 298, 303, 304, 309, + 309, 315, 314, 321, 320, 330, 331, 332, 336, 337, + 341, 344, 346, 349, 351, 355, 356, 360, 361, 366, + 367, 371, 372, 377, 378, 383, 384, 389, 390, 395, + 396, 397, 398, 403, 404, 404, 405, 405, 410, 411, + 416, 417, 422, 424, 424, 428, 430, 430, 434, 436, + 440, 442, 447, 448, 453, 454, 455, 456, 457, 458, + 459, 460, 465, 466, 467, 472, 473, 478, 479, 480, + 481, 482, 483, 487, 488, 493, 494, 495, 500, 501, + 502, 503, 509, 510, 515, 515, 516, 517, 517, 523, + 524, 528, 529, 533, 534, 538, 539, 543, 544, 545, + 546, 547, 548, 552, 553, 554, 555, 559, 560, 564, + 565, 570, 571, 575, 575, 576, 580, 580, 581, 582, + 583, 583, 584, 584, 585, 586, 587, 588, 589, 590, + 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, + 601, 601, 602, 602, 603, 603, 604, 604, 605, 606, + 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, + 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, + 627, 628, 629, 630, 631, 632, 631, 634, 634, 636, + 637, 638, 639, 640, 641, 642, 643, 644, 645, 645, + 646, 647, 648, 649, 650, 650, 655, 658, 660, 664, + 665, 666, 667, 671, 671, 674, 674, 677, 677, 680, + 680, 683, 683, 686, 686, 689, 689, 692, 692, 698, + 699, 700, 701, 705, 706, 707, 713, 714, 719, 720, + 719, 722, 727, 728, 733, 737, 738, 739, 743, 744, + 745, 750, 751, 756, 757, 758, 759, 760, 761, 762, + 763, 764, 765, 766, 767, 772, 773, 774, 775, 776, + 777, 778, 779, 783, 787, 788, 789, 790, 791, 792, + 793, 794, 799, 800, 803, 805, 809, 810, 811, 812, + 816, 817, 822, 827, 832, 837, 838, 837, 840, 844, + 845, 850, 850, 854, 854, 858, 862, 863, 867, 868, + 873, 877, 878, 883, 884, 885, 889, 890, 891, 896, + 897, 901, 902, 907, 908, 908, 912, 913, 914, 918, + 919, 923, 924, 928, 929, 934, 935, 935, 936, 941, + 942, 946, 947, 948, 949, 950, 951, 952, 953, 957, + 958, 959, 960, 966, 967, 967, 968, 969, 970, 971, + 976, 977, 978, 983, 984, 985, 986, 987, 988, 989, + 993, 994, 994, 998, 999 }; #endif @@ -932,7 +972,7 @@ static const char *const yytname[] = "T_ENCAPSED_AND_WHITESPACE", "T_CONSTANT_ENCAPSED_STRING", "T_ECHO", "T_DO", "T_WHILE", "T_ENDWHILE", "T_FOR", "T_ENDFOR", "T_FOREACH", "T_ENDFOREACH", "T_DECLARE", "T_ENDDECLARE", "T_AS", "T_SWITCH", - "T_ENDSWITCH", "T_CASE", "T_DEFAULT", "T_BREAK", "T_CONTINUE", + "T_ENDSWITCH", "T_CASE", "T_DEFAULT", "T_BREAK", "T_CONTINUE", "T_GOTO", "T_FUNCTION", "T_CONST", "T_RETURN", "T_TRY", "T_CATCH", "T_THROW", "T_USE", "T_GLOBAL", "T_PUBLIC", "T_PROTECTED", "T_PRIVATE", "T_FINAL", "T_ABSTRACT", "T_STATIC", "T_VAR", "T_UNSET", "T_ISSET", "T_EMPTY", @@ -942,51 +982,54 @@ static const char *const yytname[] = "T_DOC_COMMENT", "T_OPEN_TAG", "T_OPEN_TAG_WITH_ECHO", "T_CLOSE_TAG", "T_WHITESPACE", "T_START_HEREDOC", "T_END_HEREDOC", "T_DOLLAR_OPEN_CURLY_BRACES", "T_CURLY_OPEN", "T_PAAMAYIM_NEKUDOTAYIM", - "'('", "')'", "';'", "'{'", "'}'", "'$'", "'`'", "'\"'", "']'", - "$accept", "start", "top_statement_list", "@1", "top_statement", - "inner_statement_list", "@2", "inner_statement", "statement", - "unticked_statement", "@3", "@4", "@5", "@6", "@7", "@8", "@9", "@10", - "@11", "@12", "@13", "@14", "@15", "@16", "@17", "@18", "@19", "@20", - "@21", "@22", "@23", "@24", "additional_catches", - "non_empty_additional_catches", "additional_catch", "@25", "@26", - "unset_variables", "unset_variable", "use_filename", - "function_declaration_statement", "class_declaration_statement", - "is_reference", "unticked_function_declaration_statement", "@27", "@28", - "unticked_class_declaration_statement", "@29", "@30", "class_entry_type", + "T_NAMESPACE", "T_NS_C", "T_DIR", "T_NS_SEPARATOR", "'('", "')'", "';'", + "'{'", "'}'", "'$'", "'`'", "'\"'", "']'", "$accept", "start", + "top_statement_list", "@1", "namespace_name", "top_statement", "@2", + "@3", "use_declarations", "use_declaration", "constant_declaration", + "inner_statement_list", "@4", "inner_statement", "statement", + "unticked_statement", "@5", "@6", "@7", "@8", "@9", "@10", "@11", "@12", + "@13", "@14", "@15", "@16", "@17", "@18", "@19", "@20", "@21", "@22", + "@23", "@24", "@25", "@26", "additional_catches", + "non_empty_additional_catches", "additional_catch", "@27", "@28", + "unset_variables", "unset_variable", "function_declaration_statement", + "class_declaration_statement", "is_reference", + "unticked_function_declaration_statement", "@29", + "unticked_class_declaration_statement", "@30", "@31", "class_entry_type", "extends_from", "interface_entry", "interface_extends_list", "implements_list", "interface_list", "foreach_optional_arg", "foreach_variable", "for_statement", "foreach_statement", "declare_statement", "declare_list", "switch_case_list", "case_list", - "@31", "@32", "case_separator", "while_statement", "elseif_list", "@33", - "new_elseif_list", "@34", "else_single", "new_else_single", + "@32", "@33", "case_separator", "while_statement", "elseif_list", "@34", + "new_elseif_list", "@35", "else_single", "new_else_single", "parameter_list", "non_empty_parameter_list", "optional_class_type", "function_call_parameter_list", "non_empty_function_call_parameter_list", "global_var_list", "global_var", "static_var_list", - "class_statement_list", "class_statement", "@35", "@36", "@37", - "method_body", "variable_modifiers", "method_modifiers", - "non_empty_member_modifiers", "member_modifier", - "class_variable_declaration", "class_constant_declaration", - "echo_expr_list", "for_expr", "non_empty_for_expr", "@38", - "expr_without_variable", "@39", "@40", "@41", "@42", "@43", "@44", "@45", - "@46", "@47", "@48", "function_call", "@49", "@50", "@51", "@52", + "class_statement_list", "class_statement", "@36", "@37", "method_body", + "variable_modifiers", "method_modifiers", "non_empty_member_modifiers", + "member_modifier", "class_variable_declaration", + "class_constant_declaration", "echo_expr_list", "for_expr", + "non_empty_for_expr", "@38", "expr_without_variable", "@39", "@40", + "@41", "@42", "@43", "@44", "@45", "@46", "@47", "@48", "@49", "@50", + "function", "lexical_vars", "lexical_var_list", "function_call", "@51", + "@52", "@53", "@54", "@55", "@56", "@57", "@58", "class_name", "fully_qualified_class_name", "class_name_reference", - "dynamic_class_name_reference", "@53", "@54", + "dynamic_class_name_reference", "@59", "@60", "dynamic_class_name_variable_properties", - "dynamic_class_name_variable_property", "exit_expr", "ctor_arguments", - "common_scalar", "static_scalar", "static_class_constant", "scalar", - "static_array_pair_list", "possible_comma", - "non_empty_static_array_pair_list", "expr", "r_variable", "w_variable", - "rw_variable", "variable", "@55", "@56", "variable_properties", - "variable_property", "@57", "method_or_not", "@58", - "variable_without_objects", "static_member", - "base_variable_with_function_calls", "base_variable", - "reference_variable", "compound_variable", "dim_offset", - "object_property", "@59", "object_dim_list", "variable_name", + "dynamic_class_name_variable_property", "exit_expr", "backticks_expr", + "ctor_arguments", "common_scalar", "static_scalar", + "static_class_constant", "scalar", "static_array_pair_list", + "possible_comma", "non_empty_static_array_pair_list", "expr", + "r_variable", "w_variable", "rw_variable", "variable", "@61", "@62", + "variable_properties", "variable_property", "@63", "method_or_not", + "@64", "variable_without_objects", "static_member", + "variable_class_name", "base_variable_with_function_calls", + "base_variable", "reference_variable", "compound_variable", "dim_offset", + "object_property", "@65", "object_dim_list", "variable_name", "simple_indirect_reference", "assignment_list", - "assignment_list_element", "@60", "array_pair_list", - "non_empty_array_pair_list", "encaps_list", "encaps_var", "@61", + "assignment_list_element", "@66", "array_pair_list", + "non_empty_array_pair_list", "encaps_list", "encaps_var", "@67", "encaps_var_offset", "internal_functions_in_yacc", "isset_variables", - "@62", "class_constant", 0 + "@68", "class_constant", 0 }; #endif @@ -1009,102 +1052,113 @@ static const yytype_uint16 yytoknum[] = 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 40, 41, 59, 123, 125, 36, 96, 34, 93 + 376, 377, 378, 379, 380, 40, 41, 59, 123, 125, + 36, 96, 34, 93 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 149, 150, 152, 151, 151, 153, 153, 153, 153, - 155, 154, 154, 156, 156, 156, 156, 157, 158, 159, - 160, 158, 161, 162, 158, 163, 164, 158, 165, 166, - 158, 167, 168, 169, 158, 170, 158, 158, 158, 158, - 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, - 158, 171, 172, 158, 173, 174, 158, 175, 158, 158, - 176, 177, 178, 179, 180, 158, 158, 181, 181, 182, - 182, 184, 185, 183, 186, 186, 187, 188, 188, 189, - 190, 191, 191, 193, 194, 192, 196, 195, 197, 195, - 198, 198, 198, 199, 199, 200, 201, 201, 202, 202, - 203, 203, 204, 204, 205, 205, 206, 206, 207, 207, - 208, 208, 209, 209, 210, 210, 210, 210, 211, 212, - 211, 213, 211, 214, 214, 215, 215, 216, 217, 216, - 218, 219, 218, 220, 220, 221, 221, 222, 222, 223, - 223, 223, 223, 223, 223, 223, 223, 224, 224, 224, - 225, 225, 226, 226, 226, 226, 226, 226, 227, 227, - 228, 228, 228, 229, 229, 229, 229, 230, 230, 232, - 231, 231, 233, 234, 231, 235, 235, 236, 236, 237, - 237, 238, 238, 239, 239, 239, 239, 239, 239, 240, - 240, 240, 240, 241, 241, 242, 242, 243, 243, 245, - 244, 244, 247, 246, 246, 246, 248, 246, 249, 246, - 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 250, 246, 251, 246, - 252, 246, 253, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, - 254, 255, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 256, 246, 246, 246, 246, 246, 258, 257, - 259, 257, 260, 257, 261, 257, 262, 263, 263, 265, - 266, 264, 264, 267, 267, 268, 269, 269, 269, 270, - 270, 271, 271, 271, 271, 271, 271, 271, 271, 272, - 272, 272, 272, 272, 272, 273, 274, 274, 274, 274, - 274, 274, 275, 275, 276, 276, 277, 277, 277, 277, - 278, 278, 279, 280, 281, 283, 284, 282, 282, 285, - 285, 287, 286, 289, 288, 288, 290, 290, 291, 292, - 292, 293, 293, 293, 294, 294, 294, 295, 295, 296, - 296, 297, 298, 297, 299, 299, 299, 300, 300, 301, - 301, 302, 302, 303, 304, 303, 303, 305, 305, 306, - 306, 306, 306, 306, 306, 306, 306, 307, 307, 307, - 308, 309, 308, 308, 308, 308, 308, 310, 310, 310, - 311, 311, 311, 311, 311, 311, 311, 312, 313, 312, - 314 + 0, 154, 155, 157, 156, 156, 158, 158, 159, 159, + 159, 159, 159, 160, 159, 161, 159, 159, 159, 162, + 162, 163, 163, 163, 163, 164, 164, 166, 165, 165, + 167, 167, 167, 167, 168, 168, 169, 170, 171, 169, + 172, 173, 169, 174, 175, 169, 176, 177, 169, 178, + 179, 180, 169, 181, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 182, 183, + 169, 184, 185, 169, 186, 169, 169, 187, 188, 189, + 190, 191, 169, 169, 169, 192, 192, 193, 193, 195, + 196, 194, 197, 197, 198, 199, 200, 201, 201, 203, + 202, 205, 204, 206, 204, 207, 207, 207, 208, 208, + 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, + 214, 215, 215, 216, 216, 217, 217, 218, 218, 219, + 219, 219, 219, 220, 221, 220, 222, 220, 223, 223, + 224, 224, 225, 226, 225, 227, 228, 227, 229, 229, + 230, 230, 231, 231, 232, 232, 232, 232, 232, 232, + 232, 232, 233, 233, 233, 234, 234, 235, 235, 235, + 235, 235, 235, 236, 236, 237, 237, 237, 238, 238, + 238, 238, 239, 239, 241, 240, 240, 242, 240, 243, + 243, 244, 244, 245, 245, 246, 246, 247, 247, 247, + 247, 247, 247, 248, 248, 248, 248, 249, 249, 250, + 250, 251, 251, 253, 252, 252, 255, 254, 254, 254, + 256, 254, 257, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 258, 254, 259, 254, 260, 254, 261, 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, 262, 263, 254, 264, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 265, 254, + 254, 254, 254, 254, 266, 254, 267, 268, 268, 269, + 269, 269, 269, 271, 270, 272, 270, 273, 270, 274, + 270, 275, 270, 276, 270, 277, 270, 278, 270, 279, + 279, 279, 279, 280, 280, 280, 281, 281, 283, 284, + 282, 282, 285, 285, 286, 287, 287, 287, 288, 288, + 288, 289, 289, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 291, 291, 291, 291, 291, + 291, 291, 291, 292, 293, 293, 293, 293, 293, 293, + 293, 293, 294, 294, 295, 295, 296, 296, 296, 296, + 297, 297, 298, 299, 300, 302, 303, 301, 301, 304, + 304, 306, 305, 308, 307, 307, 309, 309, 310, 310, + 311, 312, 312, 313, 313, 313, 314, 314, 314, 315, + 315, 316, 316, 317, 318, 317, 319, 319, 319, 320, + 320, 321, 321, 322, 322, 323, 324, 323, 323, 325, + 325, 326, 326, 326, 326, 326, 326, 326, 326, 327, + 327, 327, 327, 328, 329, 328, 328, 328, 328, 328, + 330, 330, 330, 331, 331, 331, 331, 331, 331, 331, + 332, 333, 332, 334, 334 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 1, 0, 3, 0, 1, 1, 1, 4, - 0, 3, 0, 1, 1, 1, 4, 1, 3, 0, - 0, 9, 0, 0, 12, 0, 0, 7, 0, 0, - 9, 0, 0, 0, 12, 0, 6, 2, 3, 2, - 3, 2, 3, 3, 3, 3, 3, 1, 2, 3, - 5, 0, 0, 10, 0, 0, 10, 0, 6, 1, - 0, 0, 0, 0, 0, 18, 3, 1, 0, 1, - 2, 0, 0, 10, 1, 3, 1, 1, 3, 1, - 1, 0, 1, 0, 0, 11, 0, 8, 0, 7, - 1, 2, 2, 0, 2, 1, 0, 2, 0, 2, - 1, 3, 0, 2, 1, 2, 1, 4, 1, 4, - 1, 4, 3, 5, 3, 4, 4, 5, 0, 0, - 6, 0, 5, 1, 1, 1, 4, 0, 0, 7, - 0, 0, 8, 0, 2, 0, 3, 1, 0, 2, - 3, 5, 4, 4, 5, 7, 6, 0, 1, 1, - 1, 0, 1, 1, 2, 3, 3, 4, 3, 1, - 1, 2, 4, 3, 5, 1, 3, 2, 0, 0, - 4, 2, 0, 0, 10, 1, 3, 1, 1, 0, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, - 5, 1, 3, 5, 4, 3, 1, 0, 1, 0, - 4, 1, 0, 7, 3, 4, 0, 7, 0, 4, - 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 2, 2, 2, 2, 0, 4, 0, 4, - 0, 4, 0, 4, 3, 3, 3, 3, 3, 3, + 0, 2, 1, 0, 3, 0, 1, 3, 1, 1, + 1, 4, 3, 0, 6, 0, 5, 3, 2, 3, + 1, 1, 3, 2, 4, 5, 4, 0, 3, 0, + 1, 1, 1, 4, 1, 2, 3, 0, 0, 9, + 0, 0, 12, 0, 0, 7, 0, 0, 9, 0, + 0, 0, 12, 0, 6, 2, 3, 2, 3, 2, + 3, 3, 3, 3, 3, 1, 2, 5, 0, 0, + 10, 0, 0, 10, 0, 6, 1, 0, 0, 0, + 0, 0, 18, 3, 3, 1, 0, 1, 2, 0, + 0, 10, 1, 3, 1, 1, 1, 0, 1, 0, + 10, 0, 8, 0, 7, 1, 2, 2, 0, 2, + 1, 0, 2, 0, 2, 1, 3, 0, 2, 1, + 2, 1, 4, 1, 4, 1, 4, 3, 5, 3, + 4, 4, 5, 0, 0, 6, 0, 5, 1, 1, + 1, 4, 0, 0, 7, 0, 0, 8, 0, 2, + 0, 3, 1, 0, 2, 3, 5, 4, 4, 5, + 7, 6, 0, 1, 1, 1, 0, 1, 1, 2, + 3, 3, 4, 3, 1, 1, 2, 4, 3, 5, + 1, 3, 2, 0, 0, 4, 2, 0, 9, 1, + 3, 1, 1, 0, 1, 1, 2, 1, 1, 1, + 1, 1, 1, 3, 5, 1, 3, 5, 4, 3, + 1, 0, 1, 0, 4, 1, 0, 7, 3, 4, + 0, 7, 0, 4, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, + 0, 4, 0, 4, 0, 4, 0, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 0, 0, 7, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 0, 3, 1, 4, 3, 2, 0, 5, - 0, 7, 0, 7, 0, 5, 1, 1, 1, 0, - 0, 6, 1, 2, 0, 2, 0, 2, 3, 0, - 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 4, 1, 3, 1, 1, 1, 1, + 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 0, 0, 7, 0, 5, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 3, + 1, 4, 3, 2, 0, 10, 1, 0, 4, 3, + 4, 1, 2, 0, 5, 0, 7, 0, 6, 0, + 7, 0, 7, 0, 7, 0, 7, 0, 5, 1, + 1, 3, 2, 1, 3, 2, 1, 1, 0, 0, + 6, 1, 2, 0, 2, 0, 2, 3, 0, 1, + 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 2, 1, 1, 3, 2, 2, + 2, 4, 1, 3, 1, 1, 1, 3, 2, 1, 3, 3, 0, 2, 0, 1, 5, 3, 3, 1, 1, 1, 1, 1, 1, 0, 0, 7, 1, 2, - 0, 0, 4, 0, 4, 0, 1, 2, 3, 1, - 1, 1, 2, 1, 4, 4, 1, 1, 4, 0, - 1, 1, 0, 2, 4, 4, 1, 1, 3, 1, - 2, 3, 1, 1, 0, 5, 0, 0, 2, 5, - 3, 3, 1, 6, 4, 4, 2, 2, 2, 0, - 1, 0, 5, 3, 3, 6, 3, 1, 1, 1, - 4, 4, 2, 2, 4, 2, 2, 1, 0, 4, - 3 + 0, 0, 4, 0, 4, 0, 1, 2, 3, 3, + 1, 1, 1, 1, 2, 1, 4, 4, 1, 1, + 4, 0, 1, 1, 0, 2, 4, 4, 1, 1, + 3, 1, 2, 3, 1, 1, 0, 5, 0, 0, + 2, 5, 3, 3, 1, 6, 4, 4, 2, 2, + 2, 1, 2, 1, 0, 5, 3, 3, 6, 3, + 1, 1, 1, 4, 4, 2, 2, 4, 2, 2, + 1, 0, 4, 3, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -1113,1103 +1167,1383 @@ static const yytype_uint8 yyr2[] = static const yytype_uint16 yydefact[] = { 5, 0, 3, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 272, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 296, 0, 301, - 302, 316, 317, 357, 47, 303, 0, 28, 0, 0, - 0, 57, 0, 0, 0, 83, 0, 60, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 90, 95, - 0, 0, 306, 307, 308, 304, 305, 389, 0, 59, - 12, 369, 389, 389, 4, 6, 17, 7, 8, 79, - 80, 0, 0, 331, 350, 0, 319, 274, 0, 330, - 0, 332, 0, 353, 338, 349, 351, 356, 0, 263, - 318, 406, 405, 0, 403, 402, 277, 246, 247, 248, - 249, 0, 270, 269, 268, 267, 266, 265, 264, 286, - 0, 225, 334, 223, 210, 287, 0, 208, 288, 292, - 351, 0, 0, 271, 0, 278, 0, 196, 0, 25, - 197, 0, 0, 0, 37, 0, 39, 0, 81, 41, - 331, 0, 332, 0, 0, 77, 0, 0, 160, 0, - 0, 159, 92, 91, 165, 0, 0, 0, 0, 0, - 202, 377, 0, 0, 10, 0, 0, 0, 93, 88, - 0, 230, 0, 232, 260, 226, 228, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 48, 224, 222, + 0, 0, 0, 0, 0, 288, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 335, 0, 343, + 344, 6, 364, 409, 65, 345, 0, 46, 0, 0, + 0, 74, 0, 0, 0, 0, 296, 0, 0, 77, + 0, 0, 0, 0, 0, 319, 0, 0, 0, 0, + 105, 110, 0, 0, 349, 350, 351, 346, 347, 0, + 0, 352, 348, 0, 0, 76, 29, 421, 338, 0, + 366, 4, 0, 8, 34, 9, 10, 95, 96, 0, + 0, 381, 97, 402, 0, 369, 290, 0, 380, 0, + 382, 0, 405, 0, 388, 401, 403, 408, 0, 279, + 365, 6, 319, 0, 97, 459, 458, 0, 456, 455, + 293, 260, 261, 262, 263, 0, 286, 285, 284, 283, + 282, 281, 280, 0, 0, 320, 0, 239, 384, 0, + 237, 224, 0, 0, 320, 326, 222, 327, 0, 331, + 403, 0, 0, 287, 0, 35, 0, 210, 0, 43, + 211, 0, 0, 0, 55, 0, 57, 0, 0, 0, + 59, 381, 0, 382, 0, 0, 0, 21, 0, 20, + 175, 0, 0, 174, 107, 106, 180, 0, 0, 0, + 0, 0, 216, 429, 443, 0, 354, 0, 0, 0, + 441, 0, 15, 0, 368, 0, 27, 0, 339, 0, + 340, 0, 0, 0, 303, 0, 18, 108, 103, 98, + 0, 0, 244, 0, 246, 274, 240, 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 284, 335, 359, 0, 370, 352, 0, 273, - 0, 0, 299, 289, 352, 297, 0, 0, 151, 0, - 46, 0, 0, 0, 198, 201, 331, 332, 0, 0, - 38, 40, 82, 0, 42, 43, 12, 66, 0, 49, - 0, 161, 332, 0, 44, 0, 0, 45, 0, 74, - 76, 407, 0, 0, 0, 376, 0, 382, 0, 324, - 390, 388, 321, 0, 0, 387, 259, 18, 0, 0, - 276, 320, 0, 86, 96, 410, 348, 346, 0, 0, - 234, 0, 0, 0, 0, 235, 237, 236, 251, 250, - 253, 252, 254, 256, 257, 255, 245, 244, 239, 240, - 238, 241, 242, 243, 258, 0, 204, 221, 220, 219, - 218, 217, 216, 215, 214, 213, 212, 211, 151, 0, - 360, 0, 0, 404, 0, 348, 151, 209, 0, 298, - 19, 0, 0, 150, 331, 332, 195, 0, 0, 31, - 199, 54, 51, 0, 0, 35, 84, 10, 78, 0, - 158, 0, 0, 310, 0, 309, 166, 314, 163, 0, - 0, 408, 400, 401, 9, 0, 373, 0, 372, 386, - 333, 0, 275, 325, 378, 391, 0, 317, 0, 0, - 0, 11, 13, 14, 15, 358, 286, 94, 98, 0, - 0, 280, 282, 347, 231, 233, 0, 227, 229, 0, - 205, 0, 367, 0, 362, 336, 361, 366, 354, 355, - 0, 290, 22, 0, 154, 279, 0, 29, 26, 197, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 162, - 311, 312, 0, 322, 0, 75, 50, 0, 374, 376, - 0, 0, 381, 0, 380, 0, 393, 0, 394, 396, - 0, 0, 0, 97, 100, 168, 151, 151, 261, 206, - 285, 0, 363, 345, 359, 0, 300, 294, 12, 20, - 0, 331, 332, 0, 0, 0, 200, 102, 0, 102, - 104, 112, 0, 12, 110, 58, 118, 118, 36, 147, - 0, 315, 329, 0, 324, 164, 409, 376, 371, 0, - 385, 384, 0, 397, 399, 398, 0, 0, 0, 99, - 168, 0, 179, 0, 0, 0, 299, 368, 343, 340, - 0, 0, 291, 10, 127, 157, 0, 12, 125, 27, - 32, 0, 0, 105, 0, 0, 10, 118, 0, 118, - 0, 148, 149, 0, 137, 0, 61, 0, 313, 325, - 323, 0, 203, 0, 379, 392, 0, 16, 179, 101, - 0, 183, 184, 185, 188, 187, 186, 178, 89, 167, - 169, 0, 177, 181, 0, 281, 283, 262, 207, 151, - 337, 364, 365, 0, 293, 130, 133, 0, 10, 197, - 103, 55, 52, 113, 0, 0, 0, 0, 0, 0, - 114, 0, 147, 0, 139, 0, 328, 327, 375, 383, - 395, 87, 0, 0, 172, 182, 0, 171, 0, 0, - 339, 295, 135, 0, 0, 21, 30, 0, 0, 0, - 0, 111, 0, 116, 0, 123, 124, 121, 115, 12, - 0, 140, 0, 62, 0, 0, 191, 0, 81, 0, - 344, 341, 0, 0, 0, 0, 134, 126, 33, 12, - 108, 56, 53, 117, 119, 12, 10, 0, 143, 0, - 142, 0, 326, 194, 0, 0, 170, 0, 0, 345, - 0, 12, 0, 0, 0, 10, 12, 10, 85, 144, - 0, 141, 0, 192, 189, 173, 193, 342, 0, 10, - 24, 128, 12, 106, 34, 0, 10, 0, 146, 63, - 0, 0, 0, 0, 10, 109, 145, 0, 190, 147, - 131, 129, 0, 12, 0, 12, 107, 10, 0, 10, - 64, 175, 12, 174, 68, 10, 0, 65, 67, 69, - 176, 0, 70, 71, 0, 0, 72, 0, 12, 10, - 73 + 0, 0, 0, 0, 0, 0, 0, 0, 66, 238, + 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 317, 0, 385, 411, 0, 422, 404, + 0, 0, 289, 0, 322, 0, 0, 0, 322, 0, + 341, 0, 328, 404, 336, 0, 0, 0, 64, 0, + 0, 0, 212, 215, 381, 382, 0, 0, 56, 58, + 84, 0, 60, 61, 29, 83, 23, 0, 0, 17, + 0, 176, 382, 0, 62, 0, 0, 63, 0, 92, + 94, 460, 0, 0, 0, 428, 0, 434, 0, 374, + 444, 0, 353, 442, 364, 0, 0, 440, 371, 439, + 367, 5, 12, 13, 307, 273, 36, 0, 0, 292, + 370, 7, 166, 0, 0, 101, 111, 99, 294, 463, + 398, 396, 0, 0, 248, 0, 277, 0, 0, 0, + 249, 251, 250, 265, 264, 267, 266, 268, 270, 271, + 269, 259, 258, 253, 254, 252, 255, 256, 257, 272, + 0, 218, 235, 234, 233, 232, 231, 230, 229, 228, + 227, 226, 225, 166, 464, 399, 0, 412, 0, 0, + 457, 321, 0, 0, 321, 398, 166, 223, 399, 0, + 337, 37, 209, 0, 0, 49, 213, 71, 68, 0, + 0, 53, 0, 0, 0, 0, 0, 0, 356, 0, + 355, 26, 362, 27, 0, 22, 19, 0, 173, 181, + 178, 0, 0, 461, 453, 454, 11, 0, 425, 0, + 424, 438, 383, 0, 291, 375, 430, 0, 446, 0, + 447, 449, 305, 3, 5, 166, 0, 28, 30, 31, + 32, 410, 0, 0, 165, 381, 382, 0, 0, 0, + 323, 109, 113, 0, 0, 0, 162, 309, 311, 397, + 245, 247, 0, 0, 241, 243, 0, 219, 0, 313, + 315, 419, 0, 414, 386, 413, 418, 406, 407, 0, + 329, 40, 0, 47, 44, 211, 0, 0, 0, 0, + 0, 0, 0, 359, 360, 372, 0, 0, 358, 0, + 0, 24, 177, 0, 93, 67, 0, 426, 428, 0, + 0, 433, 0, 432, 450, 452, 451, 0, 0, 166, + 16, 3, 0, 0, 169, 304, 0, 25, 0, 325, + 0, 0, 112, 115, 183, 162, 164, 0, 152, 0, + 163, 166, 166, 278, 275, 220, 318, 166, 166, 0, + 415, 395, 411, 0, 342, 333, 29, 38, 0, 0, + 0, 214, 117, 0, 117, 119, 127, 0, 29, 125, + 75, 133, 133, 54, 379, 0, 374, 357, 363, 0, + 179, 462, 428, 423, 0, 437, 436, 0, 445, 0, + 0, 14, 308, 0, 0, 381, 382, 324, 114, 183, + 0, 193, 0, 297, 162, 0, 154, 0, 0, 0, + 341, 0, 0, 420, 393, 390, 0, 0, 330, 27, + 142, 0, 29, 140, 45, 50, 0, 0, 120, 0, + 0, 27, 133, 0, 133, 0, 0, 361, 375, 373, + 78, 0, 217, 0, 431, 448, 306, 33, 172, 193, + 116, 0, 197, 198, 199, 202, 201, 200, 192, 104, + 182, 184, 0, 191, 195, 0, 0, 0, 0, 0, + 155, 0, 310, 312, 276, 221, 314, 316, 166, 387, + 416, 417, 0, 332, 145, 148, 0, 27, 211, 118, + 72, 69, 128, 0, 0, 0, 0, 0, 0, 129, + 378, 377, 0, 427, 435, 102, 0, 0, 97, 196, + 0, 186, 29, 0, 29, 0, 158, 0, 157, 0, + 0, 389, 334, 150, 0, 0, 39, 48, 0, 0, + 0, 0, 126, 0, 131, 0, 138, 139, 136, 130, + 0, 79, 0, 205, 0, 0, 0, 27, 0, 301, + 0, 27, 159, 0, 156, 394, 391, 0, 0, 0, + 0, 149, 141, 51, 29, 123, 73, 70, 132, 134, + 29, 376, 0, 208, 0, 0, 185, 187, 0, 100, + 302, 0, 298, 295, 0, 161, 395, 0, 29, 0, + 0, 0, 27, 29, 27, 0, 206, 203, 0, 207, + 0, 299, 160, 392, 0, 27, 42, 143, 29, 121, + 52, 0, 27, 80, 0, 162, 300, 0, 0, 27, + 124, 0, 204, 0, 146, 144, 0, 29, 0, 29, + 122, 27, 189, 29, 188, 27, 81, 27, 86, 190, + 0, 82, 85, 87, 0, 88, 89, 0, 0, 90, + 0, 29, 27, 91 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 2, 4, 74, 174, 288, 401, 680, 76, - 433, 544, 488, 605, 242, 494, 138, 493, 439, 609, - 704, 446, 442, 650, 441, 649, 142, 153, 625, 691, - 737, 754, 757, 758, 759, 764, 767, 268, 269, 157, - 77, 78, 253, 79, 148, 447, 80, 408, 294, 81, - 293, 82, 410, 472, 473, 552, 499, 724, 681, 505, - 364, 508, 558, 706, 685, 657, 549, 606, 733, 642, - 745, 645, 674, 563, 564, 565, 352, 353, 160, 161, - 165, 532, 589, 633, 668, 731, 753, 590, 591, 592, - 593, 667, 594, 136, 243, 244, 440, 83, 275, 536, - 232, 303, 304, 299, 301, 302, 535, 111, 84, 238, - 476, 477, 338, 85, 127, 128, 348, 487, 542, 604, - 133, 347, 86, 376, 377, 87, 513, 394, 514, 88, - 89, 389, 90, 91, 339, 483, 600, 640, 699, 539, - 599, 92, 93, 94, 95, 96, 97, 341, 425, 482, - 426, 427, 98, 387, 388, 517, 278, 279, 172, 285, - 465, 526, 99, 272, 457, 100 + -1, 1, 2, 4, 80, 81, 474, 341, 178, 179, + 82, 206, 347, 477, 805, 84, 522, 660, 596, 724, + 290, 599, 158, 598, 525, 728, 831, 532, 528, 771, + 527, 770, 162, 174, 742, 812, 861, 878, 881, 882, + 883, 887, 890, 318, 319, 85, 86, 220, 87, 495, + 88, 492, 356, 89, 355, 90, 494, 571, 572, 667, + 604, 850, 806, 610, 430, 613, 673, 833, 810, 778, + 664, 725, 858, 763, 869, 766, 799, 577, 578, 579, + 483, 484, 182, 183, 187, 641, 700, 747, 838, 874, + 701, 702, 703, 704, 784, 705, 156, 291, 292, 526, + 91, 325, 650, 280, 368, 369, 363, 365, 367, 649, + 502, 125, 496, 114, 708, 790, 93, 352, 559, 475, + 581, 582, 587, 588, 403, 94, 580, 146, 147, 419, + 595, 658, 723, 153, 209, 417, 95, 441, 442, 96, + 615, 466, 616, 172, 98, 461, 99, 100, 406, 591, + 719, 761, 826, 655, 718, 101, 102, 103, 104, 105, + 106, 107, 408, 514, 590, 515, 516, 108, 459, 460, + 622, 328, 329, 199, 200, 467, 557, 109, 322, 546, + 110 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -433 +#define YYPACT_NINF -563 static const yytype_int16 yypact[] = { - -433, 70, 83, -433, 789, 2849, 2849, -74, 2849, 2849, - 2849, 2849, 2849, 2849, 2849, -433, 2849, 2849, 2849, 2849, - 2849, 2849, 2849, 29, 29, 2849, 41, -55, -29, -433, - -433, -31, -433, -433, -433, -433, 2849, -433, -25, -20, - 45, -433, 49, 1671, 1797, -433, 1923, -433, 2849, -30, - 15, -27, 54, 107, 62, 102, 104, 106, -433, -433, - 111, 119, -433, -433, -433, -433, -433, -433, 2849, -433, - -433, 53, -433, -433, -433, -433, -433, -433, -433, -433, - -433, 200, 203, -433, -433, 138, -433, -433, 3166, -433, - 46, 1058, 152, -433, 178, -433, 25, -433, 22, -433, - -433, 3838, 3838, 2849, 3838, 3838, 2102, -433, -433, 254, - -433, 2849, -433, -433, -433, -433, -433, -433, -433, 165, - 177, -433, -433, -433, -433, 188, 201, -433, -433, 211, - -50, 22, 2049, -433, 2849, -433, 5, 3838, 1545, -433, - 2849, 2849, 202, 2849, -433, 3208, -433, 3249, 324, -433, - 215, 3838, 58, 217, 3290, -433, 279, 219, -433, -6, - 7, -433, -433, -433, 346, 9, 29, 29, 29, 222, - -433, 2149, 172, 3331, 223, 2849, 197, -34, 247, -433, - 117, -433, 2849, -433, -433, -433, -433, 2849, 2849, 2849, - 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, - 2849, 2849, 2849, 2849, 2849, 2849, 41, -433, -433, -433, - 2249, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, - 2849, 2849, -433, -433, 2849, 2849, 53, 26, 3372, -433, - 121, 56, 226, -433, -50, -433, 3413, 3454, 2349, 2849, - -433, 286, 2849, 240, 375, 3838, 294, 932, 314, 3495, - -433, -433, -433, 316, -433, -433, -433, -433, 250, -433, - 2849, -433, -433, 15, -433, 628, 315, -433, 0, -433, - -433, -433, 34, 251, 261, -15, 29, 3700, 253, 381, - -51, -433, -433, 2949, 29, -433, -433, -433, 915, 779, - -433, -433, 322, -433, 287, 266, 268, -50, 22, 2849, - 3915, 2849, 2849, 2849, 2849, 1537, 1662, 1787, 1913, 1913, - 1913, 1913, 1158, 1158, 1158, 1158, 355, 355, 248, 248, - 248, 254, 254, 254, -433, -10, 2102, 2102, 2102, 2102, - 2102, 2102, 2102, 2102, 2102, 2102, 2102, 2102, 2349, 50, - 3838, 262, 1727, -433, 266, -433, 2349, -433, 50, -433, - 385, 29, 272, 406, 35, 356, 3838, 277, 3536, -433, - -433, -433, -433, 407, 37, -433, -433, 278, -433, 1853, - -433, 628, 628, 284, 285, -433, -433, -433, 413, 29, - 291, -433, -433, -433, -433, 289, -433, 38, -433, -433, - -433, 2449, -433, 2549, -433, -433, 357, 369, 1979, 297, - 305, -433, -433, -433, -433, -433, -433, -433, 327, 322, - 310, -433, -433, -50, 3878, 2102, 3797, 2301, 2400, 41, - -433, 313, -433, 2849, -433, -433, -21, -433, -433, -433, - 317, -433, -433, 1545, -433, -433, 2649, -433, -433, 2849, - 2849, 29, 19, 628, 386, 1041, -12, 319, 361, -433, - -433, -433, 393, 628, 628, -433, -433, 29, -433, -15, - 452, 29, 3838, 29, 3741, 194, -433, 2849, -433, -433, - 325, 322, 326, 460, -433, -433, 2349, 2349, -433, -433, - -433, 3005, -433, 330, 2849, 2849, -433, -433, -433, -433, - 29, 40, 636, 2849, 1167, 329, 3838, 351, 29, 351, - -433, -433, 461, -433, -433, -433, 331, 334, -433, 30, - 339, -433, 360, 341, 476, -433, -433, -15, -433, 2849, - -433, -433, 2749, -433, -433, -433, 337, 545, 345, 460, - -433, 322, 604, 347, 348, 2849, 226, -433, -433, -433, - 342, 3072, 371, 31, -433, -433, 3577, -433, -433, -433, - -433, 19, 354, -433, 358, 628, 409, -433, 252, -433, - 170, -433, -433, 362, 496, 65, -433, 628, -433, 628, - -433, 43, 2102, 29, 3838, -433, 366, -433, 832, -433, - 434, -433, -433, -433, -433, -433, -433, -433, -433, -433, - -433, 414, 216, -433, 10, -433, -433, 2202, -433, 2349, - 392, -433, -433, 50, -433, -433, 190, 364, 430, 2849, - -433, -433, -433, -433, 372, 259, 374, 2849, -17, 192, - -433, 376, 23, 444, 505, 322, -433, 399, -433, -433, - -433, -433, 509, 451, -433, -433, 456, -433, 388, 50, - -433, -433, 221, 390, 1545, -433, -433, 389, 391, 1293, - 1293, -433, 394, -433, 3125, -433, -433, -433, -433, -433, - 85, 521, 628, -433, 628, 628, 524, 12, 324, 526, - -433, -433, 400, 515, 474, 2849, -433, -433, -433, -433, - -433, -433, -433, -433, -433, -433, 404, 470, 536, 628, - -433, 479, -433, -433, 628, 484, -433, 489, 628, 330, - 2849, -433, 419, 3618, 1419, 475, -433, 186, -433, 550, - 628, -433, 423, -433, 552, -433, -433, -433, 3659, 498, - -433, -433, -433, -433, -433, 426, 189, 628, -433, -433, - 628, 431, 567, 1545, 510, -433, -433, 454, -433, 30, - -433, -433, 457, -433, 462, -433, -433, 463, 158, 66, - -433, -433, -433, -433, 497, 465, 464, -433, 497, -433, - -433, 322, -433, -433, 528, 469, -433, 468, -433, 472, - -433 + -563, 73, 85, -563, 1470, 3756, 3756, -99, 3756, 3756, + 3756, 3756, 3756, 3756, 3756, -563, 3756, 3756, 3756, 3756, + 3756, 3756, 3756, 172, 172, 3756, 195, -91, -83, -563, + -563, 44, -563, -563, -563, -563, 3756, -563, -55, 49, + 60, -563, 74, 2359, 2486, 36, -563, 109, 2613, -563, + 3756, 7, -36, 40, 90, 116, 76, 92, 99, 101, + -563, -563, 144, 164, -563, -563, -563, -563, -563, 187, + -10, -563, -563, 154, 3756, -563, -563, 87, 262, 268, + -81, -563, 9, -563, -563, -563, -563, -563, -563, 220, + 259, -563, 274, -563, 197, -563, -563, 4304, -563, 240, + 1178, 203, -563, 212, 239, -563, -12, -563, 52, -563, + -563, -563, -563, 222, 274, 4976, 4976, 3756, 4976, 4976, + 5076, -563, -563, 321, -563, 3756, -563, -563, -563, -563, + -563, -563, -563, 230, 154, 198, 273, -563, -563, 279, + -563, -563, 264, 154, 319, 295, -563, -563, 325, 296, + -35, 52, 2740, -563, 3756, -563, 12, 4976, 2232, -563, + 3756, 3756, 324, 3756, -563, 4345, -563, 4386, 327, 458, + -563, 328, 4976, 479, 329, 4427, 154, 54, 14, -563, + -563, 138, 15, -563, -563, -563, 459, 16, 172, 172, + 172, 332, -563, 2867, 127, 180, -563, 3883, 172, 234, + -563, 154, -563, 243, -63, 4468, 330, 3756, 190, 333, + 277, 190, 156, 409, -563, 410, -563, 366, -563, -563, + -29, 35, -563, 3756, -563, 460, -563, -563, 3756, 3756, + 3756, 3756, 3756, 3756, 3756, 3756, 3756, 3756, 3756, 3756, + 3756, 3756, 3756, 3756, 3756, 3756, 3756, 195, -563, -563, + -563, 2994, 3756, 3756, 3756, 3756, 3756, 3756, 3756, 3756, + 3756, 3756, 3756, -563, 46, -563, 3756, 3756, 87, -30, + 346, 4509, -563, 154, 252, 58, 111, 154, 319, 53, + 362, 53, -563, -16, -563, 4550, 4591, 3756, -563, 426, + 3756, 364, 501, 4976, 423, 1091, 446, 4632, -563, -563, + -563, 926, -563, -563, -563, -563, 62, 448, 7, -563, + 3756, -563, -563, -36, -563, 926, 449, -563, 8, -563, + -563, -563, 24, 380, 383, 72, 172, 4837, 385, 524, + -563, 463, -563, -563, 474, 411, 387, -563, -563, -563, + 70, -563, -563, -563, -563, -563, -563, 1597, 4052, -563, + -563, -563, 3121, 529, 5, -563, 429, -563, -563, 417, + 418, -16, 52, 3756, 5053, 3756, -563, 3756, 3756, 3756, + 2409, 2536, 2661, 2788, 2788, 2788, 2788, 1313, 1313, 1313, + 1313, 512, 512, 339, 339, 339, 321, 321, 321, -563, + -20, 5076, 5076, 5076, 5076, 5076, 5076, 5076, 5076, 5076, + 5076, 5076, 5076, 3121, 420, 421, -13, 4976, 414, 4093, + -563, 282, 417, 420, 319, -563, 3121, -563, -563, -13, + -563, 544, 4976, 427, 4673, -563, -563, -563, -563, 558, + 26, -563, 926, 926, 428, -45, 432, 154, -88, 439, + -563, -563, -563, 433, 510, -563, -563, 4138, -563, -563, + 570, 172, 447, -563, -563, -563, -563, 440, -563, 27, + -563, -563, -563, 3248, -563, 3375, -563, 168, -563, 3756, + -563, -563, -563, 451, -563, 3121, 450, -563, -563, -563, + -563, -563, 172, 452, 588, 28, 80, 926, 462, 154, + 319, -563, 482, 5, 456, 465, 210, -563, -563, -16, + 5016, 5076, 3756, 4935, 5098, 5119, 195, -563, 461, -563, + -563, -563, 3756, -563, -563, -6, -563, -563, -563, 466, + -563, -563, 2232, -563, -563, 3756, 3756, 172, 160, 926, + 537, 1724, -1, -563, -563, 926, 478, 154, -69, 545, + 516, -563, -563, 926, -563, -563, 172, -563, 72, 606, + 172, 4976, 172, 4878, -563, -563, -563, 470, 4011, 3121, + -563, 475, 483, 484, -563, -563, 3502, -563, 154, 319, + 5, 477, 620, -563, -563, 210, -563, 485, 627, 13, + -563, 3121, 3121, 1283, -563, -563, -563, 3121, 3121, 4179, + -563, 492, 3756, 3756, -563, -563, -563, -563, 3756, 1851, + 493, 4976, 519, 172, 519, -563, -563, 629, -563, -563, + -563, 497, 498, -563, 526, 500, 641, -61, -563, 505, + -563, -563, 72, -563, 3756, -563, -563, 3629, -563, 502, + 506, -563, -563, 509, 172, 30, 913, 319, 620, -563, + 5, 615, 511, 555, 146, 599, 668, 538, 539, 3756, + 362, 540, 541, -563, -563, -563, 530, 4220, 569, 291, + -563, 4714, -563, -563, -563, -563, 160, 546, -563, 549, + 926, 602, -563, 300, -563, 107, 926, -563, 926, -563, + -563, 31, 5076, 172, 4976, -563, -563, -563, -563, 669, + -563, 625, -563, -563, -563, -563, -563, -563, -563, -563, + -563, -563, 601, 480, -563, 21, 556, 552, 561, 159, + 690, 926, -563, -563, 1283, -563, -563, -563, 3121, 585, + -563, -563, -13, -563, -563, 363, 565, 630, 3756, -563, + -563, -563, -563, 568, 311, 571, 3756, 1, 227, -563, + -563, 594, 5, -563, -563, -563, 704, 655, 274, -563, + 658, -563, -563, 207, -563, 660, 717, 926, -563, 589, + -13, -563, -563, 365, 592, 2232, -563, -563, 591, 596, + 1978, 1978, -563, 597, -563, 4263, -563, -563, -563, -563, + 926, -563, 926, 732, 22, 675, 734, 604, 677, -563, + 33, 605, 735, 926, -563, -563, -563, 610, 725, 688, + 3756, -563, -563, -563, -563, -563, -563, -563, -563, -563, + -563, -563, 685, -563, 926, 687, -563, -563, 926, -563, + -563, 238, -563, -563, 926, -563, 492, 3756, -563, 614, + 4755, 2105, 676, -563, -27, 616, -563, 753, 626, -563, + 699, -563, -563, -563, 4796, 705, -563, -563, -563, -563, + -563, 636, 269, -563, 926, 210, -563, 758, 2232, 700, + -563, 638, -563, 642, -563, -563, 640, -563, 286, -563, + -563, 643, -563, -563, -563, 357, -563, 644, 692, -563, + 645, -563, 692, -563, 5, -563, -563, 716, 650, -563, + 649, -563, 651, -563 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -433, -433, -433, -433, -433, -199, -433, -433, 2, -433, - -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, - -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, - -433, -433, -433, -433, -153, -433, -433, -433, 227, -433, - 332, 335, -56, -433, -433, -433, -433, -433, -433, -433, - -433, -433, -433, -433, 142, 115, 67, -433, -33, -433, - -433, -433, -310, -433, -433, -35, -433, -433, -433, -433, - -433, -433, -433, -117, -433, 4, -315, -433, -433, 365, - -433, 94, -433, -433, -433, -433, -433, -433, -433, -433, - 39, -433, -433, -433, -432, -433, -433, 1, -433, -433, - -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, - -433, -433, -433, -23, -194, -433, -433, -433, -433, -433, - -433, 99, -22, 72, -433, -433, -433, 116, -433, 16, - 477, -335, 288, 283, -433, -433, -433, -433, -433, -62, - -433, -176, -433, -433, -24, -7, -433, 154, -343, -433, - -433, -433, 42, 130, 204, -433, -433, -433, 265, -433, - -433, -433, -433, -433, -433, -433 + -563, -563, -293, -563, -23, -563, -563, -563, -563, 491, + -563, -264, -563, -563, 2, -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, + -80, -563, -563, -563, 352, 457, 467, -109, -563, -563, + -563, -563, -563, -563, -563, -563, -563, -563, 235, 202, + 142, -563, 39, -563, -563, -563, -376, -563, -563, 37, + -563, -563, -563, -563, -563, -563, -563, -562, -563, 175, + -395, -563, -563, 503, -563, 183, -563, -563, -563, -563, + -563, -563, -563, 120, -563, -563, -563, -510, -563, -563, + -38, -563, -563, -563, -563, -563, -563, -563, -563, -563, + -563, -563, -563, 0, -563, -563, -563, -563, -563, -563, + -563, -563, -563, -563, -563, 551, -343, -229, -563, -563, + -563, -563, -563, -563, -563, 174, -160, 278, -563, -563, + -563, 209, -563, 657, 646, -463, 438, 820, -563, -563, + -563, -563, -563, 3, -563, -207, -563, 86, -563, -19, + -24, -563, 236, -407, -563, -563, -563, -17, 204, 287, + -563, -563, -563, 389, 169, -563, -563, -563, -563, -563, + -563 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -348 +#define YYTABLE_NINF -401 static const yytype_int16 yytable[] = { - 120, 120, 129, 126, 296, 431, 75, 495, 379, 655, - 395, 224, 324, 239, 506, 263, 434, 266, 636, 130, - 695, 101, 102, 421, 104, 105, 106, 107, 108, 109, - 110, 430, 112, 113, 114, 115, 116, 117, 118, 280, - 484, 124, 381, -152, 281, 444, 459, 150, -155, 155, - 498, 459, 137, 419, 296, 345, 119, 367, 33, 145, - 147, 119, 151, 33, 154, 119, 103, 33, 131, 396, - 3, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, -2, 173, 132, 224, 224, 158, 162, - 119, 227, 33, 225, 561, 33, 623, -23, -23, -23, - 119, 561, 33, 283, 284, 208, 209, 385, -286, 135, - 156, 134, 125, 291, 33, 139, 687, -334, -334, 228, - 140, 422, 485, 33, 234, 656, 520, 229, 521, 33, - 71, 507, -132, -132, -132, 71, 120, 260, 624, 71, - 241, 380, 246, 120, 120, 120, 562, 240, 236, 264, - 237, 267, 637, 562, 696, 545, 245, 151, 688, 249, - 159, 533, 534, 424, 71, -346, -347, 226, 225, 225, - 163, -138, 424, 297, 71, 382, -152, 648, 445, 460, - 164, -155, 129, 126, 628, 141, 71, 277, 295, 143, - 33, 289, 344, 423, 33, 71, 175, 560, 300, 130, - 255, 71, 166, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 298, 297, 297, 479, 326, 327, 328, 329, - 330, 331, 332, 333, 334, 335, 336, 337, 629, 354, - 340, 342, 167, 375, 168, 280, 169, 615, 131, 619, - 281, 170, 120, 120, 151, 356, 643, 644, 358, 171, - 641, 120, 71, 617, 618, 523, 71, 524, 525, 407, - 280, 178, 298, 298, 179, 281, 369, 180, -122, -122, - -122, -120, -120, -120, 638, 617, 618, 672, 673, 543, - 402, 413, 222, 203, 204, 205, 671, 206, 223, 398, - 751, 752, 120, 206, 556, 135, 122, 122, 282, 283, - 284, 121, 123, -180, 620, 414, 230, 415, 416, 417, - 418, 581, 582, 583, 584, 585, 586, -286, 120, 152, - -122, 233, 297, -120, 283, 284, 658, 176, 177, 354, - 231, 297, 248, 290, 616, 617, 618, 354, 608, 375, - 375, 652, 617, 618, 151, 252, 120, 254, 258, 265, - 256, 259, 151, 274, -153, 292, 346, 287, 357, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 298, 359, 360, 361, 363, 474, 366, 378, 393, - 298, 368, 383, 406, 392, 129, 126, 200, 201, 202, - 203, 204, 205, 384, 206, 409, 411, 462, 412, 464, - 428, 432, 130, 435, 436, -334, -334, 437, 120, 120, - 443, 375, 448, 452, 247, 453, 454, 424, 466, 458, - 467, 375, 375, 456, 120, 489, 120, 491, 120, 481, - 120, 469, 262, 450, 451, 470, 471, 504, 474, 270, - 271, 273, 151, 475, 480, 245, 496, 502, 486, 509, - 686, 131, 510, 424, 511, 519, 528, 120, 531, 530, - 538, 550, 551, 557, 555, 120, 559, 354, 354, 566, - 705, 567, 568, 527, 569, 575, 707, 577, 595, 596, - 601, 603, 151, 151, 120, 611, 548, -153, 614, 612, - 340, 541, 719, 621, 622, 632, 646, 726, 579, 546, - 630, 634, 639, 647, 651, 501, 653, 661, 662, 659, - 664, 355, 665, 734, 666, 512, 515, 669, 120, 670, - 675, 677, 678, 375, 689, 572, 683, 694, 574, 698, - 700, 701, 702, 709, 747, 375, 749, 375, 708, 710, - 120, 597, 712, 755, 181, 182, 183, 714, 386, 390, - 715, 720, 725, 727, 729, 730, -136, 399, 735, 769, - 184, 739, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 740, 206, 742, 297, 743, 756, 746, - 354, 765, 663, 748, 761, 762, 455, 750, 420, 760, - 766, 768, 697, 529, 554, 151, 770, 682, 610, 684, - 403, 355, 744, 404, 578, 245, 660, 613, 370, 355, - 570, 635, 297, 654, 390, 598, 261, 717, 540, 626, - 375, 627, 375, 375, -156, 298, 676, 571, 0, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 0, 270, 518, 0, 0, 0, 375, 0, 0, - 371, 372, 375, 0, 0, 0, 375, 0, 0, 0, - 0, 298, 0, 0, 0, 0, 0, 0, 375, 0, - 0, 703, 0, 576, 0, -334, -334, 29, 30, 373, - 0, 0, 580, 0, 0, 375, 723, 35, 375, 581, - 582, 583, 584, 585, 586, 587, 718, 0, 0, 492, - 0, 0, 0, 0, 497, 500, 0, 0, 0, 0, - 0, 0, 0, 0, 690, 741, 692, 693, 763, 0, - 516, 0, 386, 0, 390, 0, 390, 0, 588, 0, - 0, 374, 62, 63, 64, 65, 66, 0, 0, 355, - 355, 711, 0, 0, 0, 0, 713, 0, 0, 0, - 716, 0, 0, 390, 0, 0, 0, -156, 0, 0, - 0, 553, 728, 0, 0, 0, 0, 0, 181, 182, - 183, 0, 5, 6, 7, 8, 9, 0, 0, 736, - 386, 10, 738, 0, 184, 0, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 0, 206, 0, - 0, 11, 12, 0, 500, 0, 0, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 28, 0, 390, 0, 29, 30, - 31, 32, 33, 0, 34, 0, 0, 0, 35, 36, - 37, 38, 0, 39, 0, 40, 0, 41, 0, 0, - 42, 0, 355, 0, 43, 44, 45, 0, 46, 47, - 0, 48, 49, 50, 0, 0, 0, 51, 52, 53, - 0, 54, 55, 56, 57, 58, 59, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 5, 6, - 7, 8, 9, 405, 67, 0, 0, 10, 0, 68, - 580, 69, 70, 0, 71, 72, 73, 581, 582, 583, - 584, 585, 586, 587, 0, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 11, 12, 0, - 0, 0, 0, 13, 0, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 631, 25, 26, 27, - 28, 0, 0, 0, 29, 30, 31, 32, 33, 0, - 34, -334, -334, 0, 35, 36, 37, 38, 0, 39, - 0, 40, 0, 41, 0, 0, 42, 0, 0, 0, - 43, 44, 45, 0, 46, 47, 0, 48, 49, 50, - 0, 0, 362, 51, 52, 53, 0, 54, 55, 56, - 400, 58, 59, 0, 0, 0, 0, 60, 61, 62, - 63, 64, 65, 66, 5, 6, 7, 8, 9, 0, - 67, 0, 0, 10, 0, 68, 0, 69, 70, 0, - 71, 72, 73, 0, 0, 0, 0, 503, 0, 0, - 0, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 11, 12, 0, 0, 0, 0, 13, - 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 0, 25, 26, 27, 28, 0, 0, 0, - 29, 30, 31, 32, 33, 0, 34, -334, -334, 0, - 35, 36, 37, 38, 0, 39, 0, 40, 0, 41, - 0, 0, 42, 0, 0, 0, 43, 44, 0, 0, - 46, 47, 0, 48, 49, 50, 0, 0, 0, 0, - 0, 53, 0, 54, 55, 56, 0, 0, 0, 0, - 0, 0, 0, 60, 61, 62, 63, 64, 65, 66, - 5, 6, 7, 8, 9, 0, 67, 0, 0, 10, - 0, 68, 0, 69, 70, 0, 71, 72, 73, 0, - 0, 0, 0, 547, -348, -348, -348, -348, 198, 199, - 200, 201, 202, 203, 204, 205, 0, 206, 0, 11, + 135, 135, 150, 144, 92, 270, 83, 149, 508, 151, + 171, 491, 520, 642, 360, 600, 451, 215, 389, 564, + 287, 519, 308, 313, 316, 611, 266, 776, 177, 750, + 815, 266, 453, 536, 530, 548, -167, 180, -170, 548, + 443, 821, 357, 506, 645, 266, 117, 203, 473, 266, + 204, 111, -320, 33, 152, 592, 213, 405, 511, -320, + 33, 111, 154, 213, 214, -137, -137, -137, 360, 405, + 155, -322, 415, 3, 418, 213, 111, -322, 111, -321, + 562, 213, 344, 213, 269, -2, 646, 625, -168, 626, + 159, 112, 196, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, -400, 359, 168, 33, 139, + 139, 274, 148, 267, 181, -397, 358, 404, 267, 33, + 278, 133, -137, 294, 134, 33, 33, 283, -400, 412, + 77, 33, 267, -396, 201, 512, 267, 77, 202, -384, + -384, 440, 593, 111, 307, 33, 488, 612, 777, 489, + 573, 176, 444, 306, 452, 440, 216, 184, 135, 288, + 289, 309, 314, 317, 630, 135, 135, 135, 751, 816, + 454, 688, 531, 549, -167, 135, -170, 743, 340, 822, + 169, 561, 413, 112, 33, 77, 647, 648, 330, 186, + 755, 603, 651, 652, 160, 457, 77, 361, 213, 513, + 736, 737, 268, 77, 362, 161, 213, 185, 77, 111, + -321, 33, 513, 133, 213, 472, 134, 111, 769, 163, + 744, 188, 77, 150, 144, 111, -168, 573, 149, 194, + 151, 111, 756, 33, 337, 207, 675, 189, 788, 554, + 361, 555, 556, 111, 190, 33, 191, 362, 331, 112, + 411, 361, 361, 194, 414, 361, 739, 361, 362, 362, + 194, 77, 362, 194, 362, 195, 111, 139, 33, 840, + 576, 112, 440, 440, 139, 139, 139, 585, 438, 133, + 789, 111, 134, 112, 139, 177, 310, 488, 77, 192, + 489, 217, 438, 863, 197, 198, 734, 690, 738, 249, + 250, 133, 135, 135, 134, 219, 112, 194, 350, 193, + 77, 841, 337, 133, 485, 762, 134, 332, 197, 198, + 736, 737, 77, 759, 196, 197, 198, 440, 197, 198, + 218, 490, 659, 148, 576, 194, 142, 221, 499, 143, + 208, 194, 213, 214, 671, 77, 211, 92, 263, 478, + 194, 488, 264, 796, 489, 337, -153, -41, -41, -41, + 265, -135, -135, -135, 333, 485, 201, 135, 339, 440, + 247, 338, 197, 198, 273, 440, 779, 333, 485, 339, + 333, 339, 361, 440, 244, 245, 246, 213, 247, 362, + 342, 343, 735, 736, 737, 361, 213, 344, 727, 781, + 197, 198, 362, 773, 736, 737, 197, 198, 277, 438, + 438, 139, 139, 275, 538, 197, 198, 282, -135, 276, + 222, 223, 224, -147, -147, -147, 213, 472, 135, 764, + 765, 797, 798, 872, 873, 279, 225, 485, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 135, + 247, 137, 140, 213, 438, 281, 569, 210, 212, 296, + 490, 301, 315, 490, 300, 302, 139, 304, 324, 346, + 351, 353, 150, 144, 349, 354, 366, 149, 787, 151, + 791, 358, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 135, 135, 438, 416, 423, 426, + 440, 425, 438, 427, 617, 513, 440, 429, 440, 445, + 438, 485, 450, 135, 597, 135, 455, 135, 635, 135, + 456, 464, 465, 609, 468, 469, 471, 139, -384, -384, + 832, 886, 487, 485, 485, 637, 834, 490, 493, 485, + 485, 440, 490, 513, 241, 242, 243, 244, 245, 246, + 470, 247, 497, 498, 845, 509, 510, 517, 139, 852, + 521, 529, 523, 535, 136, 136, 537, 145, -194, 539, + 135, 541, 540, 543, 859, 547, 692, 693, 694, 695, + 696, 697, 148, 449, 545, 563, 566, 440, 565, 135, + 560, 663, 570, 871, 574, 875, 568, 586, 607, 877, + 575, 135, 594, 139, 139, 332, 618, 490, 619, 624, + 440, 490, 440, 628, 631, 639, 303, 892, 640, 632, + 633, 643, 139, 440, 139, 644, 139, 654, 139, 785, + 665, 666, 670, 135, 672, 674, 677, 438, 676, 678, + 680, 685, 686, 438, 440, 438, 687, 706, 440, 707, + 135, 97, 115, 116, 440, 118, 119, 120, 121, 122, + 123, 124, 710, 126, 127, 128, 129, 130, 131, 132, + 485, 711, 141, 720, 712, 713, 716, 717, 438, 139, + 722, 733, 730, 157, 440, 731, 746, 753, 361, 46, + 165, 167, 748, 757, 752, 362, 760, 175, 139, 754, + 533, 534, 767, 768, 691, 772, 780, 782, 774, 490, + 139, 692, 693, 694, 695, 696, 697, 698, 783, 786, + 793, 205, 136, 792, 438, 795, 361, 800, 802, 136, + 136, 136, 803, 362, 808, 814, 817, 818, 824, 136, + 820, 828, 139, 819, 823, 827, 829, 438, 835, 438, + 837, 846, 853, 851, 699, 567, 854, 801, 691, 139, + 438, 855, 856, -151, 271, 692, 693, 694, 695, 696, + 697, 698, 272, 860, 864, 866, 867, 870, 868, 888, + 884, 438, 876, 879, 880, 438, 889, 891, 145, 446, + 893, 438, 885, 544, 479, 638, 669, 606, 729, 285, + 807, 286, 809, 614, 480, 97, 448, 293, 745, 709, + 297, 620, 689, 749, 715, 679, 681, 311, 656, 843, + 0, 438, 490, 849, 0, 623, 0, 0, 0, 0, + 0, 0, 0, 138, 138, 0, 0, 0, 0, 0, + 327, 0, 439, 0, 335, 0, 0, 0, 0, 0, + 865, 490, 0, 0, 348, 0, 439, 0, 173, 0, + 0, 0, 0, 0, 0, 0, 136, 136, 0, 0, + 364, 0, 0, 0, 0, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 0, 0, 0, 0, 391, 392, + 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, + 0, -171, 0, 407, 409, 0, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 0, 0, + 0, 136, 0, 0, 422, 0, 0, 424, 732, 0, + 0, 0, 0, 0, 740, 0, 741, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 447, 432, 433, + 0, 0, -384, -384, 0, 0, 0, 0, 0, 0, + 0, 295, 0, 439, 439, 0, 0, 0, 0, 758, + 0, 0, 0, 0, 0, 29, 30, 111, 0, 0, + 0, 312, 136, 0, 97, 35, 0, 0, 320, 321, + 323, 0, 0, 0, 0, 0, 0, 0, 336, 0, + 500, 0, 501, 0, 503, 504, 505, 0, 0, 0, + 0, 0, 0, 136, 0, 794, 0, 112, 439, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 434, 64, 65, 66, 67, 68, 0, 145, 811, -171, + 813, 0, 435, 0, 0, 0, 0, 436, 71, 72, + 437, 825, 0, 0, 0, 0, 0, 0, 136, 136, + 439, 0, 0, 0, 0, 0, 439, 0, 0, 0, + 0, 0, 836, 0, 439, 0, 839, 136, 0, 136, + 0, 136, 842, 136, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 0, 0, 0, 0, + 551, 0, 553, 0, 0, 0, 558, 0, 0, 0, + 0, 0, 862, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 458, 462, 0, 0, 0, + -384, -384, 0, 0, 136, 0, 0, 0, 0, 583, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 589, + 0, 0, 486, 136, 0, 0, 0, 0, 0, 97, + 0, 428, 293, 601, 0, 136, 0, 0, 97, 0, + 0, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 0, 0, 0, 0, 0, 0, 0, + 507, 0, 0, 0, 0, 0, 0, 136, 0, 0, + 0, 439, 0, 486, 0, 0, 0, 439, 0, 439, + 0, 0, 0, 0, 136, 0, 486, -384, -384, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 407, + 657, 0, 0, 0, 0, 661, 97, 0, 0, 0, + 0, 0, 439, 0, 0, 0, 0, 0, 0, 0, + 0, 320, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 682, 0, 0, 684, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 486, 0, 0, 0, 0, + 0, 0, 462, 0, 0, 0, 714, 0, 439, 0, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 439, 247, 439, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 439, 0, 0, 602, 605, -401, + -401, -401, -401, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 0, 439, 621, 0, 458, 439, + 462, 0, 462, 0, 0, 439, 0, 0, 0, 486, + 0, 0, 0, 0, 0, 293, 636, 0, 0, 0, + 0, 0, 0, 775, 0, 0, 0, 0, 0, 0, + 0, 486, 486, 0, 0, 439, 0, 486, 486, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 97, 668, 0, 0, 0, 97, 97, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 458, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 462, 0, 0, 830, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 6, 7, 8, 9, 0, 0, + 0, 0, 10, 0, 844, 0, 605, 0, 97, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 462, 0, 0, 0, 0, 0, 0, + 0, 0, 11, 12, 0, 97, 0, 0, 13, 0, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 0, 25, 26, 27, 28, 0, 0, 486, 29, + 30, 31, 32, 33, 0, 34, 0, 0, 0, 35, + 36, 37, 38, 0, 39, 0, 40, 0, 41, 0, + 0, 42, 0, 0, 0, 43, 44, 45, 46, 47, + 48, 49, 0, 50, 51, 52, 0, 0, 0, 53, + 54, 55, 0, 56, 57, 58, 59, 60, 61, 0, + 0, 0, 0, 62, 63, 64, 65, 66, 67, 68, + 5, 6, 7, 8, 9, 0, 69, 0, 0, 10, + 0, 70, 71, 72, 73, 74, 0, 75, 76, 0, + 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 0, 0, 0, 0, 13, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 25, 26, 27, 28, 0, 0, 0, 29, 30, 31, 32, 33, 0, 34, 0, 0, 0, 35, 36, 37, 38, 0, 39, 0, 40, 0, 41, 0, 0, 42, 0, - 0, 0, 43, 44, 0, 0, 46, 47, 0, 48, - 49, 50, 0, 0, 0, 0, 0, 53, 0, 54, - 55, 56, 0, 0, 0, 0, 0, 0, 0, 60, - 61, 62, 63, 64, 65, 66, 5, 6, 7, 8, - 9, 0, 67, 0, 0, 10, 0, 68, 0, 69, - 70, 0, 71, 72, 73, 0, 0, 0, 0, 679, + 0, 0, 43, 44, 45, 46, 0, 48, 49, 0, + 50, 0, 52, 0, 0, 0, 53, 54, 55, 0, + 56, 57, 58, 476, 60, 61, 0, 0, 0, 0, + 62, 63, 64, 65, 66, 67, 68, 5, 6, 7, + 8, 9, 0, 69, 0, 0, 10, 0, 113, 71, + 72, 73, 74, 0, 75, 76, 0, 77, 78, 79, + 608, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 11, 12, 0, 0, + 0, 0, 13, 0, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 0, 25, 26, 27, 28, + 0, 0, 0, 29, 30, 31, 32, 33, 0, 34, + 0, 0, 0, 35, 36, 37, 38, 0, 39, 0, + 40, 0, 41, 0, 0, 42, 0, 0, 0, 43, + 44, 45, 46, 0, 48, 49, 0, 50, 0, 52, + 0, 0, 0, 0, 0, 55, 0, 56, 57, 58, + 0, 0, 0, 0, 0, 0, 0, 62, 63, 64, + 65, 66, 67, 68, 5, 6, 7, 8, 9, 0, + 69, 0, 0, 10, 0, 113, 71, 72, 73, 74, + 0, 75, 76, 0, 77, 78, 79, 662, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 11, 12, 0, 0, 0, - 0, 13, 0, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 0, 25, 26, 27, 28, 0, - 0, 0, 29, 30, 31, 32, 33, 0, 34, 0, - 0, 0, 35, 36, 37, 38, 0, 39, 0, 40, - 0, 41, 0, 0, 42, 0, 0, 0, 43, 44, - 0, 0, 46, 47, 0, 48, 49, 50, 0, 0, - 0, 0, 0, 53, 0, 54, 55, 56, 0, 0, - 0, 0, 0, 0, 0, 60, 61, 62, 63, 64, - 65, 66, 5, 6, 7, 8, 9, 0, 67, 0, - 0, 10, 0, 68, 0, 69, 70, 0, 71, 72, - 73, 0, 0, 0, 0, 722, 0, 0, 0, 0, + 0, 0, 0, 11, 12, 0, 0, 0, 0, 13, + 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 0, 25, 26, 27, 28, 0, 0, 0, + 29, 30, 31, 32, 33, 0, 34, 0, 0, 0, + 35, 36, 37, 38, 0, 39, 0, 40, 0, 41, + 0, 0, 42, 0, 0, 0, 43, 44, 45, 46, + 0, 48, 49, 0, 50, 0, 52, 0, 0, 0, + 0, 0, 55, 0, 56, 57, 58, 0, 0, 0, + 0, 0, 0, 0, 62, 63, 64, 65, 66, 67, + 68, 5, 6, 7, 8, 9, 0, 69, 0, 0, + 10, 0, 113, 71, 72, 73, 74, 0, 75, 76, + 0, 77, 78, 79, 804, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 11, 12, 0, 0, 0, 0, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 28, 0, 0, 0, 29, 30, - 31, 32, 33, 0, 34, 0, 0, 0, 35, 36, - 37, 38, 0, 39, 0, 40, 0, 41, 0, 0, - 42, 0, 0, 0, 43, 44, 0, 0, 46, 47, - 0, 48, 49, 50, 0, 0, 0, 0, 0, 53, - 0, 54, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 5, 6, - 7, 8, 9, 0, 67, 0, 0, 10, 0, 68, - 0, 69, 70, 0, 71, 72, 73, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 0, 206, 11, 12, 0, + 11, 12, 0, 0, 0, 0, 13, 0, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, + 25, 26, 27, 28, 0, 0, 0, 29, 30, 31, + 32, 33, 0, 34, 0, 0, 0, 35, 36, 37, + 38, 0, 39, 0, 40, 0, 41, 0, 0, 42, + 0, 0, 0, 43, 44, 45, 46, 0, 48, 49, + 0, 50, 0, 52, 0, 0, 0, 0, 0, 55, + 0, 56, 57, 58, 0, 0, 0, 0, 0, 0, + 0, 62, 63, 64, 65, 66, 67, 68, 5, 6, + 7, 8, 9, 0, 69, 0, 0, 10, 0, 113, + 71, 72, 73, 74, 0, 75, 76, 0, 77, 78, + 79, 848, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 11, 12, 0, 0, 0, 0, 13, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 25, 26, 27, 28, 0, 0, 0, 29, 30, 31, 32, 33, 0, 34, 0, 0, 0, 35, 36, 37, 38, 0, 39, 0, 40, 0, 41, 0, 0, 42, 0, 0, 0, - 43, 44, 0, 0, 46, 47, 0, 48, 49, 50, - 0, 0, 0, 0, 0, 53, 0, 54, 55, 56, - 0, 0, 0, 0, 0, 0, 0, 60, 61, 62, - 63, 64, 65, 66, 5, 6, 7, 8, 9, 0, - 67, 0, 0, 10, 0, 68, 0, 69, 70, 0, - 71, 72, 73, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 0, 206, 0, 11, 12, 0, 0, 0, 0, 13, - 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 0, 25, 26, 27, 181, 182, 183, 0, - 29, 30, 31, 32, 33, 0, 0, 0, 0, 0, - 35, 0, 184, 0, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 0, 206, 0, 0, 0, - 0, 0, 0, 0, 55, 56, 0, 0, 0, 0, - 0, 0, 0, 60, 61, 62, 63, 64, 65, 66, - 5, 6, 7, 8, 9, 0, 67, 0, 0, 10, - 0, 68, 0, 144, 0, 0, 71, 72, 73, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 0, 206, 0, 0, 11, - 12, 0, 0, 0, 0, 13, 0, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 0, 25, - 26, 27, 181, 182, 183, 0, 29, 30, 31, 32, - 33, 429, 0, 0, 0, 0, 35, 0, 184, 0, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 0, 206, 0, 0, 0, 0, 0, 0, 0, - 55, 56, 0, 0, 0, 0, 0, 0, 0, 60, - 61, 62, 63, 64, 65, 66, 5, 6, 7, 8, - 9, 0, 67, 0, 0, 10, 0, 68, 0, 146, - 0, 0, 71, 72, 73, -348, -348, -348, -348, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 0, 206, 0, 0, 11, 12, 0, 0, 0, - 0, 13, 0, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 0, 25, 26, 27, 181, 182, - 183, 0, 29, 30, 31, 32, 33, 449, 0, 0, - 0, 0, 35, 0, 184, 0, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 0, 206, 0, - 0, 0, 0, 0, 0, 0, 55, 56, 0, 0, - 0, 0, 0, 0, 0, 60, 61, 62, 63, 64, - 65, 66, 5, 6, 7, 8, 9, 0, 67, 0, - 0, 10, 0, 68, 0, 149, 0, 0, 71, 72, - 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 43, 44, 45, 46, 0, 48, 49, 0, 50, 0, + 52, 0, 0, 0, 0, 0, 55, 0, 56, 57, + 58, 0, 0, 0, 0, 0, 0, 0, 62, 63, + 64, 65, 66, 67, 68, 5, 6, 7, 8, 9, + 0, 69, 0, 0, 10, 0, 113, 71, 72, 73, + 74, 0, 75, 76, 0, 77, 78, 79, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 11, 12, 0, 0, 0, 0, + 13, 0, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 0, 25, 26, 27, 28, 0, 0, + 0, 29, 30, 31, 32, 33, 0, 34, 0, 0, + 0, 35, 36, 37, 38, 0, 39, 0, 40, 0, + 41, 0, 0, 42, 0, 0, 0, 43, 44, 45, + 46, 0, 48, 49, 0, 50, 0, 52, 0, 0, + 0, 0, 0, 55, 0, 56, 57, 58, 0, 0, + 0, 0, 0, 0, 0, 62, 63, 64, 65, 66, + 67, 68, 5, 6, 7, 8, 9, 0, 69, 0, + 0, 10, 0, 113, 71, 72, 73, 74, 0, 75, + 76, 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 0, 0, 0, 0, 13, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 25, 26, 27, 0, 0, 0, 0, 29, 30, - 31, 32, 33, 468, 0, 0, 0, 184, 35, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 0, 206, 5, 6, 7, 8, 9, 0, 0, 0, - 0, 10, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 276, 0, 0, 0, 67, 0, 0, 0, 0, 68, - 235, 11, 12, 0, 71, 72, 73, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 0, 0, 0, 0, 29, 30, - 31, 32, 33, 0, 0, 0, 0, 0, 35, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 0, 206, 5, 6, 7, 8, 9, 0, 0, 0, - 0, 10, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 325, 0, 0, 0, 67, 0, 0, 0, 0, 68, - 0, 11, 12, 0, 71, 72, 73, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 0, 0, 0, 0, 29, 30, - 31, 32, 33, 0, 0, 0, 0, 0, 35, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 0, - 206, 0, 5, 6, 7, 8, 9, 0, 0, 0, - 0, 10, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 351, 0, 0, 0, 67, 0, 0, 0, 0, 68, - 0, 11, 12, 0, 71, 72, 73, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 0, 0, 0, 0, 29, 30, - 31, 32, 33, 0, 0, 0, 0, 0, 35, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 0, 206, - 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, - 0, 10, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 461, 0, 0, 0, 67, 0, 0, 0, 0, 68, - 0, 11, 12, 0, 71, 72, 73, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 0, 0, 0, 0, 29, 30, - 31, 32, 33, 0, 0, 0, 0, 0, 35, 0, + 111, 32, 33, 0, 0, 0, 0, 0, 35, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 46, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 112, 0, 0, 57, 58, 0, 0, 0, 0, 0, + 0, 0, 62, 63, 64, 65, 66, 67, 68, 5, + 6, 7, 8, 9, 0, 69, 0, 0, 10, 0, + 113, 71, 72, 73, 74, 0, 164, 0, 0, 77, + 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, + 0, 0, 0, 0, 13, 0, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 0, 25, 26, + 27, 0, 0, 0, 0, 29, 30, 111, 32, 33, + 0, 0, 0, 0, 0, 35, 0, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 46, 247, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 112, 0, 0, + 57, 58, 0, 0, 0, 0, 0, 0, 0, 62, + 63, 64, 65, 66, 67, 68, 5, 6, 7, 8, + 9, 0, 69, 0, 0, 10, 0, 113, 71, 72, + 73, 74, 0, 166, 0, 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, - 0, 10, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 463, 0, 0, 0, 67, 0, 0, 0, 0, 68, - 0, 11, 12, 0, 71, 72, 73, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 0, 0, 0, 0, 29, 30, - 31, 32, 33, 0, 0, 0, 0, 0, 35, 0, + 0, 0, 0, 0, 0, 11, 12, 0, 0, 0, + 0, 13, 0, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 0, 25, 26, 27, 0, 0, + 0, 0, 29, 30, 111, 32, 33, 0, 0, 0, + 0, 0, 35, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 46, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 112, 0, 0, 57, 58, 0, + 0, 0, 0, 0, 0, 0, 62, 63, 64, 65, + 66, 67, 68, 5, 6, 7, 8, 9, 0, 69, + 0, 0, 10, 0, 113, 71, 72, 73, 74, 0, + 170, 0, 0, 77, 78, 79, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 11, 12, 0, 0, 0, 0, 13, 0, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 0, 25, 26, 27, 0, 0, 0, 0, 29, + 30, 111, 32, 33, 0, 0, 0, 0, 0, 35, + -401, -401, -401, -401, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 0, 247, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 112, 0, 0, 57, 58, 0, 0, 0, 0, + 0, 0, 0, 62, 63, 64, 65, 66, 67, 68, + 5, 6, 7, 8, 9, 0, 69, 0, 0, 10, + 0, 113, 71, 72, 73, 74, 284, 0, 0, 0, + 77, 78, 79, 0, 0, 0, 0, 0, 326, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, + 12, 0, 0, 0, 0, 13, 0, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 0, 25, + 26, 27, 0, 0, 0, 0, 29, 30, 111, 32, + 33, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, - 0, 10, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 490, 0, 0, 0, 67, 0, 0, 0, 0, 68, - 0, 11, 12, 0, 71, 72, 73, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 0, 0, 0, 0, 29, 30, - 31, 32, 33, 0, 0, 0, 0, 0, 35, 0, + 0, 0, 0, 0, 0, 46, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 112, 0, + 0, 57, 58, 0, 0, 0, 0, 0, 0, 0, + 62, 63, 64, 65, 66, 67, 68, 5, 6, 7, + 8, 9, 0, 69, 0, 0, 10, 0, 113, 71, + 72, 73, 74, 0, 0, 0, 0, 77, 78, 79, + 0, 0, 0, 0, 0, 390, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 11, 12, 0, 0, + 0, 0, 13, 0, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 0, 25, 26, 27, 0, + 0, 0, 0, 29, 30, 111, 32, 33, 0, 0, + 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 112, 0, 0, 57, 58, + 0, 0, 0, 0, 0, 0, 0, 62, 63, 64, + 65, 66, 67, 68, 5, 6, 7, 8, 9, 0, + 69, 0, 0, 10, 0, 113, 71, 72, 73, 74, + 0, 0, 0, 0, 77, 78, 79, 0, 0, 0, + 0, 0, 482, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 11, 12, 0, 0, 0, 0, 13, + 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 0, 25, 26, 27, 0, 0, 0, 0, + 29, 30, 111, 32, 33, 0, 0, 0, 0, 0, + 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, - 0, 10, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 573, 0, 0, 0, 67, 0, 0, 0, 0, 68, - 0, 11, 12, 0, 71, 72, 73, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 0, 0, 0, 0, 29, 30, - 31, 32, 33, 0, 0, 0, 0, 0, 35, 0, + 0, 0, 112, 0, 0, 57, 58, 0, 0, 0, + 0, 0, 0, 0, 62, 63, 64, 65, 66, 67, + 68, 5, 6, 7, 8, 9, 0, 69, 0, 0, + 10, 0, 113, 71, 72, 73, 74, 0, 0, 0, + 0, 77, 78, 79, 0, 0, 0, 0, 0, 550, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 11, 12, 0, 0, 0, 0, 13, 0, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, + 25, 26, 27, 0, 0, 0, 0, 29, 30, 111, + 32, 33, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, - 0, 10, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 0, 0, 0, 0, 67, 0, 0, 0, 0, 68, - 0, 11, 12, 0, 71, 72, 73, 13, 0, 14, + 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, + 0, 0, 57, 58, 0, 0, 0, 0, 0, 0, + 0, 62, 63, 64, 65, 66, 67, 68, 5, 6, + 7, 8, 9, 0, 69, 0, 0, 10, 0, 113, + 71, 72, 73, 74, 0, 0, 0, 0, 77, 78, + 79, 0, 0, 0, 0, 0, 552, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 11, 12, 0, + 0, 0, 0, 13, 0, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 0, 25, 26, 27, + 0, 0, 0, 0, 29, 30, 111, 32, 33, 0, + 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 112, 0, 0, 57, + 58, 0, 0, 0, 0, 0, 0, 0, 62, 63, + 64, 65, 66, 67, 68, 5, 6, 7, 8, 9, + 0, 69, 0, 0, 10, 0, 113, 71, 72, 73, + 74, 0, 0, 0, 0, 77, 78, 79, 0, 0, + 0, 0, 0, 634, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 11, 12, 0, 0, 0, 0, + 13, 0, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 0, 25, 26, 27, 0, 0, 0, + 0, 29, 30, 111, 32, 33, 0, 0, 0, 0, + 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 112, 0, 0, 57, 58, 0, 0, + 0, 0, 0, 0, 0, 62, 63, 64, 65, 66, + 67, 68, 5, 6, 7, 8, 9, 0, 69, 0, + 0, 10, 0, 113, 71, 72, 73, 74, 0, 0, + 0, 0, 77, 78, 79, 0, 0, 0, 0, 0, + 683, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 11, 12, 0, 0, 0, 0, 13, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 25, 26, 27, 0, 0, 0, 0, 29, 30, - 31, 32, 33, 0, 0, 0, 0, 0, 35, 0, + 111, 32, 33, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, - 0, 10, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 0, 0, 0, 0, 67, 0, 0, 0, 0, 68, - 0, 11, 12, 0, 71, 72, 73, 13, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 25, 26, 27, 181, 182, 183, 0, 29, 30, - 31, 397, 33, 0, 0, 0, 0, 0, 35, 0, - 184, 0, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 0, 206, 0, 0, 0, 0, 0, - 0, 0, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 0, 181, 182, 183, 67, 0, 0, 0, 0, 68, - 0, 0, 0, 0, 71, 72, 73, 184, 0, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 0, 206, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 181, 182, 183, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 537, - 184, 655, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 0, 206, 181, 182, 183, 0, 0, + 112, 0, 0, 57, 58, 0, 0, 0, 0, 0, + 0, 0, 62, 63, 64, 65, 66, 67, 68, 5, + 6, 7, 8, 9, 0, 69, 0, 0, 10, 0, + 113, 71, 72, 73, 74, 0, 0, 0, 0, 77, + 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, + 0, 0, 0, 0, 13, 0, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 0, 25, 26, + 27, 0, 0, 0, 0, 29, 30, 111, 32, 33, + 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 112, 0, 0, + 57, 58, 0, 0, 0, 0, 0, 0, 0, 62, + 63, 64, 65, 66, 67, 68, 5, 6, 7, 8, + 9, 0, 69, 0, 0, 10, 0, 113, 71, 72, + 73, 74, 0, 0, 0, 0, 77, 78, 79, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 11, 12, 0, 0, 0, + 0, 13, 0, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 0, 25, 26, 27, 0, 0, + 0, 0, 29, 30, 111, 334, 33, 0, 0, 0, + 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 112, 0, 0, 57, 58, 0, + 0, 0, 0, 0, 0, 0, 62, 63, 64, 65, + 66, 67, 68, 0, 0, 0, 0, 0, 0, 69, + 222, 223, 224, 0, 113, 71, 72, 73, 74, 0, + 0, 0, 0, 77, 78, 79, 225, 0, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 222, 223, 224, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 225, 0, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 0, 247, 222, 223, 224, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 225, 0, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 0, 0, 0, 222, 223, 224, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 225, 629, 226, 227, 228, 229, 230, + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 0, 247, 222, 223, + 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 481, 0, 0, 225, 0, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 222, + 223, 224, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 518, 0, 0, 225, 0, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 0, 247, + 0, 0, 222, 223, 224, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 542, 225, 776, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 222, 223, 224, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 653, 225, + 0, 226, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 0, 247, 222, 223, 224, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 721, + 225, 0, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 222, 223, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 184, 0, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 0, 206, 602, 181, 182, 183, + 777, 225, 0, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 0, 247, 222, 223, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 184, 0, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 0, 206, 181, 182, - 183, 0, 0, 0, 0, 0, 0, 656, 0, 0, - 0, 0, 0, 0, 184, 0, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 0, 206, 181, - 182, 183, 0, 0, 0, 0, 0, 0, 207, 0, - 0, 0, 0, 0, 0, 184, 0, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 0, 206, - 181, 182, 183, 0, 0, 0, 0, 0, 0, 0, - 250, 0, 0, 0, 0, 0, 184, 0, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 0, - 206, 181, 182, 183, 0, 0, 0, 0, 0, 0, - 0, 251, 0, 0, 0, 0, 0, 184, 0, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 0, 206, 181, 182, 183, 0, 0, 0, 0, 0, - 0, 0, 257, 0, 0, 0, 0, 0, 184, 0, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 0, 206, 181, 182, 183, 0, 0, 0, 0, - 0, 0, 286, 0, 0, 0, 0, 0, 0, 184, - 0, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 0, 206, 181, 182, 183, 0, 0, 0, - 0, 0, 0, 343, 0, 0, 0, 0, 0, 0, - 184, 0, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 0, 206, 181, 182, 183, 0, 0, - 0, 0, 0, 0, 349, 0, 0, 0, 0, 0, - 0, 184, 0, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 0, 206, 181, 182, 183, 0, - 0, 0, 0, 0, 0, 350, 0, 0, 0, 0, - 0, 0, 184, 0, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 0, 206, 181, 182, 183, - 0, 0, 0, 0, 0, 0, 365, 0, 0, 0, - 0, 0, 0, 184, 0, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 0, 206, 181, 182, - 183, 0, 0, 0, 0, 0, 0, 438, 0, 0, - 0, 0, 0, 0, 184, 0, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 0, 206, 181, - 182, 183, 0, 0, 0, 0, 0, 0, 607, 0, - 0, 0, 0, 0, 0, 184, 0, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 0, 206, - 181, 182, 183, 0, 0, 0, 0, 0, 0, 721, - 0, 0, 0, 0, 0, 0, 184, 0, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 0, - 206, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 732, 0, 0, 0, 0, 0, 181, 182, 183, 0, + 0, 248, 225, 0, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 222, 223, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 391, 184, 478, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 0, 206, 181, 182, 183, + 0, 0, 298, 225, 0, 226, 227, 228, 229, 230, + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 0, 247, 222, 223, + 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 299, 225, 0, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 222, + 223, 224, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 305, 225, 0, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 0, 247, + 222, 223, 224, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 345, 0, 225, 0, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 222, 223, 224, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 410, 0, 225, 0, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 0, 247, 222, 223, 224, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 420, 0, 225, 0, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 222, 223, 224, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 421, 0, 225, + 0, 226, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 0, 247, 222, 223, 224, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 431, 0, + 225, 0, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 222, 223, 224, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 524, + 0, 225, 0, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 0, 247, 222, 223, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 522, 184, 0, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 0, 206, 182, 183, + 726, 0, 225, 0, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 222, 223, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 184, 0, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 183, 206, 0, 0, + 0, 847, 0, 225, 0, 226, 227, 228, 229, 230, + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 0, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 184, 0, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 0, 206 + 0, 0, 857, 0, 222, 223, 224, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 463, + 225, 584, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 222, 223, 224, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 627, 225, 0, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 0, 247, 223, 224, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 225, 0, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 224, 247, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 225, 0, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 225, 247, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 0, 247, 227, 228, 229, 230, + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 0, 247, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247 }; static const yytype_int16 yycheck[] = { - 23, 24, 26, 26, 180, 348, 4, 439, 8, 26, - 61, 61, 206, 8, 26, 8, 351, 8, 8, 26, - 8, 5, 6, 338, 8, 9, 10, 11, 12, 13, - 14, 346, 16, 17, 18, 19, 20, 21, 22, 73, - 61, 25, 8, 8, 78, 8, 8, 46, 8, 79, - 31, 8, 36, 63, 230, 231, 71, 256, 73, 43, - 44, 71, 46, 73, 48, 71, 140, 73, 26, 120, - 0, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 0, 68, 140, 61, 61, 73, 116, - 71, 98, 73, 143, 71, 73, 31, 66, 67, 68, - 71, 71, 73, 137, 138, 59, 60, 122, 139, 140, - 140, 140, 71, 147, 73, 140, 31, 59, 60, 103, - 140, 71, 143, 73, 131, 142, 461, 111, 463, 73, - 145, 143, 66, 67, 68, 145, 159, 143, 73, 145, - 138, 141, 141, 166, 167, 168, 123, 142, 132, 142, - 134, 142, 142, 123, 142, 490, 140, 141, 73, 143, - 145, 476, 477, 339, 145, 140, 140, 145, 143, 143, - 116, 141, 348, 180, 145, 141, 141, 609, 141, 141, - 73, 141, 206, 206, 141, 140, 145, 171, 71, 140, - 73, 175, 71, 143, 73, 145, 143, 507, 182, 206, - 142, 145, 140, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 180, 230, 231, 419, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 573, 238, - 224, 225, 140, 265, 140, 73, 140, 557, 206, 559, - 78, 140, 275, 276, 238, 239, 66, 67, 242, 140, - 603, 284, 145, 93, 94, 71, 145, 73, 74, 292, - 73, 71, 230, 231, 71, 78, 260, 139, 92, 93, - 94, 92, 93, 94, 599, 93, 94, 66, 67, 488, - 288, 298, 140, 45, 46, 47, 639, 49, 120, 283, - 142, 143, 325, 49, 503, 140, 23, 24, 136, 137, - 138, 23, 24, 97, 144, 299, 139, 301, 302, 303, - 304, 105, 106, 107, 108, 109, 110, 139, 351, 46, - 144, 120, 339, 144, 137, 138, 144, 72, 73, 338, - 139, 348, 140, 146, 92, 93, 94, 346, 547, 371, - 372, 92, 93, 94, 338, 31, 379, 142, 79, 13, - 143, 142, 346, 141, 8, 118, 140, 144, 82, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 339, 142, 8, 90, 71, 409, 71, 73, 8, - 348, 141, 141, 71, 141, 419, 419, 42, 43, 44, - 45, 46, 47, 142, 49, 118, 140, 391, 140, 393, - 148, 26, 419, 141, 8, 59, 60, 140, 441, 442, - 13, 443, 144, 139, 141, 140, 13, 603, 71, 140, - 61, 453, 454, 142, 457, 433, 459, 436, 461, 423, - 463, 144, 159, 371, 372, 140, 119, 445, 471, 166, - 167, 168, 436, 143, 141, 439, 440, 71, 141, 140, - 659, 419, 101, 639, 71, 13, 141, 490, 8, 143, - 140, 142, 121, 142, 13, 498, 142, 476, 477, 140, - 679, 121, 141, 467, 8, 148, 685, 142, 141, 141, - 148, 120, 476, 477, 517, 141, 494, 141, 89, 141, - 484, 485, 701, 141, 8, 71, 142, 706, 531, 493, - 144, 97, 120, 83, 142, 443, 142, 73, 13, 143, - 121, 238, 13, 722, 73, 453, 454, 71, 551, 141, - 140, 142, 141, 555, 13, 519, 142, 13, 522, 13, - 140, 26, 68, 73, 743, 567, 745, 569, 144, 13, - 573, 535, 73, 752, 9, 10, 11, 73, 275, 276, - 71, 142, 87, 13, 141, 13, 68, 284, 142, 768, - 25, 140, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 26, 49, 85, 603, 143, 101, 142, - 599, 73, 625, 141, 140, 758, 379, 144, 325, 144, - 141, 143, 668, 471, 499, 599, 144, 650, 551, 654, - 288, 338, 739, 288, 530, 609, 622, 555, 263, 346, - 514, 592, 639, 617, 351, 536, 159, 699, 484, 567, - 662, 569, 664, 665, 8, 603, 644, 517, -1, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, -1, 379, 459, -1, -1, -1, 689, -1, -1, - 42, 43, 694, -1, -1, -1, 698, -1, -1, -1, - -1, 639, -1, -1, -1, -1, -1, -1, 710, -1, - -1, 675, -1, 148, -1, 59, 60, 69, 70, 71, - -1, -1, 98, -1, -1, 727, 704, 79, 730, 105, - 106, 107, 108, 109, 110, 111, 700, -1, -1, 436, - -1, -1, -1, -1, 441, 442, -1, -1, -1, -1, - -1, -1, -1, -1, 662, 733, 664, 665, 761, -1, - 457, -1, 459, -1, 461, -1, 463, -1, 144, -1, - -1, 123, 124, 125, 126, 127, 128, -1, -1, 476, - 477, 689, -1, -1, -1, -1, 694, -1, -1, -1, - 698, -1, -1, 490, -1, -1, -1, 141, -1, -1, - -1, 498, 710, -1, -1, -1, -1, -1, 9, 10, - 11, -1, 3, 4, 5, 6, 7, -1, -1, 727, - 517, 12, 730, -1, 25, -1, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, -1, 49, -1, - -1, 42, 43, -1, 551, -1, -1, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, 65, -1, 573, -1, 69, 70, - 71, 72, 73, -1, 75, -1, -1, -1, 79, 80, - 81, 82, -1, 84, -1, 86, -1, 88, -1, -1, - 91, -1, 599, -1, 95, 96, 97, -1, 99, 100, - -1, 102, 103, 104, -1, -1, -1, 108, 109, 110, - -1, 112, 113, 114, 115, 116, 117, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, 3, 4, - 5, 6, 7, 144, 135, -1, -1, 12, -1, 140, - 98, 142, 143, -1, 145, 146, 147, 105, 106, 107, - 108, 109, 110, 111, -1, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 42, 43, -1, - -1, -1, -1, 48, -1, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 144, 62, 63, 64, - 65, -1, -1, -1, 69, 70, 71, 72, 73, -1, - 75, 59, 60, -1, 79, 80, 81, 82, -1, 84, - -1, 86, -1, 88, -1, -1, 91, -1, -1, -1, - 95, 96, 97, -1, 99, 100, -1, 102, 103, 104, - -1, -1, 90, 108, 109, 110, -1, 112, 113, 114, - 115, 116, 117, -1, -1, -1, -1, 122, 123, 124, - 125, 126, 127, 128, 3, 4, 5, 6, 7, -1, - 135, -1, -1, 12, -1, 140, -1, 142, 143, -1, - 145, 146, 147, -1, -1, -1, -1, 26, -1, -1, + 23, 24, 26, 26, 4, 114, 4, 26, 403, 26, + 48, 354, 419, 575, 221, 525, 8, 8, 247, 482, + 8, 416, 8, 8, 8, 26, 61, 26, 51, 8, + 8, 61, 8, 78, 8, 8, 8, 73, 8, 8, + 304, 8, 71, 63, 31, 61, 145, 70, 341, 61, + 73, 71, 140, 73, 145, 61, 144, 264, 71, 140, + 73, 71, 145, 144, 145, 92, 93, 94, 275, 276, + 26, 140, 279, 0, 281, 144, 71, 140, 71, 140, + 475, 144, 145, 144, 108, 0, 73, 550, 8, 552, + 145, 111, 137, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 140, 71, 71, 73, 23, + 24, 134, 26, 148, 150, 145, 145, 71, 148, 73, + 143, 141, 149, 161, 144, 73, 73, 151, 140, 71, + 150, 73, 148, 145, 144, 148, 148, 150, 148, 59, + 60, 301, 148, 71, 90, 73, 141, 148, 147, 144, + 493, 144, 90, 176, 146, 315, 147, 117, 181, 147, + 158, 147, 147, 147, 559, 188, 189, 190, 147, 147, + 146, 634, 146, 146, 146, 198, 146, 146, 201, 146, + 71, 474, 71, 111, 73, 150, 581, 582, 61, 73, + 31, 31, 587, 588, 145, 123, 150, 221, 144, 406, + 93, 94, 150, 150, 221, 145, 144, 117, 150, 71, + 140, 73, 419, 141, 144, 145, 144, 71, 728, 145, + 683, 145, 150, 247, 247, 71, 146, 570, 247, 73, + 247, 71, 73, 73, 78, 148, 612, 145, 31, 71, + 264, 73, 74, 71, 145, 73, 145, 264, 121, 111, + 273, 275, 276, 73, 277, 279, 149, 281, 275, 276, + 73, 150, 279, 73, 281, 78, 71, 181, 73, 31, + 124, 111, 432, 433, 188, 189, 190, 506, 301, 141, + 73, 71, 144, 111, 198, 308, 148, 141, 150, 145, + 144, 71, 315, 855, 138, 139, 672, 640, 674, 59, + 60, 141, 325, 326, 144, 31, 111, 73, 152, 145, + 150, 73, 78, 141, 352, 722, 144, 137, 138, 139, + 93, 94, 150, 718, 137, 138, 139, 487, 138, 139, + 71, 354, 596, 247, 124, 73, 141, 140, 362, 144, + 78, 73, 144, 145, 608, 150, 78, 347, 145, 347, + 73, 141, 140, 760, 144, 78, 146, 66, 67, 68, + 121, 92, 93, 94, 195, 403, 144, 390, 199, 529, + 49, 137, 138, 139, 144, 535, 149, 208, 416, 210, + 211, 212, 406, 543, 45, 46, 47, 144, 49, 406, + 147, 148, 92, 93, 94, 419, 144, 145, 662, 742, + 138, 139, 419, 92, 93, 94, 138, 139, 144, 432, + 433, 325, 326, 140, 437, 138, 139, 121, 149, 140, + 9, 10, 11, 66, 67, 68, 144, 145, 451, 66, + 67, 66, 67, 147, 148, 140, 25, 475, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 482, + 49, 23, 24, 144, 487, 140, 489, 78, 79, 145, + 493, 13, 13, 496, 147, 147, 390, 148, 146, 149, + 71, 71, 506, 506, 151, 119, 26, 506, 752, 506, + 754, 145, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 527, 528, 529, 145, 82, 8, + 670, 147, 535, 90, 537, 722, 676, 71, 678, 71, + 543, 559, 73, 546, 522, 548, 146, 550, 566, 552, + 147, 146, 8, 531, 71, 61, 149, 451, 59, 60, + 804, 884, 13, 581, 582, 568, 810, 570, 119, 587, + 588, 711, 575, 760, 42, 43, 44, 45, 46, 47, + 149, 49, 145, 145, 828, 145, 145, 153, 482, 833, + 26, 13, 145, 145, 23, 24, 144, 26, 98, 140, + 603, 71, 149, 13, 848, 145, 106, 107, 108, 109, + 110, 111, 506, 315, 147, 145, 8, 757, 146, 622, + 149, 599, 120, 867, 148, 869, 144, 146, 71, 873, + 145, 634, 146, 527, 528, 137, 71, 640, 102, 13, + 780, 644, 782, 153, 149, 148, 147, 891, 8, 146, + 146, 146, 546, 793, 548, 8, 550, 145, 552, 748, + 147, 122, 13, 666, 147, 147, 146, 670, 122, 8, + 145, 149, 146, 676, 814, 678, 147, 146, 818, 104, + 683, 4, 5, 6, 824, 8, 9, 10, 11, 12, + 13, 14, 73, 16, 17, 18, 19, 20, 21, 22, + 718, 13, 25, 153, 146, 146, 146, 146, 711, 603, + 121, 89, 146, 36, 854, 146, 71, 145, 722, 98, + 43, 44, 702, 13, 148, 722, 121, 50, 622, 148, + 432, 433, 147, 83, 99, 147, 122, 13, 147, 742, + 634, 106, 107, 108, 109, 110, 111, 112, 73, 71, + 13, 74, 181, 73, 757, 146, 760, 145, 147, 188, + 189, 190, 146, 760, 147, 13, 71, 13, 13, 198, + 73, 26, 666, 149, 149, 145, 68, 780, 73, 782, + 73, 147, 146, 87, 149, 487, 13, 765, 99, 683, + 793, 145, 73, 68, 117, 106, 107, 108, 109, 110, + 111, 112, 125, 147, 26, 85, 148, 147, 146, 73, + 145, 814, 149, 149, 102, 818, 146, 148, 247, 308, + 149, 824, 882, 451, 347, 570, 604, 529, 666, 152, + 771, 154, 775, 535, 347, 158, 313, 160, 149, 644, + 163, 543, 639, 703, 650, 616, 622, 181, 592, 826, + -1, 854, 855, 831, -1, 548, -1, -1, -1, -1, + -1, -1, -1, 23, 24, -1, -1, -1, -1, -1, + 193, -1, 301, -1, 197, -1, -1, -1, -1, -1, + 858, 884, -1, -1, 207, -1, 315, -1, 48, -1, + -1, -1, -1, -1, -1, -1, 325, 326, -1, -1, + 223, -1, -1, -1, -1, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, -1, -1, -1, -1, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + -1, 8, -1, 266, 267, -1, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, -1, -1, + -1, 390, -1, -1, 287, -1, -1, 290, 670, -1, + -1, -1, -1, -1, 676, -1, 678, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 310, 42, 43, + -1, -1, 59, 60, -1, -1, -1, -1, -1, -1, + -1, 161, -1, 432, 433, -1, -1, -1, -1, 711, + -1, -1, -1, -1, -1, 69, 70, 71, -1, -1, + -1, 181, 451, -1, 347, 79, -1, -1, 188, 189, + 190, -1, -1, -1, -1, -1, -1, -1, 198, -1, + 363, -1, 365, -1, 367, 368, 369, -1, -1, -1, + -1, -1, -1, 482, -1, 757, -1, 111, 487, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 124, 125, 126, 127, 128, 129, -1, 506, 780, 146, + 782, -1, 136, -1, -1, -1, -1, 141, 142, 143, + 144, 793, -1, -1, -1, -1, -1, -1, 527, 528, + 529, -1, -1, -1, -1, -1, 535, -1, -1, -1, + -1, -1, 814, -1, 543, -1, 818, 546, -1, 548, + -1, 550, 824, 552, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, -1, -1, -1, -1, + 463, -1, 465, -1, -1, -1, 469, -1, -1, -1, + -1, -1, 854, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 325, 326, -1, -1, -1, + 59, 60, -1, -1, 603, -1, -1, -1, -1, 502, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 512, + -1, -1, 352, 622, -1, -1, -1, -1, -1, 522, + -1, 90, 525, 526, -1, 634, -1, -1, 531, -1, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 42, 43, -1, -1, -1, -1, 48, - -1, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, -1, 62, 63, 64, 65, -1, -1, -1, - 69, 70, 71, 72, 73, -1, 75, 59, 60, -1, - 79, 80, 81, 82, -1, 84, -1, 86, -1, 88, - -1, -1, 91, -1, -1, -1, 95, 96, -1, -1, - 99, 100, -1, 102, 103, 104, -1, -1, -1, -1, - -1, 110, -1, 112, 113, 114, -1, -1, -1, -1, - -1, -1, -1, 122, 123, 124, 125, 126, 127, 128, - 3, 4, 5, 6, 7, -1, 135, -1, -1, 12, - -1, 140, -1, 142, 143, -1, 145, 146, 147, -1, - -1, -1, -1, 26, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, -1, 49, -1, 42, + 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, + 390, -1, -1, -1, -1, -1, -1, 666, -1, -1, + -1, 670, -1, 403, -1, -1, -1, 676, -1, 678, + -1, -1, -1, -1, 683, -1, 416, 59, 60, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 592, + 593, -1, -1, -1, -1, 598, 599, -1, -1, -1, + -1, -1, 711, -1, -1, -1, -1, -1, -1, -1, + -1, 451, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 624, -1, -1, 627, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 475, -1, -1, -1, -1, + -1, -1, 482, -1, -1, -1, 649, -1, 757, -1, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 780, 49, 782, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 793, -1, -1, 527, 528, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, -1, 49, -1, -1, 814, 546, -1, 548, 818, + 550, -1, 552, -1, -1, 824, -1, -1, -1, 559, + -1, -1, -1, -1, -1, 728, 566, -1, -1, -1, + -1, -1, -1, 736, -1, -1, -1, -1, -1, -1, + -1, 581, 582, -1, -1, 854, -1, 587, 588, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 765, 603, -1, -1, -1, 770, 771, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 622, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 634, -1, -1, 800, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 3, 4, 5, 6, 7, -1, -1, + -1, -1, 12, -1, 827, -1, 666, -1, 831, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 683, -1, -1, -1, -1, -1, -1, + -1, -1, 42, 43, -1, 858, -1, -1, 48, -1, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, 62, 63, 64, 65, -1, -1, 718, 69, + 70, 71, 72, 73, -1, 75, -1, -1, -1, 79, + 80, 81, 82, -1, 84, -1, 86, -1, 88, -1, + -1, 91, -1, -1, -1, 95, 96, 97, 98, 99, + 100, 101, -1, 103, 104, 105, -1, -1, -1, 109, + 110, 111, -1, 113, 114, 115, 116, 117, 118, -1, + -1, -1, -1, 123, 124, 125, 126, 127, 128, 129, + 3, 4, 5, 6, 7, -1, 136, -1, -1, 12, + -1, 141, 142, 143, 144, 145, -1, 147, 148, -1, + 150, 151, 152, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, -1, 48, -1, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, -1, 62, 63, 64, 65, -1, -1, -1, 69, 70, 71, 72, 73, -1, 75, -1, -1, -1, 79, 80, 81, 82, -1, 84, -1, 86, -1, 88, -1, -1, 91, -1, - -1, -1, 95, 96, -1, -1, 99, 100, -1, 102, - 103, 104, -1, -1, -1, -1, -1, 110, -1, 112, - 113, 114, -1, -1, -1, -1, -1, -1, -1, 122, - 123, 124, 125, 126, 127, 128, 3, 4, 5, 6, - 7, -1, 135, -1, -1, 12, -1, 140, -1, 142, - 143, -1, 145, 146, 147, -1, -1, -1, -1, 26, + -1, -1, 95, 96, 97, 98, -1, 100, 101, -1, + 103, -1, 105, -1, -1, -1, 109, 110, 111, -1, + 113, 114, 115, 116, 117, 118, -1, -1, -1, -1, + 123, 124, 125, 126, 127, 128, 129, 3, 4, 5, + 6, 7, -1, 136, -1, -1, 12, -1, 141, 142, + 143, 144, 145, -1, 147, 148, -1, 150, 151, 152, + 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, + -1, -1, 48, -1, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, -1, 62, 63, 64, 65, + -1, -1, -1, 69, 70, 71, 72, 73, -1, 75, + -1, -1, -1, 79, 80, 81, 82, -1, 84, -1, + 86, -1, 88, -1, -1, 91, -1, -1, -1, 95, + 96, 97, 98, -1, 100, 101, -1, 103, -1, 105, + -1, -1, -1, -1, -1, 111, -1, 113, 114, 115, + -1, -1, -1, -1, -1, -1, -1, 123, 124, 125, + 126, 127, 128, 129, 3, 4, 5, 6, 7, -1, + 136, -1, -1, 12, -1, 141, 142, 143, 144, 145, + -1, 147, 148, -1, 150, 151, 152, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, - -1, 48, -1, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, -1, 62, 63, 64, 65, -1, - -1, -1, 69, 70, 71, 72, 73, -1, 75, -1, - -1, -1, 79, 80, 81, 82, -1, 84, -1, 86, - -1, 88, -1, -1, 91, -1, -1, -1, 95, 96, - -1, -1, 99, 100, -1, 102, 103, 104, -1, -1, - -1, -1, -1, 110, -1, 112, 113, 114, -1, -1, - -1, -1, -1, -1, -1, 122, 123, 124, 125, 126, - 127, 128, 3, 4, 5, 6, 7, -1, 135, -1, - -1, 12, -1, 140, -1, 142, 143, -1, 145, 146, - 147, -1, -1, -1, -1, 26, -1, -1, -1, -1, + -1, -1, -1, 42, 43, -1, -1, -1, -1, 48, + -1, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, -1, 62, 63, 64, 65, -1, -1, -1, + 69, 70, 71, 72, 73, -1, 75, -1, -1, -1, + 79, 80, 81, 82, -1, 84, -1, 86, -1, 88, + -1, -1, 91, -1, -1, -1, 95, 96, 97, 98, + -1, 100, 101, -1, 103, -1, 105, -1, -1, -1, + -1, -1, 111, -1, 113, 114, 115, -1, -1, -1, + -1, -1, -1, -1, 123, 124, 125, 126, 127, 128, + 129, 3, 4, 5, 6, 7, -1, 136, -1, -1, + 12, -1, 141, 142, 143, 144, 145, -1, 147, 148, + -1, 150, 151, 152, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 42, 43, -1, -1, -1, -1, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, 65, -1, -1, -1, 69, 70, - 71, 72, 73, -1, 75, -1, -1, -1, 79, 80, - 81, 82, -1, 84, -1, 86, -1, 88, -1, -1, - 91, -1, -1, -1, 95, 96, -1, -1, 99, 100, - -1, 102, 103, 104, -1, -1, -1, -1, -1, 110, - -1, 112, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, 3, 4, - 5, 6, 7, -1, 135, -1, -1, 12, -1, 140, - -1, 142, 143, -1, 145, 146, 147, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, -1, 49, 42, 43, -1, + 42, 43, -1, -1, -1, -1, 48, -1, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, -1, + 62, 63, 64, 65, -1, -1, -1, 69, 70, 71, + 72, 73, -1, 75, -1, -1, -1, 79, 80, 81, + 82, -1, 84, -1, 86, -1, 88, -1, -1, 91, + -1, -1, -1, 95, 96, 97, 98, -1, 100, 101, + -1, 103, -1, 105, -1, -1, -1, -1, -1, 111, + -1, 113, 114, 115, -1, -1, -1, -1, -1, -1, + -1, 123, 124, 125, 126, 127, 128, 129, 3, 4, + 5, 6, 7, -1, 136, -1, -1, 12, -1, 141, + 142, 143, 144, 145, -1, 147, 148, -1, 150, 151, + 152, 26, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, -1, 48, -1, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, -1, 62, 63, 64, 65, -1, -1, -1, 69, 70, 71, 72, 73, -1, 75, -1, -1, -1, 79, 80, 81, 82, -1, 84, -1, 86, -1, 88, -1, -1, 91, -1, -1, -1, - 95, 96, -1, -1, 99, 100, -1, 102, 103, 104, - -1, -1, -1, -1, -1, 110, -1, 112, 113, 114, - -1, -1, -1, -1, -1, -1, -1, 122, 123, 124, - 125, 126, 127, 128, 3, 4, 5, 6, 7, -1, - 135, -1, -1, 12, -1, 140, -1, 142, 143, -1, - 145, 146, 147, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - -1, 49, -1, 42, 43, -1, -1, -1, -1, 48, - -1, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, -1, 62, 63, 64, 9, 10, 11, -1, - 69, 70, 71, 72, 73, -1, -1, -1, -1, -1, - 79, -1, 25, -1, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, -1, 49, -1, -1, -1, - -1, -1, -1, -1, 113, 114, -1, -1, -1, -1, - -1, -1, -1, 122, 123, 124, 125, 126, 127, 128, - 3, 4, 5, 6, 7, -1, 135, -1, -1, 12, - -1, 140, -1, 142, -1, -1, 145, 146, 147, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, -1, 49, -1, -1, 42, - 43, -1, -1, -1, -1, 48, -1, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, -1, 62, - 63, 64, 9, 10, 11, -1, 69, 70, 71, 72, - 73, 144, -1, -1, -1, -1, 79, -1, 25, -1, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, -1, 49, -1, -1, -1, -1, -1, -1, -1, - 113, 114, -1, -1, -1, -1, -1, -1, -1, 122, - 123, 124, 125, 126, 127, 128, 3, 4, 5, 6, - 7, -1, 135, -1, -1, 12, -1, 140, -1, 142, - -1, -1, 145, 146, 147, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, -1, 49, -1, -1, 42, 43, -1, -1, -1, - -1, 48, -1, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, -1, 62, 63, 64, 9, 10, - 11, -1, 69, 70, 71, 72, 73, 144, -1, -1, - -1, -1, 79, -1, 25, -1, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, -1, 49, -1, - -1, -1, -1, -1, -1, -1, 113, 114, -1, -1, - -1, -1, -1, -1, -1, 122, 123, 124, 125, 126, - 127, 128, 3, 4, 5, 6, 7, -1, 135, -1, - -1, 12, -1, 140, -1, 142, -1, -1, 145, 146, - 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 95, 96, 97, 98, -1, 100, 101, -1, 103, -1, + 105, -1, -1, -1, -1, -1, 111, -1, 113, 114, + 115, -1, -1, -1, -1, -1, -1, -1, 123, 124, + 125, 126, 127, 128, 129, 3, 4, 5, 6, 7, + -1, 136, -1, -1, 12, -1, 141, 142, 143, 144, + 145, -1, 147, 148, -1, 150, 151, 152, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 42, 43, -1, -1, -1, -1, + 48, -1, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, -1, 62, 63, 64, 65, -1, -1, + -1, 69, 70, 71, 72, 73, -1, 75, -1, -1, + -1, 79, 80, 81, 82, -1, 84, -1, 86, -1, + 88, -1, -1, 91, -1, -1, -1, 95, 96, 97, + 98, -1, 100, 101, -1, 103, -1, 105, -1, -1, + -1, -1, -1, 111, -1, 113, 114, 115, -1, -1, + -1, -1, -1, -1, -1, 123, 124, 125, 126, 127, + 128, 129, 3, 4, 5, 6, 7, -1, 136, -1, + -1, 12, -1, 141, 142, 143, 144, 145, -1, 147, + 148, -1, 150, 151, 152, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, -1, 48, -1, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, -1, 62, 63, 64, -1, -1, -1, -1, 69, 70, - 71, 72, 73, 144, -1, -1, -1, 25, 79, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - -1, 49, 3, 4, 5, 6, 7, -1, -1, -1, - -1, 12, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - 31, -1, -1, -1, 135, -1, -1, -1, -1, 140, - 141, 42, 43, -1, 145, 146, 147, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, -1, -1, -1, -1, 69, 70, - 71, 72, 73, -1, -1, -1, -1, -1, 79, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - -1, 49, 3, 4, 5, 6, 7, -1, -1, -1, - -1, 12, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - 31, -1, -1, -1, 135, -1, -1, -1, -1, 140, - -1, 42, 43, -1, 145, 146, 147, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, -1, -1, -1, -1, 69, 70, - 71, 72, 73, -1, -1, -1, -1, -1, 79, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 71, 72, 73, -1, -1, -1, -1, -1, 79, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 98, 49, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 111, -1, -1, 114, 115, -1, -1, -1, -1, -1, + -1, -1, 123, 124, 125, 126, 127, 128, 129, 3, + 4, 5, 6, 7, -1, 136, -1, -1, 12, -1, + 141, 142, 143, 144, 145, -1, 147, -1, -1, 150, + 151, 152, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 42, 43, + -1, -1, -1, -1, 48, -1, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, -1, 62, 63, + 64, -1, -1, -1, -1, 69, 70, 71, 72, 73, + -1, -1, -1, -1, -1, 79, -1, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 98, 49, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, + 114, 115, -1, -1, -1, -1, -1, -1, -1, 123, + 124, 125, 126, 127, 128, 129, 3, 4, 5, 6, + 7, -1, 136, -1, -1, 12, -1, 141, 142, 143, + 144, 145, -1, 147, -1, -1, 150, 151, 152, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, + -1, 48, -1, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, 62, 63, 64, -1, -1, + -1, -1, 69, 70, 71, 72, 73, -1, -1, -1, + -1, -1, 79, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, - 49, -1, 3, 4, 5, 6, 7, -1, -1, -1, - -1, 12, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - 31, -1, -1, -1, 135, -1, -1, -1, -1, 140, - -1, 42, 43, -1, 145, 146, 147, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, -1, -1, -1, -1, 69, 70, - 71, 72, 73, -1, -1, -1, -1, -1, 79, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, - -1, -1, 3, 4, 5, 6, 7, -1, -1, -1, - -1, 12, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - 31, -1, -1, -1, 135, -1, -1, -1, -1, 140, - -1, 42, 43, -1, 145, 146, 147, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, -1, -1, -1, -1, 69, 70, - 71, 72, 73, -1, -1, -1, -1, -1, 79, -1, + 49, 98, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 111, -1, -1, 114, 115, -1, + -1, -1, -1, -1, -1, -1, 123, 124, 125, 126, + 127, 128, 129, 3, 4, 5, 6, 7, -1, 136, + -1, -1, 12, -1, 141, 142, 143, 144, 145, -1, + 147, -1, -1, 150, 151, 152, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 42, 43, -1, -1, -1, -1, 48, -1, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, -1, 62, 63, 64, -1, -1, -1, -1, 69, + 70, 71, 72, 73, -1, -1, -1, -1, -1, 79, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, -1, 49, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, -1, -1, -1, - -1, 12, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - 31, -1, -1, -1, 135, -1, -1, -1, -1, 140, - -1, 42, 43, -1, 145, 146, 147, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, -1, -1, -1, -1, 69, 70, - 71, 72, 73, -1, -1, -1, -1, -1, 79, -1, + -1, 111, -1, -1, 114, 115, -1, -1, -1, -1, + -1, -1, -1, 123, 124, 125, 126, 127, 128, 129, + 3, 4, 5, 6, 7, -1, 136, -1, -1, 12, + -1, 141, 142, 143, 144, 145, 146, -1, -1, -1, + 150, 151, 152, -1, -1, -1, -1, -1, 31, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, + 43, -1, -1, -1, -1, 48, -1, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, -1, 62, + 63, 64, -1, -1, -1, -1, 69, 70, 71, 72, + 73, -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, + -1, 114, 115, -1, -1, -1, -1, -1, -1, -1, + 123, 124, 125, 126, 127, 128, 129, 3, 4, 5, + 6, 7, -1, 136, -1, -1, 12, -1, 141, 142, + 143, 144, 145, -1, -1, -1, -1, 150, 151, 152, + -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, + -1, -1, 48, -1, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, -1, 62, 63, 64, -1, + -1, -1, -1, 69, 70, 71, 72, 73, -1, -1, + -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, -1, -1, -1, - -1, 12, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - 31, -1, -1, -1, 135, -1, -1, -1, -1, 140, - -1, 42, 43, -1, 145, 146, 147, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, -1, -1, -1, -1, 69, 70, - 71, 72, 73, -1, -1, -1, -1, -1, 79, -1, + -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 111, -1, -1, 114, 115, + -1, -1, -1, -1, -1, -1, -1, 123, 124, 125, + 126, 127, 128, 129, 3, 4, 5, 6, 7, -1, + 136, -1, -1, 12, -1, 141, 142, 143, 144, 145, + -1, -1, -1, -1, 150, 151, 152, -1, -1, -1, + -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 42, 43, -1, -1, -1, -1, 48, + -1, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, -1, 62, 63, 64, -1, -1, -1, -1, + 69, 70, 71, 72, 73, -1, -1, -1, -1, -1, + 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 111, -1, -1, 114, 115, -1, -1, -1, + -1, -1, -1, -1, 123, 124, 125, 126, 127, 128, + 129, 3, 4, 5, 6, 7, -1, 136, -1, -1, + 12, -1, 141, 142, 143, 144, 145, -1, -1, -1, + -1, 150, 151, 152, -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, -1, -1, -1, - -1, 12, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - 31, -1, -1, -1, 135, -1, -1, -1, -1, 140, - -1, 42, 43, -1, 145, 146, 147, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, -1, -1, -1, -1, 69, 70, - 71, 72, 73, -1, -1, -1, -1, -1, 79, -1, + 42, 43, -1, -1, -1, -1, 48, -1, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, -1, + 62, 63, 64, -1, -1, -1, -1, 69, 70, 71, + 72, 73, -1, -1, -1, -1, -1, 79, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, + -1, -1, 114, 115, -1, -1, -1, -1, -1, -1, + -1, 123, 124, 125, 126, 127, 128, 129, 3, 4, + 5, 6, 7, -1, 136, -1, -1, 12, -1, 141, + 142, 143, 144, 145, -1, -1, -1, -1, 150, 151, + 152, -1, -1, -1, -1, -1, 31, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, + -1, -1, -1, 48, -1, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, -1, 62, 63, 64, + -1, -1, -1, -1, 69, 70, 71, 72, 73, -1, + -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 111, -1, -1, 114, + 115, -1, -1, -1, -1, -1, -1, -1, 123, 124, + 125, 126, 127, 128, 129, 3, 4, 5, 6, 7, + -1, 136, -1, -1, 12, -1, 141, 142, 143, 144, + 145, -1, -1, -1, -1, 150, 151, 152, -1, -1, + -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 42, 43, -1, -1, -1, -1, + 48, -1, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, -1, 62, 63, 64, -1, -1, -1, + -1, 69, 70, 71, 72, 73, -1, -1, -1, -1, + -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, -1, -1, -1, - -1, 12, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - -1, -1, -1, -1, 135, -1, -1, -1, -1, 140, - -1, 42, 43, -1, 145, 146, 147, 48, -1, 50, + 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 111, -1, -1, 114, 115, -1, -1, + -1, -1, -1, -1, -1, 123, 124, 125, 126, 127, + 128, 129, 3, 4, 5, 6, 7, -1, 136, -1, + -1, 12, -1, 141, 142, 143, 144, 145, -1, -1, + -1, -1, 150, 151, 152, -1, -1, -1, -1, -1, + 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 42, 43, -1, -1, -1, -1, 48, -1, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, -1, 62, 63, 64, -1, -1, -1, -1, 69, 70, 71, 72, 73, -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, -1, -1, -1, - -1, 12, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - -1, -1, -1, -1, 135, -1, -1, -1, -1, 140, - -1, 42, 43, -1, 145, 146, 147, 48, -1, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, 62, 63, 64, 9, 10, 11, -1, 69, 70, - 71, 72, 73, -1, -1, -1, -1, -1, 79, -1, - 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, -1, 49, -1, -1, -1, -1, -1, - -1, -1, 113, 114, -1, -1, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, -1, -1, - -1, 9, 10, 11, 135, -1, -1, -1, -1, 140, - -1, -1, -1, -1, 145, 146, 147, 25, -1, 27, + 111, -1, -1, 114, 115, -1, -1, -1, -1, -1, + -1, -1, 123, 124, 125, 126, 127, 128, 129, 3, + 4, 5, 6, 7, -1, 136, -1, -1, 12, -1, + 141, 142, 143, 144, 145, -1, -1, -1, -1, 150, + 151, 152, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 42, 43, + -1, -1, -1, -1, 48, -1, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, -1, 62, 63, + 64, -1, -1, -1, -1, 69, 70, 71, 72, 73, + -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, + 114, 115, -1, -1, -1, -1, -1, -1, -1, 123, + 124, 125, 126, 127, 128, 129, 3, 4, 5, 6, + 7, -1, 136, -1, -1, 12, -1, 141, 142, 143, + 144, 145, -1, -1, -1, -1, 150, 151, 152, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, + -1, 48, -1, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, 62, 63, 64, -1, -1, + -1, -1, 69, 70, 71, 72, 73, -1, -1, -1, + -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 111, -1, -1, 114, 115, -1, + -1, -1, -1, -1, -1, -1, 123, 124, 125, 126, + 127, 128, 129, -1, -1, -1, -1, -1, -1, 136, + 9, 10, 11, -1, 141, 142, 143, 144, 145, -1, + -1, -1, -1, 150, 151, 152, 25, -1, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, + 49, 9, 10, 11, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 9, 10, 11, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + -1, 49, 9, 10, 11, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, -1, 49, -1, -1, -1, -1, 9, 10, 11, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 25, 153, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, + 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 149, -1, -1, 25, -1, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, + 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 149, -1, -1, 25, -1, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, + -1, -1, 9, 10, 11, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 149, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, -1, 49, 9, 10, 11, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 149, 25, + -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, -1, 49, 9, 10, 11, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 149, + 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, + 147, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, -1, 49, 144, 9, 10, 11, + 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 147, 25, -1, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 25, -1, 27, 28, 29, 30, 31, + -1, -1, 147, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, - 11, -1, -1, -1, -1, -1, -1, 142, -1, -1, - -1, -1, -1, -1, 25, -1, 27, 28, 29, 30, + 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 147, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, - 10, 11, -1, -1, -1, -1, -1, -1, 142, -1, - -1, -1, -1, -1, -1, 25, -1, 27, 28, 29, + 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 147, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, - 142, -1, -1, -1, -1, -1, 25, -1, 27, 28, + -1, -1, -1, -1, 146, -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, -1, -1, -1, -1, - -1, 142, -1, -1, -1, -1, -1, 25, -1, 27, + -1, -1, -1, -1, -1, 146, -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, -1, -1, -1, - -1, -1, 142, -1, -1, -1, -1, -1, 25, -1, + -1, -1, -1, -1, -1, -1, 146, -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, -1, -1, - -1, -1, 141, -1, -1, -1, -1, -1, -1, 25, + -1, -1, -1, -1, -1, -1, -1, 146, -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, -1, - -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 146, -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, - -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 146, -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, - -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, - -1, -1, 25, -1, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, - -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, - -1, -1, -1, 25, -1, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, - 11, -1, -1, -1, -1, -1, -1, 141, -1, -1, - -1, -1, -1, -1, 25, -1, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, - 10, 11, -1, -1, -1, -1, -1, -1, 141, -1, - -1, -1, -1, -1, -1, 25, -1, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, - 9, 10, 11, -1, -1, -1, -1, -1, -1, 141, - -1, -1, -1, -1, -1, -1, 25, -1, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, - 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 141, -1, -1, -1, -1, -1, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 121, 25, 26, 27, 28, 29, 30, 31, 32, + 146, -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 121, 25, -1, 27, 28, 29, 30, 31, + -1, 146, -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, -1, 49, 10, 11, + 42, 43, 44, 45, 46, 47, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 25, -1, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 11, 49, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 25, -1, 27, 28, 29, 30, 31, 32, 33, 34, + -1, -1, 146, -1, 9, 10, 11, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, -1, 49 + 45, 46, 47, -1, 49, 9, 10, 11, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 122, 25, -1, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, -1, 49, 10, 11, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 25, -1, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 11, 49, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 25, 49, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, -1, 49, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, -1, 49, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, -1, 49 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { - 0, 150, 151, 0, 152, 3, 4, 5, 6, 7, + 0, 155, 156, 0, 157, 3, 4, 5, 6, 7, 12, 42, 43, 48, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 64, 65, 69, 70, 71, 72, 73, 75, 79, 80, 81, 82, 84, - 86, 88, 91, 95, 96, 97, 99, 100, 102, 103, - 104, 108, 109, 110, 112, 113, 114, 115, 116, 117, - 122, 123, 124, 125, 126, 127, 128, 135, 140, 142, - 143, 145, 146, 147, 153, 157, 158, 189, 190, 192, - 195, 198, 200, 246, 257, 262, 271, 274, 278, 279, - 281, 282, 290, 291, 292, 293, 294, 295, 301, 311, - 314, 278, 278, 140, 278, 278, 278, 278, 278, 278, - 278, 256, 278, 278, 278, 278, 278, 278, 278, 71, - 262, 281, 282, 281, 278, 71, 262, 263, 264, 293, - 294, 301, 140, 269, 140, 140, 242, 278, 165, 140, - 140, 140, 175, 140, 142, 278, 142, 278, 193, 142, - 246, 278, 282, 176, 278, 79, 140, 188, 73, 145, - 227, 228, 116, 116, 73, 229, 140, 140, 140, 140, - 140, 140, 307, 278, 154, 143, 307, 307, 71, 71, - 139, 9, 10, 11, 25, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 49, 142, 59, 60, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 140, 120, 61, 143, 145, 294, 278, 278, - 139, 139, 249, 120, 294, 141, 278, 278, 258, 8, - 142, 157, 163, 243, 244, 278, 246, 282, 140, 278, - 142, 142, 31, 191, 142, 142, 143, 142, 79, 142, - 143, 279, 282, 8, 142, 13, 8, 142, 186, 187, - 282, 282, 312, 282, 141, 247, 31, 278, 305, 306, - 73, 78, 136, 137, 138, 308, 141, 144, 155, 278, - 146, 147, 118, 199, 197, 71, 290, 294, 301, 252, - 278, 253, 254, 250, 251, 278, 278, 278, 278, 278, - 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - 278, 278, 278, 278, 263, 31, 278, 278, 278, 278, - 278, 278, 278, 278, 278, 278, 278, 278, 261, 283, - 278, 296, 278, 141, 71, 290, 140, 270, 265, 141, - 141, 31, 225, 226, 246, 282, 278, 82, 278, 142, - 8, 90, 90, 71, 209, 141, 71, 154, 141, 278, - 228, 42, 43, 71, 123, 271, 272, 273, 73, 8, - 141, 8, 141, 141, 142, 122, 282, 302, 303, 280, - 282, 121, 141, 8, 276, 61, 120, 72, 278, 282, - 115, 156, 157, 189, 190, 144, 71, 262, 196, 118, - 201, 140, 140, 294, 278, 278, 278, 278, 278, 63, - 282, 225, 71, 143, 290, 297, 299, 300, 148, 144, - 225, 297, 26, 159, 280, 141, 8, 140, 141, 167, - 245, 173, 171, 13, 8, 141, 170, 194, 144, 144, - 272, 272, 139, 140, 13, 187, 142, 313, 140, 8, - 141, 31, 278, 31, 278, 309, 71, 61, 144, 144, - 140, 119, 202, 203, 262, 143, 259, 260, 26, 263, - 141, 278, 298, 284, 61, 143, 141, 266, 161, 157, - 31, 246, 282, 166, 164, 243, 278, 282, 31, 205, - 282, 272, 71, 26, 157, 208, 26, 143, 210, 140, - 101, 71, 272, 275, 277, 272, 282, 304, 303, 13, - 280, 280, 121, 71, 73, 74, 310, 278, 141, 203, - 143, 8, 230, 225, 225, 255, 248, 144, 140, 288, - 296, 278, 267, 154, 160, 280, 278, 26, 157, 215, - 142, 121, 204, 282, 204, 13, 154, 142, 211, 142, - 211, 71, 123, 222, 223, 224, 140, 121, 141, 8, - 276, 302, 278, 31, 278, 148, 148, 142, 230, 262, - 98, 105, 106, 107, 108, 109, 110, 111, 144, 231, - 236, 237, 238, 239, 241, 141, 141, 278, 270, 289, - 285, 148, 144, 120, 268, 162, 216, 141, 154, 168, - 205, 141, 141, 272, 89, 211, 92, 93, 94, 211, - 144, 141, 8, 31, 73, 177, 272, 272, 141, 280, - 144, 144, 71, 232, 97, 239, 8, 142, 225, 120, - 286, 297, 218, 66, 67, 220, 142, 83, 243, 174, - 172, 142, 92, 142, 278, 26, 142, 214, 144, 143, - 224, 73, 13, 262, 121, 13, 73, 240, 233, 71, - 141, 297, 66, 67, 221, 140, 157, 142, 141, 26, - 157, 207, 207, 142, 214, 213, 154, 31, 73, 13, - 272, 178, 272, 272, 13, 8, 142, 191, 13, 287, - 140, 26, 68, 278, 169, 154, 212, 154, 144, 73, - 13, 272, 73, 272, 73, 71, 272, 288, 278, 154, - 142, 141, 26, 157, 206, 87, 154, 13, 272, 141, - 13, 234, 141, 217, 154, 142, 272, 179, 272, 140, - 26, 157, 85, 143, 222, 219, 142, 154, 141, 154, - 144, 142, 143, 235, 180, 154, 101, 181, 182, 183, - 144, 140, 183, 262, 184, 73, 141, 185, 143, 154, - 144 + 86, 88, 91, 95, 96, 97, 98, 99, 100, 101, + 103, 104, 105, 109, 110, 111, 113, 114, 115, 116, + 117, 118, 123, 124, 125, 126, 127, 128, 129, 136, + 141, 142, 143, 144, 145, 147, 148, 150, 151, 152, + 158, 159, 164, 168, 169, 199, 200, 202, 204, 207, + 209, 254, 267, 270, 279, 290, 293, 297, 298, 300, + 301, 309, 310, 311, 312, 313, 314, 315, 321, 331, + 334, 71, 111, 141, 267, 297, 297, 145, 297, 297, + 297, 297, 297, 297, 297, 265, 297, 297, 297, 297, + 297, 297, 297, 141, 144, 158, 279, 300, 301, 311, + 300, 297, 141, 144, 158, 279, 281, 282, 311, 313, + 314, 321, 145, 287, 145, 26, 250, 297, 176, 145, + 145, 145, 186, 145, 147, 297, 147, 297, 71, 71, + 147, 254, 297, 301, 187, 297, 144, 158, 162, 163, + 73, 150, 236, 237, 117, 117, 73, 238, 145, 145, + 145, 145, 145, 145, 73, 78, 137, 138, 139, 327, + 328, 144, 148, 158, 158, 297, 165, 148, 78, 288, + 327, 78, 327, 144, 145, 8, 147, 71, 71, 31, + 201, 140, 9, 10, 11, 25, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 49, 147, 59, + 60, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 145, 140, 121, 61, 148, 150, 314, + 201, 297, 297, 144, 158, 140, 140, 144, 158, 140, + 257, 140, 121, 314, 146, 297, 297, 8, 147, 168, + 174, 251, 252, 297, 254, 301, 145, 297, 147, 147, + 147, 13, 147, 147, 148, 147, 158, 90, 8, 147, + 148, 298, 301, 8, 147, 13, 8, 147, 197, 198, + 301, 301, 332, 301, 146, 255, 31, 297, 325, 326, + 61, 121, 137, 328, 72, 297, 301, 78, 137, 328, + 158, 161, 147, 148, 145, 146, 149, 166, 297, 151, + 152, 71, 271, 71, 119, 208, 206, 71, 145, 71, + 309, 314, 321, 260, 297, 261, 26, 262, 258, 259, + 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, + 297, 297, 297, 297, 297, 297, 297, 297, 297, 281, + 31, 297, 297, 297, 297, 297, 297, 297, 297, 297, + 297, 297, 297, 278, 71, 309, 302, 297, 316, 297, + 146, 158, 71, 71, 158, 309, 145, 289, 309, 283, + 146, 146, 297, 82, 297, 147, 8, 90, 90, 71, + 218, 146, 42, 43, 124, 136, 141, 144, 158, 279, + 290, 291, 292, 165, 90, 71, 163, 297, 237, 291, + 73, 8, 146, 8, 146, 146, 147, 123, 301, 322, + 323, 299, 301, 122, 146, 8, 295, 329, 71, 61, + 149, 149, 145, 156, 160, 273, 116, 167, 168, 199, + 200, 149, 31, 234, 235, 254, 301, 13, 141, 144, + 158, 280, 205, 119, 210, 203, 266, 145, 145, 314, + 297, 297, 264, 297, 297, 297, 63, 301, 234, 145, + 145, 71, 148, 309, 317, 319, 320, 153, 149, 234, + 317, 26, 170, 145, 146, 178, 253, 184, 182, 13, + 8, 146, 181, 291, 291, 145, 78, 144, 158, 140, + 149, 71, 149, 13, 198, 147, 333, 145, 8, 146, + 31, 297, 31, 297, 71, 73, 74, 330, 297, 272, + 149, 156, 234, 145, 299, 146, 8, 291, 144, 158, + 120, 211, 212, 280, 148, 145, 124, 231, 232, 233, + 280, 274, 275, 297, 26, 281, 146, 276, 277, 297, + 318, 303, 61, 148, 146, 284, 172, 168, 177, 175, + 251, 297, 301, 31, 214, 301, 291, 71, 26, 168, + 217, 26, 148, 219, 291, 294, 296, 158, 71, 102, + 291, 301, 324, 323, 13, 299, 299, 122, 153, 153, + 234, 149, 146, 146, 31, 254, 301, 158, 212, 148, + 8, 239, 231, 146, 8, 31, 73, 234, 234, 263, + 256, 234, 234, 149, 145, 307, 316, 297, 285, 165, + 171, 297, 26, 168, 224, 147, 122, 213, 301, 213, + 13, 165, 147, 220, 147, 220, 122, 146, 8, 295, + 145, 322, 297, 31, 297, 149, 146, 147, 299, 239, + 280, 99, 106, 107, 108, 109, 110, 111, 112, 149, + 240, 244, 245, 246, 247, 249, 146, 104, 268, 233, + 73, 13, 146, 146, 297, 289, 146, 146, 308, 304, + 153, 149, 121, 286, 173, 225, 146, 165, 179, 214, + 146, 146, 291, 89, 220, 92, 93, 94, 220, 149, + 291, 291, 188, 146, 299, 149, 71, 241, 267, 247, + 8, 147, 148, 145, 148, 31, 73, 13, 291, 234, + 121, 305, 317, 227, 66, 67, 229, 147, 83, 251, + 185, 183, 147, 92, 147, 297, 26, 147, 223, 149, + 122, 280, 13, 73, 248, 201, 71, 165, 31, 73, + 269, 165, 73, 13, 291, 146, 317, 66, 67, 230, + 145, 168, 147, 146, 26, 168, 216, 216, 147, 223, + 222, 291, 189, 291, 13, 8, 147, 71, 13, 149, + 73, 8, 146, 149, 13, 291, 306, 145, 26, 68, + 297, 180, 165, 221, 165, 73, 291, 73, 242, 291, + 31, 73, 291, 307, 297, 165, 147, 146, 26, 168, + 215, 87, 165, 146, 13, 145, 73, 146, 226, 165, + 147, 190, 291, 231, 26, 168, 85, 148, 146, 228, + 147, 165, 147, 148, 243, 165, 149, 165, 191, 149, + 102, 192, 193, 194, 145, 194, 280, 195, 73, 146, + 196, 148, 165, 149 }; #define yyerrok (yyerrstatus = 0) @@ -3023,7 +3357,12 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 3: + case 2: + + { zend_do_end_compilation(TSRMLS_C); } + break; + + case 3: { zend_do_extended_info(TSRMLS_C); } break; @@ -3033,1807 +3372,2062 @@ yyreduce: { HANDLE_INTERACTIVE(); } break; + case 6: + + { (yyval) = (yyvsp[(1) - (1)]); } + break; + case 7: - { zend_do_early_binding(TSRMLS_C); } + { zend_do_build_namespace_name(&(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; case 8: - { zend_do_early_binding(TSRMLS_C); } + { zend_verify_namespace(TSRMLS_C); } break; case 9: - { zend_do_halt_compiler_register(TSRMLS_C); YYACCEPT; } + { zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); } break; case 10: - { zend_do_extended_info(TSRMLS_C); } + { zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); } break; case 11: - { HANDLE_INTERACTIVE(); } + { zend_do_halt_compiler_register(TSRMLS_C); YYACCEPT; } break; - case 16: + case 12: - { zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); } + { zend_do_begin_namespace(&(yyvsp[(2) - (3)]), 0 TSRMLS_CC); } break; - case 17: + case 13: - { zend_do_ticks(TSRMLS_C); } + { zend_do_begin_namespace(&(yyvsp[(2) - (3)]), 1 TSRMLS_CC); } break; - case 19: + case 14: - { zend_do_if_cond(&(yyvsp[(3) - (4)]), &(yyvsp[(4) - (4)]) TSRMLS_CC); } + { zend_do_end_namespace(TSRMLS_C); } break; - case 20: + case 15: - { zend_do_if_after_statement(&(yyvsp[(4) - (6)]), 1 TSRMLS_CC); } + { zend_do_begin_namespace(NULL, 1 TSRMLS_CC); } + break; + + case 16: + + { zend_do_end_namespace(TSRMLS_C); } + break; + + case 17: + + { zend_verify_namespace(TSRMLS_C); } + break; + + case 18: + + { zend_verify_namespace(TSRMLS_C); } break; case 21: - { zend_do_if_end(TSRMLS_C); } + { zend_do_use(&(yyvsp[(1) - (1)]), NULL, 0 TSRMLS_CC); } break; case 22: - { zend_do_if_cond(&(yyvsp[(3) - (5)]), &(yyvsp[(4) - (5)]) TSRMLS_CC); } + { zend_do_use(&(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), 0 TSRMLS_CC); } break; case 23: - { zend_do_if_after_statement(&(yyvsp[(4) - (7)]), 1 TSRMLS_CC); } + { zend_do_use(&(yyvsp[(2) - (2)]), NULL, 1 TSRMLS_CC); } break; case 24: - { zend_do_if_end(TSRMLS_C); } + { zend_do_use(&(yyvsp[(2) - (4)]), &(yyvsp[(4) - (4)]), 1 TSRMLS_CC); } break; case 25: - { (yyvsp[(1) - (2)]).u.opline_num = get_next_op_number(CG(active_op_array)); } + { zend_do_declare_constant(&(yyvsp[(3) - (5)]), &(yyvsp[(5) - (5)]) TSRMLS_CC); } break; case 26: - { zend_do_while_cond(&(yyvsp[(4) - (5)]), &(yyvsp[(5) - (5)]) TSRMLS_CC); } + { zend_do_declare_constant(&(yyvsp[(2) - (4)]), &(yyvsp[(4) - (4)]) TSRMLS_CC); } break; case 27: - { zend_do_while_end(&(yyvsp[(1) - (7)]), &(yyvsp[(5) - (7)]) TSRMLS_CC); } + { zend_do_extended_info(TSRMLS_C); } break; case 28: - { (yyvsp[(1) - (1)]).u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } + { HANDLE_INTERACTIVE(); } break; - case 29: + case 33: - { (yyvsp[(5) - (5)]).u.opline_num = get_next_op_number(CG(active_op_array)); } + { zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); } break; - case 30: + case 34: - { zend_do_do_while_end(&(yyvsp[(1) - (9)]), &(yyvsp[(5) - (9)]), &(yyvsp[(7) - (9)]) TSRMLS_CC); } + { zend_do_ticks(TSRMLS_C); } break; - case 31: + case 35: - { zend_do_free(&(yyvsp[(3) - (4)]) TSRMLS_CC); (yyvsp[(4) - (4)]).u.opline_num = get_next_op_number(CG(active_op_array)); } + { zend_do_label(&(yyvsp[(1) - (2)]) TSRMLS_CC); } break; - case 32: + case 37: - { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(&(yyvsp[(6) - (7)]), &(yyvsp[(7) - (7)]) TSRMLS_CC); } + { zend_do_if_cond(&(yyvsp[(3) - (4)]), &(yyvsp[(4) - (4)]) TSRMLS_CC); } break; - case 33: + case 38: + + { zend_do_if_after_statement(&(yyvsp[(4) - (6)]), 1 TSRMLS_CC); } + break; + + case 39: + + { zend_do_if_end(TSRMLS_C); } + break; + + case 40: + + { zend_do_if_cond(&(yyvsp[(3) - (5)]), &(yyvsp[(4) - (5)]) TSRMLS_CC); } + break; + + case 41: + + { zend_do_if_after_statement(&(yyvsp[(4) - (7)]), 1 TSRMLS_CC); } + break; + + case 42: + + { zend_do_if_end(TSRMLS_C); } + break; + + case 43: + + { (yyvsp[(1) - (2)]).u.opline_num = get_next_op_number(CG(active_op_array)); } + break; + + case 44: + + { zend_do_while_cond(&(yyvsp[(4) - (5)]), &(yyvsp[(5) - (5)]) TSRMLS_CC); } + break; + + case 45: + + { zend_do_while_end(&(yyvsp[(1) - (7)]), &(yyvsp[(5) - (7)]) TSRMLS_CC); } + break; + + case 46: + + { (yyvsp[(1) - (1)]).u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } + break; + + case 47: + + { (yyvsp[(5) - (5)]).u.opline_num = get_next_op_number(CG(active_op_array)); } + break; + + case 48: + + { zend_do_do_while_end(&(yyvsp[(1) - (9)]), &(yyvsp[(5) - (9)]), &(yyvsp[(7) - (9)]) TSRMLS_CC); } + break; + + case 49: + + { zend_do_free(&(yyvsp[(3) - (4)]) TSRMLS_CC); (yyvsp[(4) - (4)]).u.opline_num = get_next_op_number(CG(active_op_array)); } + break; + + case 50: + + { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(&(yyvsp[(6) - (7)]), &(yyvsp[(7) - (7)]) TSRMLS_CC); } + break; + + case 51: { zend_do_free(&(yyvsp[(9) - (10)]) TSRMLS_CC); zend_do_for_before_statement(&(yyvsp[(4) - (10)]), &(yyvsp[(7) - (10)]) TSRMLS_CC); } break; - case 34: + case 52: { zend_do_for_end(&(yyvsp[(7) - (12)]) TSRMLS_CC); } break; - case 35: + case 53: { zend_do_switch_cond(&(yyvsp[(3) - (4)]) TSRMLS_CC); } break; - case 36: + case 54: { zend_do_switch_end(&(yyvsp[(6) - (6)]) TSRMLS_CC); } break; - case 37: + case 55: { zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); } break; - case 38: + case 56: { zend_do_brk_cont(ZEND_BRK, &(yyvsp[(2) - (3)]) TSRMLS_CC); } break; - case 39: + case 57: { zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); } break; - case 40: + case 58: { zend_do_brk_cont(ZEND_CONT, &(yyvsp[(2) - (3)]) TSRMLS_CC); } break; - case 41: + case 59: { zend_do_return(NULL, 0 TSRMLS_CC); } break; - case 42: + case 60: { zend_do_return(&(yyvsp[(2) - (3)]), 0 TSRMLS_CC); } break; - case 43: + case 61: { zend_do_return(&(yyvsp[(2) - (3)]), 1 TSRMLS_CC); } break; - case 47: + case 65: { zend_do_echo(&(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 48: + case 66: { zend_do_free(&(yyvsp[(1) - (2)]) TSRMLS_CC); } break; - case 49: - - { zend_error(E_COMPILE_ERROR,"use: Not yet supported. Please use include_once() or require_once()"); zval_dtor(&(yyvsp[(2) - (3)]).u.constant); } - break; - - case 51: + case 68: { zend_do_foreach_begin(&(yyvsp[(1) - (4)]), &(yyvsp[(2) - (4)]), &(yyvsp[(3) - (4)]), &(yyvsp[(4) - (4)]), 1 TSRMLS_CC); } break; - case 52: + case 69: { zend_do_foreach_cont(&(yyvsp[(1) - (8)]), &(yyvsp[(2) - (8)]), &(yyvsp[(4) - (8)]), &(yyvsp[(6) - (8)]), &(yyvsp[(7) - (8)]) TSRMLS_CC); } break; - case 53: + case 70: { zend_do_foreach_end(&(yyvsp[(1) - (10)]), &(yyvsp[(4) - (10)]) TSRMLS_CC); } break; - case 54: + case 71: { zend_do_foreach_begin(&(yyvsp[(1) - (4)]), &(yyvsp[(2) - (4)]), &(yyvsp[(3) - (4)]), &(yyvsp[(4) - (4)]), 0 TSRMLS_CC); } break; - case 55: + case 72: { zend_check_writable_variable(&(yyvsp[(6) - (8)])); zend_do_foreach_cont(&(yyvsp[(1) - (8)]), &(yyvsp[(2) - (8)]), &(yyvsp[(4) - (8)]), &(yyvsp[(6) - (8)]), &(yyvsp[(7) - (8)]) TSRMLS_CC); } break; - case 56: + case 73: { zend_do_foreach_end(&(yyvsp[(1) - (10)]), &(yyvsp[(4) - (10)]) TSRMLS_CC); } break; - case 57: + case 74: { (yyvsp[(1) - (1)]).u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } break; - case 58: + case 75: { zend_do_declare_end(&(yyvsp[(1) - (6)]) TSRMLS_CC); } break; - case 60: + case 77: { zend_do_try(&(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 61: + case 78: { zend_initialize_try_catch_element(&(yyvsp[(1) - (7)]) TSRMLS_CC); } break; - case 62: + case 79: { zend_do_first_catch(&(yyvsp[(7) - (9)]) TSRMLS_CC); } break; - case 63: + case 80: - { zend_do_begin_catch(&(yyvsp[(1) - (12)]), &(yyvsp[(9) - (12)]), &(yyvsp[(11) - (12)]), 1 TSRMLS_CC); } + { zend_do_begin_catch(&(yyvsp[(1) - (12)]), &(yyvsp[(9) - (12)]), &(yyvsp[(11) - (12)]), &(yyvsp[(7) - (12)]) TSRMLS_CC); } break; - case 64: + case 81: { zend_do_end_catch(&(yyvsp[(1) - (16)]) TSRMLS_CC); } break; - case 65: + case 82: { zend_do_mark_last_catch(&(yyvsp[(7) - (18)]), &(yyvsp[(18) - (18)]) TSRMLS_CC); } break; - case 66: + case 83: { zend_do_throw(&(yyvsp[(2) - (3)]) TSRMLS_CC); } break; - case 67: + case 84: + + { zend_do_goto(&(yyvsp[(2) - (3)]) TSRMLS_CC); } + break; + + case 85: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 68: + case 86: { (yyval).u.opline_num = -1; } break; - case 69: + case 87: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 70: + case 88: { (yyval) = (yyvsp[(2) - (2)]); } break; - case 71: + case 89: { (yyval).u.opline_num = get_next_op_number(CG(active_op_array)); } break; - case 72: + case 90: - { zend_do_begin_catch(&(yyvsp[(1) - (6)]), &(yyvsp[(3) - (6)]), &(yyvsp[(5) - (6)]), 0 TSRMLS_CC); } + { zend_do_begin_catch(&(yyvsp[(1) - (6)]), &(yyvsp[(3) - (6)]), &(yyvsp[(5) - (6)]), NULL TSRMLS_CC); } break; - case 73: + case 91: { zend_do_end_catch(&(yyvsp[(1) - (10)]) TSRMLS_CC); } break; - case 76: - - { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&(yyvsp[(1) - (1)]) TSRMLS_CC); } - break; - - case 77: - - { (yyval) = (yyvsp[(1) - (1)]); } - break; - - case 78: + case 94: - { (yyval) = (yyvsp[(2) - (3)]); } + { zend_do_end_variable_parse(&(yyvsp[(1) - (1)]), BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 79: + case 95: { zend_do_ticks(TSRMLS_C); } break; - case 80: + case 96: { zend_do_ticks(TSRMLS_C); } break; - case 81: + case 97: { (yyval).op_type = ZEND_RETURN_VAL; } break; - case 82: + case 98: { (yyval).op_type = ZEND_RETURN_REF; } break; - case 83: - - { (yyvsp[(1) - (1)]).u.opline_num = CG(zend_lineno); } - break; - - case 84: + case 99: - { zend_do_begin_function_declaration(&(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]), 0, (yyvsp[(3) - (4)]).op_type, NULL TSRMLS_CC); } + { zend_do_begin_function_declaration(&(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), 0, (yyvsp[(2) - (3)]).op_type, NULL TSRMLS_CC); } break; - case 85: + case 100: - { zend_do_end_function_declaration(&(yyvsp[(1) - (11)]) TSRMLS_CC); } + { zend_do_end_function_declaration(&(yyvsp[(1) - (10)]) TSRMLS_CC); } break; - case 86: + case 101: { zend_do_begin_class_declaration(&(yyvsp[(1) - (3)]), &(yyvsp[(2) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 87: + case 102: { zend_do_end_class_declaration(&(yyvsp[(1) - (8)]), &(yyvsp[(2) - (8)]) TSRMLS_CC); } break; - case 88: + case 103: { zend_do_begin_class_declaration(&(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]), NULL TSRMLS_CC); } break; - case 89: + case 104: { zend_do_end_class_declaration(&(yyvsp[(1) - (7)]), &(yyvsp[(2) - (7)]) TSRMLS_CC); } break; - case 90: + case 105: { (yyval).u.opline_num = CG(zend_lineno); (yyval).u.EA.type = 0; } break; - case 91: + case 106: { (yyval).u.opline_num = CG(zend_lineno); (yyval).u.EA.type = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; } break; - case 92: + case 107: { (yyval).u.opline_num = CG(zend_lineno); (yyval).u.EA.type = ZEND_ACC_FINAL_CLASS; } break; - case 93: + case 108: { (yyval).op_type = IS_UNUSED; } break; - case 94: + case 109: - { (yyval) = (yyvsp[(2) - (2)]); } + { zend_do_fetch_class(&(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 95: + case 110: { (yyval).u.opline_num = CG(zend_lineno); (yyval).u.EA.type = ZEND_ACC_INTERFACE; } break; - case 100: + case 115: { zend_do_implements_interface(&(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 101: + case 116: { zend_do_implements_interface(&(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 102: + case 117: { (yyval).op_type = IS_UNUSED; } break; - case 103: + case 118: { (yyval) = (yyvsp[(2) - (2)]); } break; - case 104: + case 119: { zend_check_writable_variable(&(yyvsp[(1) - (1)])); (yyval) = (yyvsp[(1) - (1)]); } break; - case 105: + case 120: { zend_check_writable_variable(&(yyvsp[(2) - (2)])); (yyval) = (yyvsp[(2) - (2)]); (yyval).u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; } break; - case 112: + case 127: { zend_do_declare_stmt(&(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 113: + case 128: { zend_do_declare_stmt(&(yyvsp[(3) - (5)]), &(yyvsp[(5) - (5)]) TSRMLS_CC); } break; - case 114: + case 129: { (yyval) = (yyvsp[(2) - (3)]); } break; - case 115: + case 130: { (yyval) = (yyvsp[(3) - (4)]); } break; - case 116: + case 131: { (yyval) = (yyvsp[(2) - (4)]); } break; - case 117: + case 132: { (yyval) = (yyvsp[(3) - (5)]); } break; - case 118: + case 133: { (yyval).op_type = IS_UNUSED; } break; - case 119: + case 134: { zend_do_extended_info(TSRMLS_C); zend_do_case_before_statement(&(yyvsp[(1) - (4)]), &(yyvsp[(2) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } break; - case 120: + case 135: { zend_do_case_after_statement(&(yyval), &(yyvsp[(2) - (6)]) TSRMLS_CC); (yyval).op_type = IS_CONST; } break; - case 121: + case 136: { zend_do_extended_info(TSRMLS_C); zend_do_default_before_statement(&(yyvsp[(1) - (3)]), &(yyvsp[(2) - (3)]) TSRMLS_CC); } break; - case 122: + case 137: { zend_do_case_after_statement(&(yyval), &(yyvsp[(2) - (5)]) TSRMLS_CC); (yyval).op_type = IS_CONST; } break; - case 128: + case 143: { zend_do_if_cond(&(yyvsp[(4) - (5)]), &(yyvsp[(5) - (5)]) TSRMLS_CC); } break; - case 129: + case 144: { zend_do_if_after_statement(&(yyvsp[(5) - (7)]), 0 TSRMLS_CC); } break; - case 131: + case 146: { zend_do_if_cond(&(yyvsp[(4) - (6)]), &(yyvsp[(5) - (6)]) TSRMLS_CC); } break; - case 132: + case 147: { zend_do_if_after_statement(&(yyvsp[(5) - (8)]), 0 TSRMLS_CC); } break; - case 139: + case 154: { znode tmp; fetch_simple_variable(&tmp, &(yyvsp[(2) - (2)]), 0 TSRMLS_CC); (yyval).op_type = IS_CONST; Z_LVAL((yyval).u.constant)=1; Z_TYPE((yyval).u.constant)=IS_LONG; INIT_PZVAL(&(yyval).u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &(yyval), NULL, &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]), 0 TSRMLS_CC); } break; - case 140: + case 155: { znode tmp; fetch_simple_variable(&tmp, &(yyvsp[(3) - (3)]), 0 TSRMLS_CC); (yyval).op_type = IS_CONST; Z_LVAL((yyval).u.constant)=1; Z_TYPE((yyval).u.constant)=IS_LONG; INIT_PZVAL(&(yyval).u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &(yyval), NULL, &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), 1 TSRMLS_CC); } break; - case 141: + case 156: { znode tmp; fetch_simple_variable(&tmp, &(yyvsp[(3) - (5)]), 0 TSRMLS_CC); (yyval).op_type = IS_CONST; Z_LVAL((yyval).u.constant)=1; Z_TYPE((yyval).u.constant)=IS_LONG; INIT_PZVAL(&(yyval).u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &(yyval), &(yyvsp[(5) - (5)]), &(yyvsp[(1) - (5)]), &(yyvsp[(3) - (5)]), 1 TSRMLS_CC); } break; - case 142: + case 157: { znode tmp; fetch_simple_variable(&tmp, &(yyvsp[(2) - (4)]), 0 TSRMLS_CC); (yyval).op_type = IS_CONST; Z_LVAL((yyval).u.constant)=1; Z_TYPE((yyval).u.constant)=IS_LONG; INIT_PZVAL(&(yyval).u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &(yyval), &(yyvsp[(4) - (4)]), &(yyvsp[(1) - (4)]), &(yyvsp[(2) - (4)]), 0 TSRMLS_CC); } break; - case 143: + case 158: { znode tmp; fetch_simple_variable(&tmp, &(yyvsp[(4) - (4)]), 0 TSRMLS_CC); (yyval)=(yyvsp[(1) - (4)]); Z_LVAL((yyval).u.constant)++; zend_do_receive_arg(ZEND_RECV, &tmp, &(yyval), NULL, &(yyvsp[(3) - (4)]), &(yyvsp[(4) - (4)]), 0 TSRMLS_CC); } break; - case 144: + case 159: { znode tmp; fetch_simple_variable(&tmp, &(yyvsp[(5) - (5)]), 0 TSRMLS_CC); (yyval)=(yyvsp[(1) - (5)]); Z_LVAL((yyval).u.constant)++; zend_do_receive_arg(ZEND_RECV, &tmp, &(yyval), NULL, &(yyvsp[(3) - (5)]), &(yyvsp[(5) - (5)]), 1 TSRMLS_CC); } break; - case 145: + case 160: { znode tmp; fetch_simple_variable(&tmp, &(yyvsp[(5) - (7)]), 0 TSRMLS_CC); (yyval)=(yyvsp[(1) - (7)]); Z_LVAL((yyval).u.constant)++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &(yyval), &(yyvsp[(7) - (7)]), &(yyvsp[(3) - (7)]), &(yyvsp[(5) - (7)]), 1 TSRMLS_CC); } break; - case 146: + case 161: { znode tmp; fetch_simple_variable(&tmp, &(yyvsp[(4) - (6)]), 0 TSRMLS_CC); (yyval)=(yyvsp[(1) - (6)]); Z_LVAL((yyval).u.constant)++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &(yyval), &(yyvsp[(6) - (6)]), &(yyvsp[(3) - (6)]), &(yyvsp[(4) - (6)]), 0 TSRMLS_CC); } break; - case 147: + case 162: { (yyval).op_type = IS_UNUSED; } break; - case 148: + case 163: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 149: + case 164: { (yyval).op_type = IS_CONST; Z_TYPE((yyval).u.constant)=IS_NULL;} break; - case 150: + case 165: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 151: + case 166: { Z_LVAL((yyval).u.constant) = 0; } break; - case 152: + case 167: { Z_LVAL((yyval).u.constant) = 1; zend_do_pass_param(&(yyvsp[(1) - (1)]), ZEND_SEND_VAL, Z_LVAL((yyval).u.constant) TSRMLS_CC); } break; - case 153: + case 168: { Z_LVAL((yyval).u.constant) = 1; zend_do_pass_param(&(yyvsp[(1) - (1)]), ZEND_SEND_VAR, Z_LVAL((yyval).u.constant) TSRMLS_CC); } break; - case 154: + case 169: { Z_LVAL((yyval).u.constant) = 1; zend_do_pass_param(&(yyvsp[(2) - (2)]), ZEND_SEND_REF, Z_LVAL((yyval).u.constant) TSRMLS_CC); } break; - case 155: + case 170: { Z_LVAL((yyval).u.constant)=Z_LVAL((yyvsp[(1) - (3)]).u.constant)+1; zend_do_pass_param(&(yyvsp[(3) - (3)]), ZEND_SEND_VAL, Z_LVAL((yyval).u.constant) TSRMLS_CC); } break; - case 156: + case 171: { Z_LVAL((yyval).u.constant)=Z_LVAL((yyvsp[(1) - (3)]).u.constant)+1; zend_do_pass_param(&(yyvsp[(3) - (3)]), ZEND_SEND_VAR, Z_LVAL((yyval).u.constant) TSRMLS_CC); } break; - case 157: + case 172: { Z_LVAL((yyval).u.constant)=Z_LVAL((yyvsp[(1) - (4)]).u.constant)+1; zend_do_pass_param(&(yyvsp[(4) - (4)]), ZEND_SEND_REF, Z_LVAL((yyval).u.constant) TSRMLS_CC); } break; - case 158: + case 173: { zend_do_fetch_global_variable(&(yyvsp[(3) - (3)]), NULL, ZEND_FETCH_GLOBAL_LOCK TSRMLS_CC); } break; - case 159: + case 174: { zend_do_fetch_global_variable(&(yyvsp[(1) - (1)]), NULL, ZEND_FETCH_GLOBAL_LOCK TSRMLS_CC); } break; - case 160: + case 175: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 161: + case 176: { (yyval) = (yyvsp[(2) - (2)]); } break; - case 162: + case 177: { (yyval) = (yyvsp[(3) - (4)]); } break; - case 163: + case 178: { zend_do_fetch_static_variable(&(yyvsp[(3) - (3)]), NULL, ZEND_FETCH_STATIC TSRMLS_CC); } break; - case 164: + case 179: { zend_do_fetch_static_variable(&(yyvsp[(3) - (5)]), &(yyvsp[(5) - (5)]), ZEND_FETCH_STATIC TSRMLS_CC); } break; - case 165: + case 180: { zend_do_fetch_static_variable(&(yyvsp[(1) - (1)]), NULL, ZEND_FETCH_STATIC TSRMLS_CC); } break; - case 166: + case 181: { zend_do_fetch_static_variable(&(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), ZEND_FETCH_STATIC TSRMLS_CC); } break; - case 169: + case 184: { CG(access_type) = Z_LVAL((yyvsp[(1) - (1)]).u.constant); } break; - case 172: - - { (yyvsp[(2) - (2)]).u.opline_num = CG(zend_lineno); } - break; - - case 173: + case 187: - { zend_do_begin_function_declaration(&(yyvsp[(2) - (5)]), &(yyvsp[(5) - (5)]), 1, (yyvsp[(4) - (5)]).op_type, &(yyvsp[(1) - (5)]) TSRMLS_CC); } + { zend_do_begin_function_declaration(&(yyvsp[(2) - (4)]), &(yyvsp[(4) - (4)]), 1, (yyvsp[(3) - (4)]).op_type, &(yyvsp[(1) - (4)]) TSRMLS_CC); } break; - case 174: + case 188: - { zend_do_abstract_method(&(yyvsp[(5) - (10)]), &(yyvsp[(1) - (10)]), &(yyvsp[(10) - (10)]) TSRMLS_CC); zend_do_end_function_declaration(&(yyvsp[(2) - (10)]) TSRMLS_CC); } + { zend_do_abstract_method(&(yyvsp[(4) - (9)]), &(yyvsp[(1) - (9)]), &(yyvsp[(9) - (9)]) TSRMLS_CC); zend_do_end_function_declaration(&(yyvsp[(2) - (9)]) TSRMLS_CC); } break; - case 175: + case 189: { Z_LVAL((yyval).u.constant) = ZEND_ACC_ABSTRACT; } break; - case 176: + case 190: { Z_LVAL((yyval).u.constant) = 0; } break; - case 177: + case 191: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 178: + case 192: { Z_LVAL((yyval).u.constant) = ZEND_ACC_PUBLIC; } break; - case 179: + case 193: { Z_LVAL((yyval).u.constant) = ZEND_ACC_PUBLIC; } break; - case 180: + case 194: { (yyval) = (yyvsp[(1) - (1)]); if (!(Z_LVAL((yyval).u.constant) & ZEND_ACC_PPP_MASK)) { Z_LVAL((yyval).u.constant) |= ZEND_ACC_PUBLIC; } } break; - case 181: + case 195: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 182: + case 196: { Z_LVAL((yyval).u.constant) = zend_do_verify_access_types(&(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); } break; - case 183: + case 197: { Z_LVAL((yyval).u.constant) = ZEND_ACC_PUBLIC; } break; - case 184: + case 198: { Z_LVAL((yyval).u.constant) = ZEND_ACC_PROTECTED; } break; - case 185: + case 199: { Z_LVAL((yyval).u.constant) = ZEND_ACC_PRIVATE; } break; - case 186: + case 200: { Z_LVAL((yyval).u.constant) = ZEND_ACC_STATIC; } break; - case 187: + case 201: { Z_LVAL((yyval).u.constant) = ZEND_ACC_ABSTRACT; } break; - case 188: + case 202: { Z_LVAL((yyval).u.constant) = ZEND_ACC_FINAL; } break; - case 189: + case 203: { zend_do_declare_property(&(yyvsp[(3) - (3)]), NULL, CG(access_type) TSRMLS_CC); } break; - case 190: + case 204: { zend_do_declare_property(&(yyvsp[(3) - (5)]), &(yyvsp[(5) - (5)]), CG(access_type) TSRMLS_CC); } break; - case 191: + case 205: { zend_do_declare_property(&(yyvsp[(1) - (1)]), NULL, CG(access_type) TSRMLS_CC); } break; - case 192: + case 206: { zend_do_declare_property(&(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), CG(access_type) TSRMLS_CC); } break; - case 193: + case 207: { zend_do_declare_class_constant(&(yyvsp[(3) - (5)]), &(yyvsp[(5) - (5)]) TSRMLS_CC); } break; - case 194: + case 208: { zend_do_declare_class_constant(&(yyvsp[(2) - (4)]), &(yyvsp[(4) - (4)]) TSRMLS_CC); } break; - case 195: + case 209: { zend_do_echo(&(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 196: + case 210: { zend_do_echo(&(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 197: + case 211: { (yyval).op_type = IS_CONST; Z_TYPE((yyval).u.constant) = IS_BOOL; Z_LVAL((yyval).u.constant) = 1; } break; - case 198: + case 212: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 199: + case 213: { zend_do_free(&(yyvsp[(1) - (2)]) TSRMLS_CC); } break; - case 200: + case 214: { (yyval) = (yyvsp[(4) - (4)]); } break; - case 201: + case 215: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 202: + case 216: { zend_do_list_init(TSRMLS_C); } break; - case 203: + case 217: { zend_do_list_end(&(yyval), &(yyvsp[(7) - (7)]) TSRMLS_CC); } break; - case 204: + case 218: { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_assign(&(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 205: + case 219: - { zend_check_writable_variable(&(yyvsp[(1) - (4)])); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (4)])); zend_do_end_variable_parse(&(yyvsp[(4) - (4)]), BP_VAR_W, 1 TSRMLS_CC); zend_do_end_variable_parse(&(yyvsp[(1) - (4)]), BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]) TSRMLS_CC); } break; - case 206: + case 220: - { zend_error(E_STRICT, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&(yyvsp[(1) - (5)])); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&(yyvsp[(4) - (5)]), &(yyvsp[(5) - (5)]) TSRMLS_CC); } + { zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&(yyvsp[(1) - (5)])); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&(yyvsp[(4) - (5)]), &(yyvsp[(5) - (5)]) TSRMLS_CC); } break; - case 207: + case 221: - { zend_do_end_new_object(&(yyvsp[(3) - (7)]), &(yyvsp[(4) - (7)]), &(yyvsp[(7) - (7)]) TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); (yyvsp[(3) - (7)]).u.EA.type = ZEND_PARSED_NEW; zend_do_assign_ref(&(yyval), &(yyvsp[(1) - (7)]), &(yyvsp[(3) - (7)]) TSRMLS_CC); } + { zend_do_end_new_object(&(yyvsp[(3) - (7)]), &(yyvsp[(4) - (7)]), &(yyvsp[(7) - (7)]) TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(&(yyvsp[(1) - (7)]), BP_VAR_W, 0 TSRMLS_CC); (yyvsp[(3) - (7)]).u.EA.type = ZEND_PARSED_NEW; zend_do_assign_ref(&(yyval), &(yyvsp[(1) - (7)]), &(yyvsp[(3) - (7)]) TSRMLS_CC); } break; - case 208: + case 222: { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 209: + case 223: { zend_do_end_new_object(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]) TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} break; - case 210: + case 224: { zend_do_clone(&(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 211: + case 225: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 212: + case 226: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 213: + case 227: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 214: + case 228: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 215: + case 229: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 216: + case 230: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 217: + case 231: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 218: + case 232: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 219: + case 233: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 220: + case 234: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 221: + case 235: - { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + { zend_check_writable_variable(&(yyvsp[(1) - (3)])); zend_do_end_variable_parse(&(yyvsp[(1) - (3)]), BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 222: + case 236: { zend_do_post_incdec(&(yyval), &(yyvsp[(1) - (2)]), ZEND_POST_INC TSRMLS_CC); } break; - case 223: + case 237: { zend_do_pre_incdec(&(yyval), &(yyvsp[(2) - (2)]), ZEND_PRE_INC TSRMLS_CC); } break; - case 224: + case 238: { zend_do_post_incdec(&(yyval), &(yyvsp[(1) - (2)]), ZEND_POST_DEC TSRMLS_CC); } break; - case 225: + case 239: { zend_do_pre_incdec(&(yyval), &(yyvsp[(2) - (2)]), ZEND_PRE_DEC TSRMLS_CC); } break; - case 226: + case 240: { zend_do_boolean_or_begin(&(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 227: + case 241: { zend_do_boolean_or_end(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]), &(yyvsp[(2) - (4)]) TSRMLS_CC); } break; - case 228: + case 242: { zend_do_boolean_and_begin(&(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 229: + case 243: { zend_do_boolean_and_end(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]), &(yyvsp[(2) - (4)]) TSRMLS_CC); } break; - case 230: + case 244: { zend_do_boolean_or_begin(&(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 231: + case 245: { zend_do_boolean_or_end(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]), &(yyvsp[(2) - (4)]) TSRMLS_CC); } break; - case 232: + case 246: { zend_do_boolean_and_begin(&(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 233: + case 247: { zend_do_boolean_and_end(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]), &(yyvsp[(2) - (4)]) TSRMLS_CC); } break; - case 234: + case 248: { zend_do_binary_op(ZEND_BOOL_XOR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 235: + case 249: { zend_do_binary_op(ZEND_BW_OR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 236: + case 250: { zend_do_binary_op(ZEND_BW_AND, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 237: + case 251: { zend_do_binary_op(ZEND_BW_XOR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 238: + case 252: { zend_do_binary_op(ZEND_CONCAT, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 239: + case 253: { zend_do_binary_op(ZEND_ADD, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 240: + case 254: { zend_do_binary_op(ZEND_SUB, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 241: + case 255: { zend_do_binary_op(ZEND_MUL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 242: + case 256: { zend_do_binary_op(ZEND_DIV, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 243: + case 257: { zend_do_binary_op(ZEND_MOD, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 244: + case 258: { zend_do_binary_op(ZEND_SL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 245: + case 259: { zend_do_binary_op(ZEND_SR, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 246: + case 260: - { Z_LVAL((yyvsp[(1) - (2)]).u.constant)=0; Z_TYPE((yyvsp[(1) - (2)]).u.constant)=IS_LONG; (yyvsp[(1) - (2)]).op_type = IS_CONST; INIT_PZVAL(&(yyvsp[(1) - (2)]).u.constant); zend_do_binary_op(ZEND_ADD, &(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } + { ZVAL_LONG(&(yyvsp[(1) - (2)]).u.constant, 0); if ((yyvsp[(2) - (2)]).op_type == IS_CONST) { add_function(&(yyvsp[(2) - (2)]).u.constant, &(yyvsp[(1) - (2)]).u.constant, &(yyvsp[(2) - (2)]).u.constant TSRMLS_CC); (yyval) = (yyvsp[(2) - (2)]); } else { (yyvsp[(1) - (2)]).op_type = IS_CONST; INIT_PZVAL(&(yyvsp[(1) - (2)]).u.constant); zend_do_binary_op(ZEND_ADD, &(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } } break; - case 247: + case 261: - { Z_LVAL((yyvsp[(1) - (2)]).u.constant)=0; Z_TYPE((yyvsp[(1) - (2)]).u.constant)=IS_LONG; (yyvsp[(1) - (2)]).op_type = IS_CONST; INIT_PZVAL(&(yyvsp[(1) - (2)]).u.constant); zend_do_binary_op(ZEND_SUB, &(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } + { ZVAL_LONG(&(yyvsp[(1) - (2)]).u.constant, 0); if ((yyvsp[(2) - (2)]).op_type == IS_CONST) { sub_function(&(yyvsp[(2) - (2)]).u.constant, &(yyvsp[(1) - (2)]).u.constant, &(yyvsp[(2) - (2)]).u.constant TSRMLS_CC); (yyval) = (yyvsp[(2) - (2)]); } else { (yyvsp[(1) - (2)]).op_type = IS_CONST; INIT_PZVAL(&(yyvsp[(1) - (2)]).u.constant); zend_do_binary_op(ZEND_SUB, &(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } } break; - case 248: + case 262: { zend_do_unary_op(ZEND_BOOL_NOT, &(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 249: + case 263: { zend_do_unary_op(ZEND_BW_NOT, &(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 250: + case 264: { zend_do_binary_op(ZEND_IS_IDENTICAL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 251: + case 265: { zend_do_binary_op(ZEND_IS_NOT_IDENTICAL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 252: + case 266: { zend_do_binary_op(ZEND_IS_EQUAL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 253: + case 267: { zend_do_binary_op(ZEND_IS_NOT_EQUAL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 254: + case 268: { zend_do_binary_op(ZEND_IS_SMALLER, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 255: + case 269: { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 256: + case 270: { zend_do_binary_op(ZEND_IS_SMALLER, &(yyval), &(yyvsp[(3) - (3)]), &(yyvsp[(1) - (3)]) TSRMLS_CC); } break; - case 257: + case 271: { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &(yyval), &(yyvsp[(3) - (3)]), &(yyvsp[(1) - (3)]) TSRMLS_CC); } break; - case 258: + case 272: { zend_do_instanceof(&(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), 0 TSRMLS_CC); } break; - case 259: + case 273: { (yyval) = (yyvsp[(2) - (3)]); } break; - case 260: + case 274: { zend_do_begin_qm_op(&(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 261: + case 275: { zend_do_qm_true(&(yyvsp[(4) - (5)]), &(yyvsp[(2) - (5)]), &(yyvsp[(5) - (5)]) TSRMLS_CC); } break; - case 262: + case 276: { zend_do_qm_false(&(yyval), &(yyvsp[(7) - (7)]), &(yyvsp[(2) - (7)]), &(yyvsp[(5) - (7)]) TSRMLS_CC); } break; - case 263: + case 277: + + { zend_do_jmp_set(&(yyvsp[(1) - (3)]), &(yyvsp[(2) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } + break; + + case 278: + + { zend_do_jmp_set_else(&(yyval), &(yyvsp[(5) - (5)]), &(yyvsp[(2) - (5)]), &(yyvsp[(3) - (5)]) TSRMLS_CC); } + break; + + case 279: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 264: + case 280: { zend_do_cast(&(yyval), &(yyvsp[(2) - (2)]), IS_LONG TSRMLS_CC); } break; - case 265: + case 281: { zend_do_cast(&(yyval), &(yyvsp[(2) - (2)]), IS_DOUBLE TSRMLS_CC); } break; - case 266: + case 282: { zend_do_cast(&(yyval), &(yyvsp[(2) - (2)]), IS_STRING TSRMLS_CC); } break; - case 267: + case 283: { zend_do_cast(&(yyval), &(yyvsp[(2) - (2)]), IS_ARRAY TSRMLS_CC); } break; - case 268: + case 284: { zend_do_cast(&(yyval), &(yyvsp[(2) - (2)]), IS_OBJECT TSRMLS_CC); } break; - case 269: + case 285: { zend_do_cast(&(yyval), &(yyvsp[(2) - (2)]), IS_BOOL TSRMLS_CC); } break; - case 270: + case 286: { zend_do_cast(&(yyval), &(yyvsp[(2) - (2)]), IS_NULL TSRMLS_CC); } break; - case 271: + case 287: { zend_do_exit(&(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 272: + case 288: { zend_do_begin_silence(&(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 273: + case 289: { zend_do_end_silence(&(yyvsp[(1) - (3)]) TSRMLS_CC); (yyval) = (yyvsp[(3) - (3)]); } break; - case 274: + case 290: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 275: + case 291: { (yyval) = (yyvsp[(3) - (4)]); } break; - case 276: + case 292: { zend_do_shell_exec(&(yyval), &(yyvsp[(2) - (3)]) TSRMLS_CC); } break; - case 277: + case 293: { zend_do_print(&(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 278: + case 294: - { (yyvsp[(2) - (2)]).u.opline_num = zend_do_begin_function_call(&(yyvsp[(1) - (2)]) TSRMLS_CC); } + { zend_do_begin_lambda_function_declaration(&(yyval), &(yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]).op_type TSRMLS_CC); } break; - case 279: + case 295: + + { zend_do_end_function_declaration(&(yyvsp[(1) - (10)]) TSRMLS_CC); (yyval) = (yyvsp[(4) - (10)]); } + break; + + case 296: + + { (yyval).u.opline_num = CG(zend_lineno); } + break; + + case 299: + + { zend_do_fetch_lexical_variable(&(yyvsp[(3) - (3)]), 0 TSRMLS_CC); } + break; + + case 300: + + { zend_do_fetch_lexical_variable(&(yyvsp[(4) - (4)]), 1 TSRMLS_CC); } + break; + + case 301: + + { zend_do_fetch_lexical_variable(&(yyvsp[(1) - (1)]), 0 TSRMLS_CC); } + break; + + case 302: + + { zend_do_fetch_lexical_variable(&(yyvsp[(2) - (2)]), 1 TSRMLS_CC); } + break; + + case 303: + + { (yyvsp[(2) - (2)]).u.opline_num = zend_do_begin_function_call(&(yyvsp[(1) - (2)]), 1 TSRMLS_CC); } + break; + + case 304: { zend_do_end_function_call(&(yyvsp[(1) - (5)]), &(yyval), &(yyvsp[(4) - (5)]), 0, (yyvsp[(2) - (5)]).u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } break; - case 280: + case 305: + + { (yyvsp[(1) - (4)]).op_type = IS_CONST; ZVAL_EMPTY_STRING(&(yyvsp[(1) - (4)]).u.constant); zend_do_build_namespace_name(&(yyvsp[(1) - (4)]), &(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); (yyvsp[(4) - (4)]).u.opline_num = zend_do_begin_function_call(&(yyvsp[(1) - (4)]), 0 TSRMLS_CC); } + break; + + case 306: + + { zend_do_end_function_call(&(yyvsp[(1) - (7)]), &(yyval), &(yyvsp[(6) - (7)]), 0, (yyvsp[(4) - (7)]).u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } + break; + + case 307: + + { (yyvsp[(3) - (3)]).u.opline_num = zend_do_begin_function_call(&(yyvsp[(2) - (3)]), 0 TSRMLS_CC); } + break; + + case 308: + + { zend_do_end_function_call(&(yyvsp[(2) - (6)]), &(yyval), &(yyvsp[(5) - (6)]), 0, (yyvsp[(3) - (6)]).u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } + break; + + case 309: + + { (yyvsp[(4) - (4)]).u.opline_num = zend_do_begin_class_member_function_call(&(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } + break; + + case 310: + + { zend_do_end_function_call((yyvsp[(4) - (7)]).u.opline_num?NULL:&(yyvsp[(3) - (7)]), &(yyval), &(yyvsp[(6) - (7)]), (yyvsp[(4) - (7)]).u.opline_num, (yyvsp[(4) - (7)]).u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + break; + + case 311: + + { zend_do_end_variable_parse(&(yyvsp[(3) - (4)]), BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } + break; + + case 312: + + { zend_do_end_function_call(NULL, &(yyval), &(yyvsp[(6) - (7)]), 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + break; + + case 313: { zend_do_begin_class_member_function_call(&(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } break; - case 281: + case 314: { zend_do_end_function_call(NULL, &(yyval), &(yyvsp[(6) - (7)]), 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} break; - case 282: + case 315: + + { zend_do_end_variable_parse(&(yyvsp[(3) - (4)]), BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } + break; + + case 316: + + { zend_do_end_function_call(NULL, &(yyval), &(yyvsp[(6) - (7)]), 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + break; + + case 317: + + { zend_do_end_variable_parse(&(yyvsp[(1) - (2)]), BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&(yyvsp[(1) - (2)]), 0 TSRMLS_CC); } + break; + + case 318: + + { zend_do_end_function_call(&(yyvsp[(1) - (5)]), &(yyval), &(yyvsp[(4) - (5)]), 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + break; + + case 319: + + { (yyval).op_type = IS_CONST; ZVAL_STRINGL(&(yyval).u.constant, "static", sizeof("static")-1, 1);} + break; + + case 320: + + { (yyval) = (yyvsp[(1) - (1)]); } + break; + + case 321: - { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } + { (yyval).op_type = IS_CONST; ZVAL_EMPTY_STRING(&(yyval).u.constant); zend_do_build_namespace_name(&(yyval), &(yyval), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 283: + case 322: - { zend_do_end_function_call(NULL, &(yyval), &(yyvsp[(6) - (7)]), 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + { char *tmp = estrndup(Z_STRVAL((yyvsp[(2) - (2)]).u.constant), Z_STRLEN((yyvsp[(2) - (2)]).u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL((yyvsp[(2) - (2)]).u.constant), Z_STRLEN((yyvsp[(2) - (2)]).u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL((yyvsp[(2) - (2)]).u.constant)); Z_STRVAL((yyvsp[(2) - (2)]).u.constant) = tmp; ++Z_STRLEN((yyvsp[(2) - (2)]).u.constant); (yyval) = (yyvsp[(2) - (2)]); } break; - case 284: + case 323: - { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&(yyvsp[(1) - (2)]) TSRMLS_CC); } + { (yyval) = (yyvsp[(1) - (1)]); } break; - case 285: + case 324: - { zend_do_end_function_call(&(yyvsp[(1) - (5)]), &(yyval), &(yyvsp[(4) - (5)]), 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + { (yyval).op_type = IS_CONST; ZVAL_EMPTY_STRING(&(yyval).u.constant); zend_do_build_namespace_name(&(yyval), &(yyval), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 286: + case 325: - { zend_do_fetch_class(&(yyval), &(yyvsp[(1) - (1)]) TSRMLS_CC); } + { char *tmp = estrndup(Z_STRVAL((yyvsp[(2) - (2)]).u.constant), Z_STRLEN((yyvsp[(2) - (2)]).u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL((yyvsp[(2) - (2)]).u.constant), Z_STRLEN((yyvsp[(2) - (2)]).u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL((yyvsp[(2) - (2)]).u.constant)); Z_STRVAL((yyvsp[(2) - (2)]).u.constant) = tmp; ++Z_STRLEN((yyvsp[(2) - (2)]).u.constant); (yyval) = (yyvsp[(2) - (2)]); } break; - case 287: + case 326: { zend_do_fetch_class(&(yyval), &(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 288: + case 327: - { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_fetch_class(&(yyval), &(yyvsp[(1) - (1)]) TSRMLS_CC); } + { zend_do_end_variable_parse(&(yyvsp[(1) - (1)]), BP_VAR_R, 0 TSRMLS_CC); zend_do_fetch_class(&(yyval), &(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 289: + case 328: { zend_do_push_object(&(yyvsp[(1) - (2)]) TSRMLS_CC); } break; - case 290: + case 329: { zend_do_push_object(&(yyvsp[(4) - (4)]) TSRMLS_CC); zend_do_declare_implicit_property(TSRMLS_C); } break; - case 291: + case 330: { zend_do_pop_object(&(yyval) TSRMLS_CC); (yyval).u.EA.type = ZEND_PARSED_MEMBER; } break; - case 292: + case 331: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 295: + case 334: { zend_do_push_object(&(yyvsp[(2) - (2)]) TSRMLS_CC); zend_do_declare_implicit_property(TSRMLS_C); } break; - case 296: + case 335: { memset(&(yyval), 0, sizeof(znode)); (yyval).op_type = IS_UNUSED; } break; - case 297: + case 336: { memset(&(yyval), 0, sizeof(znode)); (yyval).op_type = IS_UNUSED; } break; - case 298: + case 337: { (yyval) = (yyvsp[(2) - (3)]); } break; - case 299: + case 338: + + { ZVAL_EMPTY_STRING(&(yyval).u.constant); INIT_PZVAL(&(yyval).u.constant); (yyval).op_type = IS_CONST; } + break; + + case 339: + + { (yyval) = (yyvsp[(1) - (1)]); } + break; + + case 340: + + { (yyval) = (yyvsp[(1) - (1)]); } + break; + + case 341: { Z_LVAL((yyval).u.constant)=0; } break; - case 300: + case 342: { (yyval) = (yyvsp[(2) - (3)]); } break; - case 301: + case 343: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 302: + case 344: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 303: + case 345: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 304: + case 346: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 305: + case 347: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 306: + case 348: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 307: + case 349: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 308: + case 350: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 309: + case 351: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 310: + case 352: - { zend_do_fetch_constant(&(yyval), NULL, &(yyvsp[(1) - (1)]), ZEND_CT TSRMLS_CC); } + { (yyval) = (yyvsp[(1) - (1)]); } break; - case 311: + case 353: - { (yyval) = (yyvsp[(2) - (2)]); } + { (yyval) = (yyvsp[(2) - (3)]); } break; - case 312: + case 354: - { zval minus_one; Z_TYPE(minus_one) = IS_LONG; Z_LVAL(minus_one) = -1; mul_function(&(yyvsp[(2) - (2)]).u.constant, &(yyvsp[(2) - (2)]).u.constant, &minus_one TSRMLS_CC); (yyval) = (yyvsp[(2) - (2)]); } + { ZVAL_EMPTY_STRING(&(yyval).u.constant); INIT_PZVAL(&(yyval).u.constant); (yyval).op_type = IS_CONST; } break; - case 313: + case 355: + + { (yyval) = (yyvsp[(1) - (1)]); } + break; + + case 356: + + { zend_do_fetch_constant(&(yyval), NULL, &(yyvsp[(1) - (1)]), ZEND_CT, 1 TSRMLS_CC); } + break; + + case 357: + + { (yyval).op_type = IS_CONST; ZVAL_EMPTY_STRING(&(yyval).u.constant); zend_do_build_namespace_name(&(yyval), &(yyval), &(yyvsp[(3) - (3)]) TSRMLS_CC); (yyvsp[(3) - (3)]) = (yyval); zend_do_fetch_constant(&(yyval), NULL, &(yyvsp[(3) - (3)]), ZEND_CT, 0 TSRMLS_CC); } + break; + + case 358: + + { char *tmp = estrndup(Z_STRVAL((yyvsp[(2) - (2)]).u.constant), Z_STRLEN((yyvsp[(2) - (2)]).u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL((yyvsp[(2) - (2)]).u.constant), Z_STRLEN((yyvsp[(2) - (2)]).u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL((yyvsp[(2) - (2)]).u.constant)); Z_STRVAL((yyvsp[(2) - (2)]).u.constant) = tmp; ++Z_STRLEN((yyvsp[(2) - (2)]).u.constant); zend_do_fetch_constant(&(yyval), NULL, &(yyvsp[(2) - (2)]), ZEND_CT, 0 TSRMLS_CC); } + break; + + case 359: + + { ZVAL_LONG(&(yyvsp[(1) - (2)]).u.constant, 0); add_function(&(yyvsp[(2) - (2)]).u.constant, &(yyvsp[(1) - (2)]).u.constant, &(yyvsp[(2) - (2)]).u.constant TSRMLS_CC); (yyval) = (yyvsp[(2) - (2)]); } + break; + + case 360: + + { ZVAL_LONG(&(yyvsp[(1) - (2)]).u.constant, 0); sub_function(&(yyvsp[(2) - (2)]).u.constant, &(yyvsp[(1) - (2)]).u.constant, &(yyvsp[(2) - (2)]).u.constant TSRMLS_CC); (yyval) = (yyvsp[(2) - (2)]); } + break; + + case 361: { (yyval) = (yyvsp[(3) - (4)]); Z_TYPE((yyval).u.constant) = IS_CONSTANT_ARRAY; } break; - case 314: + case 362: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 315: + case 363: - { zend_do_fetch_constant(&(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), ZEND_CT TSRMLS_CC); } + { zend_do_fetch_constant(&(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), ZEND_CT, 0 TSRMLS_CC); } break; - case 316: + case 364: - { zend_do_fetch_constant(&(yyval), NULL, &(yyvsp[(1) - (1)]), ZEND_RT TSRMLS_CC); } + { (yyval) = (yyvsp[(1) - (1)]); } break; - case 317: + case 365: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 318: + case 366: - { (yyval) = (yyvsp[(1) - (1)]); } + { zend_do_fetch_constant(&(yyval), NULL, &(yyvsp[(1) - (1)]), ZEND_RT, 1 TSRMLS_CC); } break; - case 319: + case 367: + + { (yyval).op_type = IS_CONST; ZVAL_EMPTY_STRING(&(yyval).u.constant); zend_do_build_namespace_name(&(yyval), &(yyval), &(yyvsp[(3) - (3)]) TSRMLS_CC); (yyvsp[(3) - (3)]) = (yyval); zend_do_fetch_constant(&(yyval), NULL, &(yyvsp[(3) - (3)]), ZEND_RT, 0 TSRMLS_CC); } + break; + + case 368: + + { char *tmp = estrndup(Z_STRVAL((yyvsp[(2) - (2)]).u.constant), Z_STRLEN((yyvsp[(2) - (2)]).u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL((yyvsp[(2) - (2)]).u.constant), Z_STRLEN((yyvsp[(2) - (2)]).u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL((yyvsp[(2) - (2)]).u.constant)); Z_STRVAL((yyvsp[(2) - (2)]).u.constant) = tmp; ++Z_STRLEN((yyvsp[(2) - (2)]).u.constant); zend_do_fetch_constant(&(yyval), NULL, &(yyvsp[(2) - (2)]), ZEND_RT, 0 TSRMLS_CC); } + break; + + case 369: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 320: + case 370: { (yyval) = (yyvsp[(2) - (3)]); } break; - case 321: + case 371: { (yyval) = (yyvsp[(2) - (3)]); } break; - case 322: + case 372: { (yyval).op_type = IS_CONST; INIT_PZVAL(&(yyval).u.constant); array_init(&(yyval).u.constant); } break; - case 323: + case 373: { (yyval) = (yyvsp[(1) - (2)]); } break; - case 326: + case 376: { zend_do_add_static_array_element(&(yyval), &(yyvsp[(3) - (5)]), &(yyvsp[(5) - (5)])); } break; - case 327: + case 377: { zend_do_add_static_array_element(&(yyval), NULL, &(yyvsp[(3) - (3)])); } break; - case 328: + case 378: { (yyval).op_type = IS_CONST; INIT_PZVAL(&(yyval).u.constant); array_init(&(yyval).u.constant); zend_do_add_static_array_element(&(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); } break; - case 329: + case 379: { (yyval).op_type = IS_CONST; INIT_PZVAL(&(yyval).u.constant); array_init(&(yyval).u.constant); zend_do_add_static_array_element(&(yyval), NULL, &(yyvsp[(1) - (1)])); } break; - case 330: + case 380: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 331: + case 381: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 332: + case 382: - { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); (yyval) = (yyvsp[(1) - (1)]); } + { zend_do_end_variable_parse(&(yyvsp[(1) - (1)]), BP_VAR_R, 0 TSRMLS_CC); (yyval) = (yyvsp[(1) - (1)]); } break; - case 333: + case 383: - { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); (yyval) = (yyvsp[(1) - (1)]); - zend_check_writable_variable(&(yyvsp[(1) - (1)])); } + { zend_do_end_variable_parse(&(yyvsp[(1) - (1)]), BP_VAR_W, 0 TSRMLS_CC); (yyval) = (yyvsp[(1) - (1)]); + zend_check_writable_variable(&(yyvsp[(1) - (1)])); } break; - case 334: + case 384: - { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); (yyval) = (yyvsp[(1) - (1)]); - zend_check_writable_variable(&(yyvsp[(1) - (1)])); } + { zend_do_end_variable_parse(&(yyvsp[(1) - (1)]), BP_VAR_RW, 0 TSRMLS_CC); (yyval) = (yyvsp[(1) - (1)]); + zend_check_writable_variable(&(yyvsp[(1) - (1)])); } break; - case 335: + case 385: { zend_do_push_object(&(yyvsp[(1) - (2)]) TSRMLS_CC); } break; - case 336: + case 386: { zend_do_push_object(&(yyvsp[(4) - (4)]) TSRMLS_CC); } break; - case 337: + case 387: { zend_do_pop_object(&(yyval) TSRMLS_CC); (yyval).u.EA.type = (yyvsp[(1) - (7)]).u.EA.type | ((yyvsp[(7) - (7)]).u.EA.type ? (yyvsp[(7) - (7)]).u.EA.type : (yyvsp[(6) - (7)]).u.EA.type); } break; - case 338: + case 388: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 339: + case 389: { (yyval).u.EA.type = (yyvsp[(2) - (2)]).u.EA.type; } break; - case 340: + case 390: { (yyval).u.EA.type = 0; } break; - case 341: + case 391: { zend_do_push_object(&(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 342: + case 392: { (yyval).u.EA.type = (yyvsp[(4) - (4)]).u.EA.type; } break; - case 343: + case 393: { zend_do_pop_object(&(yyvsp[(1) - (1)]) TSRMLS_CC); zend_do_begin_method_call(&(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 344: + case 394: { zend_do_end_function_call(&(yyvsp[(1) - (4)]), &(yyval), &(yyvsp[(3) - (4)]), 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_push_object(&(yyval) TSRMLS_CC); (yyval).u.EA.type = ZEND_PARSED_METHOD_CALL; } break; - case 345: + case 395: { zend_do_declare_implicit_property(TSRMLS_C); (yyval).u.EA.type = ZEND_PARSED_MEMBER; } break; - case 346: + case 396: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 347: + case 397: { zend_do_indirect_references(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 348: + case 398: { (yyval) = (yyvsp[(3) - (3)]); zend_do_fetch_static_member(&(yyval), &(yyvsp[(1) - (3)]) TSRMLS_CC); } break; - case 349: + case 399: + + { (yyval) = (yyvsp[(3) - (3)]); zend_do_fetch_static_member(&(yyval), &(yyvsp[(1) - (3)]) TSRMLS_CC); } + break; + + case 400: + + { zend_do_end_variable_parse(&(yyvsp[(1) - (1)]), BP_VAR_R, 0 TSRMLS_CC); (yyval)=(yyvsp[(1) - (1)]);; } + break; + + case 401: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 350: + case 402: { zend_do_begin_variable_parse(TSRMLS_C); (yyval) = (yyvsp[(1) - (1)]); (yyval).u.EA.type = ZEND_PARSED_FUNCTION_CALL; } break; - case 351: + case 403: { (yyval) = (yyvsp[(1) - (1)]); (yyval).u.EA.type = ZEND_PARSED_VARIABLE; } break; - case 352: + case 404: { zend_do_indirect_references(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); (yyval).u.EA.type = ZEND_PARSED_VARIABLE; } break; - case 353: + case 405: { (yyval) = (yyvsp[(1) - (1)]); (yyval).u.EA.type = ZEND_PARSED_STATIC_MEMBER; } break; - case 354: + case 406: { fetch_array_dim(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } break; - case 355: + case 407: { fetch_string_offset(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } break; - case 356: + case 408: { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&(yyval), &(yyvsp[(1) - (1)]), 1 TSRMLS_CC); } break; - case 357: + case 409: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 358: + case 410: { (yyval) = (yyvsp[(3) - (4)]); } break; - case 359: + case 411: { (yyval).op_type = IS_UNUSED; } break; - case 360: + case 412: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 361: + case 413: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 362: + case 414: - { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); } + { zend_do_end_variable_parse(&(yyvsp[(1) - (1)]), BP_VAR_R, 0 TSRMLS_CC); } break; - case 363: + case 415: { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&(yyval), &tmp_znode, &(yyvsp[(1) - (2)]) TSRMLS_CC);} break; - case 364: + case 416: { fetch_array_dim(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } break; - case 365: + case 417: { fetch_string_offset(&(yyval), &(yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)]) TSRMLS_CC); } break; - case 366: + case 418: { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&(yyval), &tmp_znode, &(yyvsp[(1) - (1)]) TSRMLS_CC);} break; - case 367: + case 419: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 368: + case 420: { (yyval) = (yyvsp[(2) - (3)]); } break; - case 369: + case 421: { Z_LVAL((yyval).u.constant) = 1; } break; - case 370: + case 422: { Z_LVAL((yyval).u.constant)++; } break; - case 373: + case 425: { zend_do_add_list_element(&(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 374: + case 426: { zend_do_new_list_begin(TSRMLS_C); } break; - case 375: + case 427: { zend_do_new_list_end(TSRMLS_C); } break; - case 376: + case 428: { zend_do_add_list_element(NULL TSRMLS_CC); } break; - case 377: + case 429: { zend_do_init_array(&(yyval), NULL, NULL, 0 TSRMLS_CC); } break; - case 378: + case 430: { (yyval) = (yyvsp[(1) - (2)]); } break; - case 379: + case 431: { zend_do_add_array_element(&(yyval), &(yyvsp[(5) - (5)]), &(yyvsp[(3) - (5)]), 0 TSRMLS_CC); } break; - case 380: + case 432: { zend_do_add_array_element(&(yyval), &(yyvsp[(3) - (3)]), NULL, 0 TSRMLS_CC); } break; - case 381: + case 433: { zend_do_init_array(&(yyval), &(yyvsp[(3) - (3)]), &(yyvsp[(1) - (3)]), 0 TSRMLS_CC); } break; - case 382: + case 434: { zend_do_init_array(&(yyval), &(yyvsp[(1) - (1)]), NULL, 0 TSRMLS_CC); } break; - case 383: + case 435: { zend_do_add_array_element(&(yyval), &(yyvsp[(6) - (6)]), &(yyvsp[(3) - (6)]), 1 TSRMLS_CC); } break; - case 384: + case 436: { zend_do_add_array_element(&(yyval), &(yyvsp[(4) - (4)]), NULL, 1 TSRMLS_CC); } break; - case 385: + case 437: { zend_do_init_array(&(yyval), &(yyvsp[(4) - (4)]), &(yyvsp[(1) - (4)]), 1 TSRMLS_CC); } break; - case 386: + case 438: { zend_do_init_array(&(yyval), &(yyvsp[(2) - (2)]), NULL, 1 TSRMLS_CC); } break; - case 387: + case 439: - { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } + { zend_do_end_variable_parse(&(yyvsp[(2) - (2)]), BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 388: + case 440: { zend_do_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 389: + case 441: - { zend_do_init_string(&(yyval) TSRMLS_CC); } + { zend_do_end_variable_parse(&(yyvsp[(1) - (1)]), BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&(yyval), NULL, &(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 390: + case 442: + + { zend_do_add_string(&(yyval), NULL, &(yyvsp[(1) - (2)]) TSRMLS_CC); zend_do_end_variable_parse(&(yyvsp[(2) - (2)]), BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&(yyval), &(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } + break; + + case 443: { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&(yyval), &(yyvsp[(1) - (1)]), 1 TSRMLS_CC); } break; - case 391: + case 444: { zend_do_begin_variable_parse(TSRMLS_C); } break; - case 392: + case 445: { fetch_array_begin(&(yyval), &(yyvsp[(1) - (5)]), &(yyvsp[(4) - (5)]) TSRMLS_CC); } break; - case 393: + case 446: { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&(yyvsp[(2) - (3)]), &(yyvsp[(1) - (3)]), 1 TSRMLS_CC); zend_do_fetch_property(&(yyval), &(yyvsp[(2) - (3)]), &(yyvsp[(3) - (3)]) TSRMLS_CC); } break; - case 394: + case 447: { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&(yyval), &(yyvsp[(2) - (3)]), 1 TSRMLS_CC); } break; - case 395: + case 448: { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_begin(&(yyval), &(yyvsp[(2) - (6)]), &(yyvsp[(4) - (6)]) TSRMLS_CC); } break; - case 396: + case 449: { (yyval) = (yyvsp[(2) - (3)]); } break; - case 397: + case 450: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 398: + case 451: { (yyval) = (yyvsp[(1) - (1)]); } break; - case 399: + case 452: { fetch_simple_variable(&(yyval), &(yyvsp[(1) - (1)]), 1 TSRMLS_CC); } break; - case 400: + case 453: { (yyval) = (yyvsp[(3) - (4)]); } break; - case 401: + case 454: { zend_do_isset_or_isempty(ZEND_ISEMPTY, &(yyval), &(yyvsp[(3) - (4)]) TSRMLS_CC); } break; - case 402: + case 455: { zend_do_include_or_eval(ZEND_INCLUDE, &(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 403: + case 456: { zend_do_include_or_eval(ZEND_INCLUDE_ONCE, &(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 404: + case 457: { zend_do_include_or_eval(ZEND_EVAL, &(yyval), &(yyvsp[(3) - (4)]) TSRMLS_CC); } break; - case 405: + case 458: { zend_do_include_or_eval(ZEND_REQUIRE, &(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 406: + case 459: { zend_do_include_or_eval(ZEND_REQUIRE_ONCE, &(yyval), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 407: + case 460: { zend_do_isset_or_isempty(ZEND_ISSET, &(yyval), &(yyvsp[(1) - (1)]) TSRMLS_CC); } break; - case 408: + case 461: { zend_do_boolean_and_begin(&(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)]) TSRMLS_CC); } break; - case 409: + case 462: { znode tmp; zend_do_isset_or_isempty(ZEND_ISSET, &tmp, &(yyvsp[(4) - (4)]) TSRMLS_CC); zend_do_boolean_and_end(&(yyval), &(yyvsp[(1) - (4)]), &tmp, &(yyvsp[(2) - (4)]) TSRMLS_CC); } break; - case 410: + case 463: + + { zend_do_fetch_constant(&(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), ZEND_RT, 0 TSRMLS_CC); } + break; + + case 464: - { zend_do_fetch_constant(&(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), ZEND_RT TSRMLS_CC); } + { zend_do_fetch_constant(&(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), ZEND_RT, 0 TSRMLS_CC); } break; diff --git a/Zend/zend_language_parser.h b/Zend/zend_language_parser.h index e3c6c0fd3..32ff2d931 100644 --- a/Zend/zend_language_parser.h +++ b/Zend/zend_language_parser.h @@ -114,49 +114,54 @@ T_DEFAULT = 330, T_BREAK = 331, T_CONTINUE = 332, - T_FUNCTION = 333, - T_CONST = 334, - T_RETURN = 335, - T_TRY = 336, - T_CATCH = 337, - T_THROW = 338, - T_USE = 339, - T_GLOBAL = 340, - T_PUBLIC = 341, - T_PROTECTED = 342, - T_PRIVATE = 343, - T_FINAL = 344, - T_ABSTRACT = 345, - T_STATIC = 346, - T_VAR = 347, - T_UNSET = 348, - T_ISSET = 349, - T_EMPTY = 350, - T_HALT_COMPILER = 351, - T_CLASS = 352, - T_INTERFACE = 353, - T_EXTENDS = 354, - T_IMPLEMENTS = 355, - T_OBJECT_OPERATOR = 356, - T_DOUBLE_ARROW = 357, - T_LIST = 358, - T_ARRAY = 359, - T_CLASS_C = 360, - T_METHOD_C = 361, - T_FUNC_C = 362, - T_LINE = 363, - T_FILE = 364, - T_COMMENT = 365, - T_DOC_COMMENT = 366, - T_OPEN_TAG = 367, - T_OPEN_TAG_WITH_ECHO = 368, - T_CLOSE_TAG = 369, - T_WHITESPACE = 370, - T_START_HEREDOC = 371, - T_END_HEREDOC = 372, - T_DOLLAR_OPEN_CURLY_BRACES = 373, - T_CURLY_OPEN = 374, - T_PAAMAYIM_NEKUDOTAYIM = 375 + T_GOTO = 333, + T_FUNCTION = 334, + T_CONST = 335, + T_RETURN = 336, + T_TRY = 337, + T_CATCH = 338, + T_THROW = 339, + T_USE = 340, + T_GLOBAL = 341, + T_PUBLIC = 342, + T_PROTECTED = 343, + T_PRIVATE = 344, + T_FINAL = 345, + T_ABSTRACT = 346, + T_STATIC = 347, + T_VAR = 348, + T_UNSET = 349, + T_ISSET = 350, + T_EMPTY = 351, + T_HALT_COMPILER = 352, + T_CLASS = 353, + T_INTERFACE = 354, + T_EXTENDS = 355, + T_IMPLEMENTS = 356, + T_OBJECT_OPERATOR = 357, + T_DOUBLE_ARROW = 358, + T_LIST = 359, + T_ARRAY = 360, + T_CLASS_C = 361, + T_METHOD_C = 362, + T_FUNC_C = 363, + T_LINE = 364, + T_FILE = 365, + T_COMMENT = 366, + T_DOC_COMMENT = 367, + T_OPEN_TAG = 368, + T_OPEN_TAG_WITH_ECHO = 369, + T_CLOSE_TAG = 370, + T_WHITESPACE = 371, + T_START_HEREDOC = 372, + T_END_HEREDOC = 373, + T_DOLLAR_OPEN_CURLY_BRACES = 374, + T_CURLY_OPEN = 375, + T_PAAMAYIM_NEKUDOTAYIM = 376, + T_NAMESPACE = 377, + T_NS_C = 378, + T_DIR = 379, + T_NS_SEPARATOR = 380 }; #endif /* Tokens. */ @@ -235,49 +240,54 @@ #define T_DEFAULT 330 #define T_BREAK 331 #define T_CONTINUE 332 -#define T_FUNCTION 333 -#define T_CONST 334 -#define T_RETURN 335 -#define T_TRY 336 -#define T_CATCH 337 -#define T_THROW 338 -#define T_USE 339 -#define T_GLOBAL 340 -#define T_PUBLIC 341 -#define T_PROTECTED 342 -#define T_PRIVATE 343 -#define T_FINAL 344 -#define T_ABSTRACT 345 -#define T_STATIC 346 -#define T_VAR 347 -#define T_UNSET 348 -#define T_ISSET 349 -#define T_EMPTY 350 -#define T_HALT_COMPILER 351 -#define T_CLASS 352 -#define T_INTERFACE 353 -#define T_EXTENDS 354 -#define T_IMPLEMENTS 355 -#define T_OBJECT_OPERATOR 356 -#define T_DOUBLE_ARROW 357 -#define T_LIST 358 -#define T_ARRAY 359 -#define T_CLASS_C 360 -#define T_METHOD_C 361 -#define T_FUNC_C 362 -#define T_LINE 363 -#define T_FILE 364 -#define T_COMMENT 365 -#define T_DOC_COMMENT 366 -#define T_OPEN_TAG 367 -#define T_OPEN_TAG_WITH_ECHO 368 -#define T_CLOSE_TAG 369 -#define T_WHITESPACE 370 -#define T_START_HEREDOC 371 -#define T_END_HEREDOC 372 -#define T_DOLLAR_OPEN_CURLY_BRACES 373 -#define T_CURLY_OPEN 374 -#define T_PAAMAYIM_NEKUDOTAYIM 375 +#define T_GOTO 333 +#define T_FUNCTION 334 +#define T_CONST 335 +#define T_RETURN 336 +#define T_TRY 337 +#define T_CATCH 338 +#define T_THROW 339 +#define T_USE 340 +#define T_GLOBAL 341 +#define T_PUBLIC 342 +#define T_PROTECTED 343 +#define T_PRIVATE 344 +#define T_FINAL 345 +#define T_ABSTRACT 346 +#define T_STATIC 347 +#define T_VAR 348 +#define T_UNSET 349 +#define T_ISSET 350 +#define T_EMPTY 351 +#define T_HALT_COMPILER 352 +#define T_CLASS 353 +#define T_INTERFACE 354 +#define T_EXTENDS 355 +#define T_IMPLEMENTS 356 +#define T_OBJECT_OPERATOR 357 +#define T_DOUBLE_ARROW 358 +#define T_LIST 359 +#define T_ARRAY 360 +#define T_CLASS_C 361 +#define T_METHOD_C 362 +#define T_FUNC_C 363 +#define T_LINE 364 +#define T_FILE 365 +#define T_COMMENT 366 +#define T_DOC_COMMENT 367 +#define T_OPEN_TAG 368 +#define T_OPEN_TAG_WITH_ECHO 369 +#define T_CLOSE_TAG 370 +#define T_WHITESPACE 371 +#define T_START_HEREDOC 372 +#define T_END_HEREDOC 373 +#define T_DOLLAR_OPEN_CURLY_BRACES 374 +#define T_CURLY_OPEN 375 +#define T_PAAMAYIM_NEKUDOTAYIM 376 +#define T_NAMESPACE 377 +#define T_NS_C 378 +#define T_DIR 379 +#define T_NS_SEPARATOR 380 diff --git a/Zend/zend_language_parser.output b/Zend/zend_language_parser.output index 4478aca0f..71dcb30d5 100644 --- a/Zend/zend_language_parser.output +++ b/Zend/zend_language_parser.output @@ -10,7 +10,7 @@ Terminals which are not used T_WHITESPACE -State 606 conflicts: 2 shift/reduce +State 725 conflicts: 2 shift/reduce Grammar @@ -24,1115 +24,1234 @@ Grammar 3 top_statement_list: top_statement_list @1 top_statement 4 | /* empty */ - 5 top_statement: statement - 6 | function_declaration_statement - 7 | class_declaration_statement - 8 | T_HALT_COMPILER '(' ')' ';' + 5 namespace_name: T_STRING + 6 | namespace_name T_NS_SEPARATOR T_STRING - 9 @2: /* empty */ + 7 top_statement: statement + 8 | function_declaration_statement + 9 | class_declaration_statement + 10 | T_HALT_COMPILER '(' ')' ';' + 11 | T_NAMESPACE namespace_name ';' - 10 inner_statement_list: inner_statement_list @2 inner_statement - 11 | /* empty */ + 12 @2: /* empty */ - 12 inner_statement: statement - 13 | function_declaration_statement - 14 | class_declaration_statement - 15 | T_HALT_COMPILER '(' ')' ';' + 13 top_statement: T_NAMESPACE namespace_name '{' @2 top_statement_list '}' - 16 statement: unticked_statement + 14 @3: /* empty */ - 17 unticked_statement: '{' inner_statement_list '}' + 15 top_statement: T_NAMESPACE '{' @3 top_statement_list '}' + 16 | T_USE use_declarations ';' + 17 | constant_declaration ';' - 18 @3: /* empty */ + 18 use_declarations: use_declarations ',' use_declaration + 19 | use_declaration - 19 @4: /* empty */ + 20 use_declaration: namespace_name + 21 | namespace_name T_AS T_STRING + 22 | T_NS_SEPARATOR namespace_name + 23 | T_NS_SEPARATOR namespace_name T_AS T_STRING - 20 unticked_statement: T_IF '(' expr ')' @3 statement @4 elseif_list else_single + 24 constant_declaration: constant_declaration ',' T_STRING '=' static_scalar + 25 | T_CONST T_STRING '=' static_scalar - 21 @5: /* empty */ + 26 @4: /* empty */ - 22 @6: /* empty */ + 27 inner_statement_list: inner_statement_list @4 inner_statement + 28 | /* empty */ - 23 unticked_statement: T_IF '(' expr ')' ':' @5 inner_statement_list @6 new_elseif_list new_else_single T_ENDIF ';' + 29 inner_statement: statement + 30 | function_declaration_statement + 31 | class_declaration_statement + 32 | T_HALT_COMPILER '(' ')' ';' - 24 @7: /* empty */ + 33 statement: unticked_statement + 34 | T_STRING ':' - 25 @8: /* empty */ + 35 unticked_statement: '{' inner_statement_list '}' - 26 unticked_statement: T_WHILE '(' @7 expr ')' @8 while_statement + 36 @5: /* empty */ - 27 @9: /* empty */ + 37 @6: /* empty */ - 28 @10: /* empty */ + 38 unticked_statement: T_IF '(' expr ')' @5 statement @6 elseif_list else_single - 29 unticked_statement: T_DO @9 statement T_WHILE '(' @10 expr ')' ';' + 39 @7: /* empty */ - 30 @11: /* empty */ + 40 @8: /* empty */ - 31 @12: /* empty */ + 41 unticked_statement: T_IF '(' expr ')' ':' @7 inner_statement_list @8 new_elseif_list new_else_single T_ENDIF ';' - 32 @13: /* empty */ + 42 @9: /* empty */ - 33 unticked_statement: T_FOR '(' for_expr ';' @11 for_expr ';' @12 for_expr ')' @13 for_statement + 43 @10: /* empty */ - 34 @14: /* empty */ + 44 unticked_statement: T_WHILE '(' @9 expr ')' @10 while_statement - 35 unticked_statement: T_SWITCH '(' expr ')' @14 switch_case_list - 36 | T_BREAK ';' - 37 | T_BREAK expr ';' - 38 | T_CONTINUE ';' - 39 | T_CONTINUE expr ';' - 40 | T_RETURN ';' - 41 | T_RETURN expr_without_variable ';' - 42 | T_RETURN variable ';' - 43 | T_GLOBAL global_var_list ';' - 44 | T_STATIC static_var_list ';' - 45 | T_ECHO echo_expr_list ';' - 46 | T_INLINE_HTML - 47 | expr ';' - 48 | T_USE use_filename ';' - 49 | T_UNSET '(' unset_variables ')' ';' + 45 @11: /* empty */ + + 46 @12: /* empty */ + + 47 unticked_statement: T_DO @11 statement T_WHILE '(' @12 expr ')' ';' + + 48 @13: /* empty */ + + 49 @14: /* empty */ 50 @15: /* empty */ - 51 @16: /* empty */ + 51 unticked_statement: T_FOR '(' for_expr ';' @13 for_expr ';' @14 for_expr ')' @15 for_statement + + 52 @16: /* empty */ + + 53 unticked_statement: T_SWITCH '(' expr ')' @16 switch_case_list + 54 | T_BREAK ';' + 55 | T_BREAK expr ';' + 56 | T_CONTINUE ';' + 57 | T_CONTINUE expr ';' + 58 | T_RETURN ';' + 59 | T_RETURN expr_without_variable ';' + 60 | T_RETURN variable ';' + 61 | T_GLOBAL global_var_list ';' + 62 | T_STATIC static_var_list ';' + 63 | T_ECHO echo_expr_list ';' + 64 | T_INLINE_HTML + 65 | expr ';' + 66 | T_UNSET '(' unset_variables ')' ';' + + 67 @17: /* empty */ + + 68 @18: /* empty */ + + 69 unticked_statement: T_FOREACH '(' variable T_AS @17 foreach_variable foreach_optional_arg ')' @18 foreach_statement + + 70 @19: /* empty */ + + 71 @20: /* empty */ + + 72 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @19 variable foreach_optional_arg ')' @20 foreach_statement + + 73 @21: /* empty */ + + 74 unticked_statement: T_DECLARE @21 '(' declare_list ')' declare_statement + 75 | ';' + + 76 @22: /* empty */ + + 77 @23: /* empty */ - 52 unticked_statement: T_FOREACH '(' variable T_AS @15 foreach_variable foreach_optional_arg ')' @16 foreach_statement + 78 @24: /* empty */ - 53 @17: /* empty */ + 79 @25: /* empty */ - 54 @18: /* empty */ + 80 @26: /* empty */ - 55 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @17 variable foreach_optional_arg ')' @18 foreach_statement + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches + 82 | T_THROW expr ';' + 83 | T_GOTO T_STRING ';' - 56 @19: /* empty */ + 84 additional_catches: non_empty_additional_catches + 85 | /* empty */ - 57 unticked_statement: T_DECLARE @19 '(' declare_list ')' declare_statement - 58 | ';' + 86 non_empty_additional_catches: additional_catch + 87 | non_empty_additional_catches additional_catch - 59 @20: /* empty */ + 88 @27: /* empty */ - 60 @21: /* empty */ + 89 @28: /* empty */ - 61 @22: /* empty */ + 90 additional_catch: T_CATCH '(' fully_qualified_class_name @27 T_VARIABLE ')' @28 '{' inner_statement_list '}' - 62 @23: /* empty */ + 91 unset_variables: unset_variable + 92 | unset_variables ',' unset_variable - 63 @24: /* empty */ + 93 unset_variable: variable - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches - 65 | T_THROW expr ';' + 94 function_declaration_statement: unticked_function_declaration_statement - 66 additional_catches: non_empty_additional_catches - 67 | /* empty */ + 95 class_declaration_statement: unticked_class_declaration_statement - 68 non_empty_additional_catches: additional_catch - 69 | non_empty_additional_catches additional_catch + 96 is_reference: /* empty */ + 97 | '&' - 70 @25: /* empty */ + 98 @29: /* empty */ - 71 @26: /* empty */ + 99 unticked_function_declaration_statement: function is_reference T_STRING @29 '(' parameter_list ')' '{' inner_statement_list '}' - 72 additional_catch: T_CATCH '(' fully_qualified_class_name @25 T_VARIABLE ')' @26 '{' inner_statement_list '}' + 100 @30: /* empty */ - 73 unset_variables: unset_variable - 74 | unset_variables ',' unset_variable + 101 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @30 implements_list '{' class_statement_list '}' - 75 unset_variable: variable + 102 @31: /* empty */ - 76 use_filename: T_CONSTANT_ENCAPSED_STRING - 77 | '(' T_CONSTANT_ENCAPSED_STRING ')' + 103 unticked_class_declaration_statement: interface_entry T_STRING @31 interface_extends_list '{' class_statement_list '}' - 78 function_declaration_statement: unticked_function_declaration_statement + 104 class_entry_type: T_CLASS + 105 | T_ABSTRACT T_CLASS + 106 | T_FINAL T_CLASS - 79 class_declaration_statement: unticked_class_declaration_statement + 107 extends_from: /* empty */ + 108 | T_EXTENDS fully_qualified_class_name - 80 is_reference: /* empty */ - 81 | '&' + 109 interface_entry: T_INTERFACE - 82 @27: /* empty */ + 110 interface_extends_list: /* empty */ + 111 | T_EXTENDS interface_list - 83 @28: /* empty */ + 112 implements_list: /* empty */ + 113 | T_IMPLEMENTS interface_list - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference T_STRING @28 '(' parameter_list ')' '{' inner_statement_list '}' + 114 interface_list: fully_qualified_class_name + 115 | interface_list ',' fully_qualified_class_name - 85 @29: /* empty */ + 116 foreach_optional_arg: /* empty */ + 117 | T_DOUBLE_ARROW foreach_variable - 86 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @29 implements_list '{' class_statement_list '}' + 118 foreach_variable: variable + 119 | '&' variable - 87 @30: /* empty */ + 120 for_statement: statement + 121 | ':' inner_statement_list T_ENDFOR ';' - 88 unticked_class_declaration_statement: interface_entry T_STRING @30 interface_extends_list '{' class_statement_list '}' + 122 foreach_statement: statement + 123 | ':' inner_statement_list T_ENDFOREACH ';' - 89 class_entry_type: T_CLASS - 90 | T_ABSTRACT T_CLASS - 91 | T_FINAL T_CLASS + 124 declare_statement: statement + 125 | ':' inner_statement_list T_ENDDECLARE ';' - 92 extends_from: /* empty */ - 93 | T_EXTENDS fully_qualified_class_name + 126 declare_list: T_STRING '=' static_scalar + 127 | declare_list ',' T_STRING '=' static_scalar - 94 interface_entry: T_INTERFACE + 128 switch_case_list: '{' case_list '}' + 129 | '{' ';' case_list '}' + 130 | ':' case_list T_ENDSWITCH ';' + 131 | ':' ';' case_list T_ENDSWITCH ';' - 95 interface_extends_list: /* empty */ - 96 | T_EXTENDS interface_list + 132 case_list: /* empty */ - 97 implements_list: /* empty */ - 98 | T_IMPLEMENTS interface_list + 133 @32: /* empty */ - 99 interface_list: fully_qualified_class_name - 100 | interface_list ',' fully_qualified_class_name + 134 case_list: case_list T_CASE expr case_separator @32 inner_statement_list - 101 foreach_optional_arg: /* empty */ - 102 | T_DOUBLE_ARROW foreach_variable + 135 @33: /* empty */ - 103 foreach_variable: variable - 104 | '&' variable + 136 case_list: case_list T_DEFAULT case_separator @33 inner_statement_list - 105 for_statement: statement - 106 | ':' inner_statement_list T_ENDFOR ';' + 137 case_separator: ':' + 138 | ';' - 107 foreach_statement: statement - 108 | ':' inner_statement_list T_ENDFOREACH ';' + 139 while_statement: statement + 140 | ':' inner_statement_list T_ENDWHILE ';' - 109 declare_statement: statement - 110 | ':' inner_statement_list T_ENDDECLARE ';' + 141 elseif_list: /* empty */ - 111 declare_list: T_STRING '=' static_scalar - 112 | declare_list ',' T_STRING '=' static_scalar + 142 @34: /* empty */ - 113 switch_case_list: '{' case_list '}' - 114 | '{' ';' case_list '}' - 115 | ':' case_list T_ENDSWITCH ';' - 116 | ':' ';' case_list T_ENDSWITCH ';' + 143 elseif_list: elseif_list T_ELSEIF '(' expr ')' @34 statement - 117 case_list: /* empty */ + 144 new_elseif_list: /* empty */ - 118 @31: /* empty */ + 145 @35: /* empty */ - 119 case_list: case_list T_CASE expr case_separator @31 inner_statement_list + 146 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' ':' @35 inner_statement_list - 120 @32: /* empty */ + 147 else_single: /* empty */ + 148 | T_ELSE statement - 121 case_list: case_list T_DEFAULT case_separator @32 inner_statement_list + 149 new_else_single: /* empty */ + 150 | T_ELSE ':' inner_statement_list - 122 case_separator: ':' - 123 | ';' + 151 parameter_list: non_empty_parameter_list + 152 | /* empty */ - 124 while_statement: statement - 125 | ':' inner_statement_list T_ENDWHILE ';' + 153 non_empty_parameter_list: optional_class_type T_VARIABLE + 154 | optional_class_type '&' T_VARIABLE + 155 | optional_class_type '&' T_VARIABLE '=' static_scalar + 156 | optional_class_type T_VARIABLE '=' static_scalar + 157 | non_empty_parameter_list ',' optional_class_type T_VARIABLE + 158 | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE + 159 | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar + 160 | non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar - 126 elseif_list: /* empty */ + 161 optional_class_type: /* empty */ + 162 | fully_qualified_class_name + 163 | T_ARRAY - 127 @33: /* empty */ + 164 function_call_parameter_list: non_empty_function_call_parameter_list + 165 | /* empty */ - 128 elseif_list: elseif_list T_ELSEIF '(' expr ')' @33 statement + 166 non_empty_function_call_parameter_list: expr_without_variable + 167 | variable + 168 | '&' w_variable + 169 | non_empty_function_call_parameter_list ',' expr_without_variable + 170 | non_empty_function_call_parameter_list ',' variable + 171 | non_empty_function_call_parameter_list ',' '&' w_variable - 129 new_elseif_list: /* empty */ + 172 global_var_list: global_var_list ',' global_var + 173 | global_var - 130 @34: /* empty */ + 174 global_var: T_VARIABLE + 175 | '$' r_variable + 176 | '$' '{' expr '}' - 131 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' ':' @34 inner_statement_list + 177 static_var_list: static_var_list ',' T_VARIABLE + 178 | static_var_list ',' T_VARIABLE '=' static_scalar + 179 | T_VARIABLE + 180 | T_VARIABLE '=' static_scalar - 132 else_single: /* empty */ - 133 | T_ELSE statement + 181 class_statement_list: class_statement_list class_statement + 182 | /* empty */ - 134 new_else_single: /* empty */ - 135 | T_ELSE ':' inner_statement_list + 183 @36: /* empty */ - 136 parameter_list: non_empty_parameter_list - 137 | /* empty */ + 184 class_statement: variable_modifiers @36 class_variable_declaration ';' + 185 | class_constant_declaration ';' - 138 non_empty_parameter_list: optional_class_type T_VARIABLE - 139 | optional_class_type '&' T_VARIABLE - 140 | optional_class_type '&' T_VARIABLE '=' static_scalar - 141 | optional_class_type T_VARIABLE '=' static_scalar - 142 | non_empty_parameter_list ',' optional_class_type T_VARIABLE - 143 | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE - 144 | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar - 145 | non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar + 186 @37: /* empty */ - 146 optional_class_type: /* empty */ - 147 | T_STRING - 148 | T_ARRAY + 187 class_statement: method_modifiers function is_reference T_STRING @37 '(' parameter_list ')' method_body - 149 function_call_parameter_list: non_empty_function_call_parameter_list - 150 | /* empty */ + 188 method_body: ';' + 189 | '{' inner_statement_list '}' - 151 non_empty_function_call_parameter_list: expr_without_variable - 152 | variable - 153 | '&' w_variable - 154 | non_empty_function_call_parameter_list ',' expr_without_variable - 155 | non_empty_function_call_parameter_list ',' variable - 156 | non_empty_function_call_parameter_list ',' '&' w_variable + 190 variable_modifiers: non_empty_member_modifiers + 191 | T_VAR - 157 global_var_list: global_var_list ',' global_var - 158 | global_var + 192 method_modifiers: /* empty */ + 193 | non_empty_member_modifiers - 159 global_var: T_VARIABLE - 160 | '$' r_variable - 161 | '$' '{' expr '}' + 194 non_empty_member_modifiers: member_modifier + 195 | non_empty_member_modifiers member_modifier - 162 static_var_list: static_var_list ',' T_VARIABLE - 163 | static_var_list ',' T_VARIABLE '=' static_scalar - 164 | T_VARIABLE - 165 | T_VARIABLE '=' static_scalar + 196 member_modifier: T_PUBLIC + 197 | T_PROTECTED + 198 | T_PRIVATE + 199 | T_STATIC + 200 | T_ABSTRACT + 201 | T_FINAL - 166 class_statement_list: class_statement_list class_statement - 167 | /* empty */ + 202 class_variable_declaration: class_variable_declaration ',' T_VARIABLE + 203 | class_variable_declaration ',' T_VARIABLE '=' static_scalar + 204 | T_VARIABLE + 205 | T_VARIABLE '=' static_scalar - 168 @35: /* empty */ + 206 class_constant_declaration: class_constant_declaration ',' T_STRING '=' static_scalar + 207 | T_CONST T_STRING '=' static_scalar - 169 class_statement: variable_modifiers @35 class_variable_declaration ';' - 170 | class_constant_declaration ';' + 208 echo_expr_list: echo_expr_list ',' expr + 209 | expr - 171 @36: /* empty */ + 210 for_expr: /* empty */ + 211 | non_empty_for_expr - 172 @37: /* empty */ + 212 @38: /* empty */ - 173 class_statement: method_modifiers T_FUNCTION @36 is_reference T_STRING @37 '(' parameter_list ')' method_body + 213 non_empty_for_expr: non_empty_for_expr ',' @38 expr + 214 | expr - 174 method_body: ';' - 175 | '{' inner_statement_list '}' + 215 @39: /* empty */ - 176 variable_modifiers: non_empty_member_modifiers - 177 | T_VAR + 216 expr_without_variable: T_LIST '(' @39 assignment_list ')' '=' expr + 217 | variable '=' expr + 218 | variable '=' '&' variable - 178 method_modifiers: /* empty */ - 179 | non_empty_member_modifiers + 219 @40: /* empty */ - 180 non_empty_member_modifiers: member_modifier - 181 | non_empty_member_modifiers member_modifier + 220 expr_without_variable: variable '=' '&' T_NEW class_name_reference @40 ctor_arguments - 182 member_modifier: T_PUBLIC - 183 | T_PROTECTED - 184 | T_PRIVATE - 185 | T_STATIC - 186 | T_ABSTRACT - 187 | T_FINAL + 221 @41: /* empty */ - 188 class_variable_declaration: class_variable_declaration ',' T_VARIABLE - 189 | class_variable_declaration ',' T_VARIABLE '=' static_scalar - 190 | T_VARIABLE - 191 | T_VARIABLE '=' static_scalar + 222 expr_without_variable: T_NEW class_name_reference @41 ctor_arguments + 223 | T_CLONE expr + 224 | variable T_PLUS_EQUAL expr + 225 | variable T_MINUS_EQUAL expr + 226 | variable T_MUL_EQUAL expr + 227 | variable T_DIV_EQUAL expr + 228 | variable T_CONCAT_EQUAL expr + 229 | variable T_MOD_EQUAL expr + 230 | variable T_AND_EQUAL expr + 231 | variable T_OR_EQUAL expr + 232 | variable T_XOR_EQUAL expr + 233 | variable T_SL_EQUAL expr + 234 | variable T_SR_EQUAL expr + 235 | rw_variable T_INC + 236 | T_INC rw_variable + 237 | rw_variable T_DEC + 238 | T_DEC rw_variable - 192 class_constant_declaration: class_constant_declaration ',' T_STRING '=' static_scalar - 193 | T_CONST T_STRING '=' static_scalar + 239 @42: /* empty */ - 194 echo_expr_list: echo_expr_list ',' expr - 195 | expr + 240 expr_without_variable: expr T_BOOLEAN_OR @42 expr - 196 for_expr: /* empty */ - 197 | non_empty_for_expr + 241 @43: /* empty */ - 198 @38: /* empty */ + 242 expr_without_variable: expr T_BOOLEAN_AND @43 expr - 199 non_empty_for_expr: non_empty_for_expr ',' @38 expr - 200 | expr + 243 @44: /* empty */ - 201 @39: /* empty */ + 244 expr_without_variable: expr T_LOGICAL_OR @44 expr - 202 expr_without_variable: T_LIST '(' @39 assignment_list ')' '=' expr - 203 | variable '=' expr - 204 | variable '=' '&' variable + 245 @45: /* empty */ - 205 @40: /* empty */ + 246 expr_without_variable: expr T_LOGICAL_AND @45 expr + 247 | expr T_LOGICAL_XOR expr + 248 | expr '|' expr + 249 | expr '&' expr + 250 | expr '^' expr + 251 | expr '.' expr + 252 | expr '+' expr + 253 | expr '-' expr + 254 | expr '*' expr + 255 | expr '/' expr + 256 | expr '%' expr + 257 | expr T_SL expr + 258 | expr T_SR expr + 259 | '+' expr + 260 | '-' expr + 261 | '!' expr + 262 | '~' expr + 263 | expr T_IS_IDENTICAL expr + 264 | expr T_IS_NOT_IDENTICAL expr + 265 | expr T_IS_EQUAL expr + 266 | expr T_IS_NOT_EQUAL expr + 267 | expr '<' expr + 268 | expr T_IS_SMALLER_OR_EQUAL expr + 269 | expr '>' expr + 270 | expr T_IS_GREATER_OR_EQUAL expr + 271 | expr T_INSTANCEOF class_name_reference + 272 | '(' expr ')' - 206 expr_without_variable: variable '=' '&' T_NEW class_name_reference @40 ctor_arguments + 273 @46: /* empty */ - 207 @41: /* empty */ + 274 @47: /* empty */ - 208 expr_without_variable: T_NEW class_name_reference @41 ctor_arguments - 209 | T_CLONE expr - 210 | variable T_PLUS_EQUAL expr - 211 | variable T_MINUS_EQUAL expr - 212 | variable T_MUL_EQUAL expr - 213 | variable T_DIV_EQUAL expr - 214 | variable T_CONCAT_EQUAL expr - 215 | variable T_MOD_EQUAL expr - 216 | variable T_AND_EQUAL expr - 217 | variable T_OR_EQUAL expr - 218 | variable T_XOR_EQUAL expr - 219 | variable T_SL_EQUAL expr - 220 | variable T_SR_EQUAL expr - 221 | rw_variable T_INC - 222 | T_INC rw_variable - 223 | rw_variable T_DEC - 224 | T_DEC rw_variable + 275 expr_without_variable: expr '?' @46 expr ':' @47 expr - 225 @42: /* empty */ + 276 @48: /* empty */ - 226 expr_without_variable: expr T_BOOLEAN_OR @42 expr + 277 expr_without_variable: expr '?' ':' @48 expr + 278 | internal_functions_in_yacc + 279 | T_INT_CAST expr + 280 | T_DOUBLE_CAST expr + 281 | T_STRING_CAST expr + 282 | T_ARRAY_CAST expr + 283 | T_OBJECT_CAST expr + 284 | T_BOOL_CAST expr + 285 | T_UNSET_CAST expr + 286 | T_EXIT exit_expr - 227 @43: /* empty */ + 287 @49: /* empty */ - 228 expr_without_variable: expr T_BOOLEAN_AND @43 expr + 288 expr_without_variable: '@' @49 expr + 289 | scalar + 290 | T_ARRAY '(' array_pair_list ')' + 291 | '`' backticks_expr '`' + 292 | T_PRINT expr - 229 @44: /* empty */ + 293 @50: /* empty */ - 230 expr_without_variable: expr T_LOGICAL_OR @44 expr + 294 expr_without_variable: function is_reference '(' @50 parameter_list ')' lexical_vars '{' inner_statement_list '}' - 231 @45: /* empty */ + 295 function: T_FUNCTION - 232 expr_without_variable: expr T_LOGICAL_AND @45 expr - 233 | expr T_LOGICAL_XOR expr - 234 | expr '|' expr - 235 | expr '&' expr - 236 | expr '^' expr - 237 | expr '.' expr - 238 | expr '+' expr - 239 | expr '-' expr - 240 | expr '*' expr - 241 | expr '/' expr - 242 | expr '%' expr - 243 | expr T_SL expr - 244 | expr T_SR expr - 245 | '+' expr - 246 | '-' expr - 247 | '!' expr - 248 | '~' expr - 249 | expr T_IS_IDENTICAL expr - 250 | expr T_IS_NOT_IDENTICAL expr - 251 | expr T_IS_EQUAL expr - 252 | expr T_IS_NOT_EQUAL expr - 253 | expr '<' expr - 254 | expr T_IS_SMALLER_OR_EQUAL expr - 255 | expr '>' expr - 256 | expr T_IS_GREATER_OR_EQUAL expr - 257 | expr T_INSTANCEOF class_name_reference - 258 | '(' expr ')' + 296 lexical_vars: /* empty */ + 297 | T_USE '(' lexical_var_list ')' - 259 @46: /* empty */ + 298 lexical_var_list: lexical_var_list ',' T_VARIABLE + 299 | lexical_var_list ',' '&' T_VARIABLE + 300 | T_VARIABLE + 301 | '&' T_VARIABLE - 260 @47: /* empty */ + 302 @51: /* empty */ - 261 expr_without_variable: expr '?' @46 expr ':' @47 expr - 262 | internal_functions_in_yacc - 263 | T_INT_CAST expr - 264 | T_DOUBLE_CAST expr - 265 | T_STRING_CAST expr - 266 | T_ARRAY_CAST expr - 267 | T_OBJECT_CAST expr - 268 | T_BOOL_CAST expr - 269 | T_UNSET_CAST expr - 270 | T_EXIT exit_expr + 303 function_call: namespace_name '(' @51 function_call_parameter_list ')' - 271 @48: /* empty */ + 304 @52: /* empty */ - 272 expr_without_variable: '@' @48 expr - 273 | scalar - 274 | T_ARRAY '(' array_pair_list ')' - 275 | '`' encaps_list '`' - 276 | T_PRINT expr + 305 function_call: T_NAMESPACE T_NS_SEPARATOR namespace_name '(' @52 function_call_parameter_list ')' - 277 @49: /* empty */ + 306 @53: /* empty */ - 278 function_call: T_STRING '(' @49 function_call_parameter_list ')' + 307 function_call: T_NS_SEPARATOR namespace_name '(' @53 function_call_parameter_list ')' - 279 @50: /* empty */ + 308 @54: /* empty */ - 280 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @50 function_call_parameter_list ')' + 309 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @54 function_call_parameter_list ')' - 281 @51: /* empty */ + 310 @55: /* empty */ - 282 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @51 function_call_parameter_list ')' + 311 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @55 function_call_parameter_list ')' - 283 @52: /* empty */ + 312 @56: /* empty */ - 284 function_call: variable_without_objects '(' @52 function_call_parameter_list ')' + 313 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @56 function_call_parameter_list ')' - 285 fully_qualified_class_name: T_STRING + 314 @57: /* empty */ - 286 class_name_reference: T_STRING - 287 | dynamic_class_name_reference + 315 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @57 function_call_parameter_list ')' - 288 @53: /* empty */ + 316 @58: /* empty */ - 289 @54: /* empty */ + 317 function_call: variable_without_objects '(' @58 function_call_parameter_list ')' - 290 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @53 object_property @54 dynamic_class_name_variable_properties - 291 | base_variable + 318 class_name: T_STATIC + 319 | namespace_name + 320 | T_NAMESPACE T_NS_SEPARATOR namespace_name + 321 | T_NS_SEPARATOR namespace_name - 292 dynamic_class_name_variable_properties: dynamic_class_name_variable_properties dynamic_class_name_variable_property - 293 | /* empty */ + 322 fully_qualified_class_name: namespace_name + 323 | T_NAMESPACE T_NS_SEPARATOR namespace_name + 324 | T_NS_SEPARATOR namespace_name - 294 dynamic_class_name_variable_property: T_OBJECT_OPERATOR object_property + 325 class_name_reference: class_name + 326 | dynamic_class_name_reference - 295 exit_expr: /* empty */ - 296 | '(' ')' - 297 | '(' expr ')' + 327 @59: /* empty */ - 298 ctor_arguments: /* empty */ - 299 | '(' function_call_parameter_list ')' + 328 @60: /* empty */ - 300 common_scalar: T_LNUMBER - 301 | T_DNUMBER - 302 | T_CONSTANT_ENCAPSED_STRING - 303 | T_LINE - 304 | T_FILE - 305 | T_CLASS_C - 306 | T_METHOD_C - 307 | T_FUNC_C + 329 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @59 object_property @60 dynamic_class_name_variable_properties + 330 | base_variable - 308 static_scalar: common_scalar - 309 | T_STRING - 310 | '+' static_scalar - 311 | '-' static_scalar - 312 | T_ARRAY '(' static_array_pair_list ')' - 313 | static_class_constant + 331 dynamic_class_name_variable_properties: dynamic_class_name_variable_properties dynamic_class_name_variable_property + 332 | /* empty */ - 314 static_class_constant: T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING + 333 dynamic_class_name_variable_property: T_OBJECT_OPERATOR object_property - 315 scalar: T_STRING - 316 | T_STRING_VARNAME - 317 | class_constant - 318 | common_scalar - 319 | '"' encaps_list '"' - 320 | T_START_HEREDOC encaps_list T_END_HEREDOC + 334 exit_expr: /* empty */ + 335 | '(' ')' + 336 | '(' expr ')' - 321 static_array_pair_list: /* empty */ - 322 | non_empty_static_array_pair_list possible_comma + 337 backticks_expr: /* empty */ + 338 | T_ENCAPSED_AND_WHITESPACE + 339 | encaps_list - 323 possible_comma: /* empty */ - 324 | ',' + 340 ctor_arguments: /* empty */ + 341 | '(' function_call_parameter_list ')' - 325 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar - 326 | non_empty_static_array_pair_list ',' static_scalar - 327 | static_scalar T_DOUBLE_ARROW static_scalar - 328 | static_scalar + 342 common_scalar: T_LNUMBER + 343 | T_DNUMBER + 344 | T_CONSTANT_ENCAPSED_STRING + 345 | T_LINE + 346 | T_FILE + 347 | T_DIR + 348 | T_CLASS_C + 349 | T_METHOD_C + 350 | T_FUNC_C + 351 | T_NS_C + 352 | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC + 353 | T_START_HEREDOC T_END_HEREDOC - 329 expr: r_variable - 330 | expr_without_variable + 354 static_scalar: common_scalar + 355 | namespace_name + 356 | T_NAMESPACE T_NS_SEPARATOR namespace_name + 357 | T_NS_SEPARATOR namespace_name + 358 | '+' static_scalar + 359 | '-' static_scalar + 360 | T_ARRAY '(' static_array_pair_list ')' + 361 | static_class_constant - 331 r_variable: variable + 362 static_class_constant: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING - 332 w_variable: variable + 363 scalar: T_STRING_VARNAME + 364 | class_constant + 365 | namespace_name + 366 | T_NAMESPACE T_NS_SEPARATOR namespace_name + 367 | T_NS_SEPARATOR namespace_name + 368 | common_scalar + 369 | '"' encaps_list '"' + 370 | T_START_HEREDOC encaps_list T_END_HEREDOC - 333 rw_variable: variable + 371 static_array_pair_list: /* empty */ + 372 | non_empty_static_array_pair_list possible_comma - 334 @55: /* empty */ + 373 possible_comma: /* empty */ + 374 | ',' - 335 @56: /* empty */ + 375 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar + 376 | non_empty_static_array_pair_list ',' static_scalar + 377 | static_scalar T_DOUBLE_ARROW static_scalar + 378 | static_scalar - 336 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @55 object_property @56 method_or_not variable_properties - 337 | base_variable_with_function_calls + 379 expr: r_variable + 380 | expr_without_variable - 338 variable_properties: variable_properties variable_property - 339 | /* empty */ + 381 r_variable: variable - 340 @57: /* empty */ + 382 w_variable: variable - 341 variable_property: T_OBJECT_OPERATOR object_property @57 method_or_not + 383 rw_variable: variable - 342 @58: /* empty */ + 384 @61: /* empty */ - 343 method_or_not: '(' @58 function_call_parameter_list ')' - 344 | /* empty */ + 385 @62: /* empty */ - 345 variable_without_objects: reference_variable - 346 | simple_indirect_reference reference_variable + 386 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @61 object_property @62 method_or_not variable_properties + 387 | base_variable_with_function_calls - 347 static_member: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects + 388 variable_properties: variable_properties variable_property + 389 | /* empty */ - 348 base_variable_with_function_calls: base_variable - 349 | function_call + 390 @63: /* empty */ - 350 base_variable: reference_variable - 351 | simple_indirect_reference reference_variable - 352 | static_member + 391 variable_property: T_OBJECT_OPERATOR object_property @63 method_or_not - 353 reference_variable: reference_variable '[' dim_offset ']' - 354 | reference_variable '{' expr '}' - 355 | compound_variable + 392 @64: /* empty */ - 356 compound_variable: T_VARIABLE - 357 | '$' '{' expr '}' + 393 method_or_not: '(' @64 function_call_parameter_list ')' + 394 | /* empty */ - 358 dim_offset: /* empty */ - 359 | expr + 395 variable_without_objects: reference_variable + 396 | simple_indirect_reference reference_variable - 360 object_property: object_dim_list + 397 static_member: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects + 398 | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects - 361 @59: /* empty */ + 399 variable_class_name: reference_variable - 362 object_property: variable_without_objects @59 + 400 base_variable_with_function_calls: base_variable + 401 | function_call - 363 object_dim_list: object_dim_list '[' dim_offset ']' - 364 | object_dim_list '{' expr '}' - 365 | variable_name + 402 base_variable: reference_variable + 403 | simple_indirect_reference reference_variable + 404 | static_member - 366 variable_name: T_STRING - 367 | '{' expr '}' + 405 reference_variable: reference_variable '[' dim_offset ']' + 406 | reference_variable '{' expr '}' + 407 | compound_variable - 368 simple_indirect_reference: '$' - 369 | simple_indirect_reference '$' + 408 compound_variable: T_VARIABLE + 409 | '$' '{' expr '}' - 370 assignment_list: assignment_list ',' assignment_list_element - 371 | assignment_list_element + 410 dim_offset: /* empty */ + 411 | expr - 372 assignment_list_element: variable + 412 object_property: object_dim_list - 373 @60: /* empty */ + 413 @65: /* empty */ - 374 assignment_list_element: T_LIST '(' @60 assignment_list ')' - 375 | /* empty */ + 414 object_property: variable_without_objects @65 - 376 array_pair_list: /* empty */ - 377 | non_empty_array_pair_list possible_comma + 415 object_dim_list: object_dim_list '[' dim_offset ']' + 416 | object_dim_list '{' expr '}' + 417 | variable_name - 378 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr - 379 | non_empty_array_pair_list ',' expr - 380 | expr T_DOUBLE_ARROW expr - 381 | expr - 382 | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable - 383 | non_empty_array_pair_list ',' '&' w_variable - 384 | expr T_DOUBLE_ARROW '&' w_variable - 385 | '&' w_variable + 418 variable_name: T_STRING + 419 | '{' expr '}' - 386 encaps_list: encaps_list encaps_var - 387 | encaps_list T_ENCAPSED_AND_WHITESPACE - 388 | /* empty */ + 420 simple_indirect_reference: '$' + 421 | simple_indirect_reference '$' - 389 encaps_var: T_VARIABLE + 422 assignment_list: assignment_list ',' assignment_list_element + 423 | assignment_list_element - 390 @61: /* empty */ + 424 assignment_list_element: variable - 391 encaps_var: T_VARIABLE '[' @61 encaps_var_offset ']' - 392 | T_VARIABLE T_OBJECT_OPERATOR T_STRING - 393 | T_DOLLAR_OPEN_CURLY_BRACES expr '}' - 394 | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' - 395 | T_CURLY_OPEN variable '}' + 425 @66: /* empty */ - 396 encaps_var_offset: T_STRING - 397 | T_NUM_STRING - 398 | T_VARIABLE + 426 assignment_list_element: T_LIST '(' @66 assignment_list ')' + 427 | /* empty */ - 399 internal_functions_in_yacc: T_ISSET '(' isset_variables ')' - 400 | T_EMPTY '(' variable ')' - 401 | T_INCLUDE expr - 402 | T_INCLUDE_ONCE expr - 403 | T_EVAL '(' expr ')' - 404 | T_REQUIRE expr - 405 | T_REQUIRE_ONCE expr + 428 array_pair_list: /* empty */ + 429 | non_empty_array_pair_list possible_comma - 406 isset_variables: variable + 430 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr + 431 | non_empty_array_pair_list ',' expr + 432 | expr T_DOUBLE_ARROW expr + 433 | expr + 434 | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable + 435 | non_empty_array_pair_list ',' '&' w_variable + 436 | expr T_DOUBLE_ARROW '&' w_variable + 437 | '&' w_variable - 407 @62: /* empty */ + 438 encaps_list: encaps_list encaps_var + 439 | encaps_list T_ENCAPSED_AND_WHITESPACE + 440 | encaps_var + 441 | T_ENCAPSED_AND_WHITESPACE encaps_var - 408 isset_variables: isset_variables ',' @62 variable + 442 encaps_var: T_VARIABLE - 409 class_constant: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING + 443 @67: /* empty */ + + 444 encaps_var: T_VARIABLE '[' @67 encaps_var_offset ']' + 445 | T_VARIABLE T_OBJECT_OPERATOR T_STRING + 446 | T_DOLLAR_OPEN_CURLY_BRACES expr '}' + 447 | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' + 448 | T_CURLY_OPEN variable '}' + + 449 encaps_var_offset: T_STRING + 450 | T_NUM_STRING + 451 | T_VARIABLE + + 452 internal_functions_in_yacc: T_ISSET '(' isset_variables ')' + 453 | T_EMPTY '(' variable ')' + 454 | T_INCLUDE expr + 455 | T_INCLUDE_ONCE expr + 456 | T_EVAL '(' expr ')' + 457 | T_REQUIRE expr + 458 | T_REQUIRE_ONCE expr + + 459 isset_variables: variable + + 460 @68: /* empty */ + + 461 isset_variables: isset_variables ',' @68 variable + + 462 class_constant: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING + 463 | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING Terminals, with rules where they appear $end (0) 0 -'!' (33) 247 -'"' (34) 319 -'$' (36) 160 161 357 368 369 -'%' (37) 242 -'&' (38) 81 104 139 140 143 144 153 156 204 206 235 382 383 384 385 -'(' (40) 8 15 20 23 26 29 33 35 49 52 55 57 64 72 77 84 128 131 173 - 202 258 274 278 280 282 284 296 297 299 312 343 374 399 400 403 -')' (41) 8 15 20 23 26 29 33 35 49 52 55 57 64 72 77 84 128 131 173 - 202 258 274 278 280 282 284 296 297 299 312 343 374 399 400 403 -'*' (42) 240 -'+' (43) 238 245 310 -',' (44) 74 100 112 142 143 144 145 154 155 156 157 162 163 188 189 - 192 194 199 324 325 326 370 378 379 382 383 408 -'-' (45) 239 246 311 -'.' (46) 237 -'/' (47) 241 -':' (58) 23 106 108 110 115 116 122 125 131 135 261 -';' (59) 8 15 23 29 33 36 37 38 39 40 41 42 43 44 45 47 48 49 58 65 - 106 108 110 114 115 116 123 125 169 170 174 -'<' (60) 253 -'=' (61) 111 112 140 141 144 145 163 165 189 191 192 193 202 203 204 - 206 -'>' (62) 255 -'?' (63) 261 -'@' (64) 272 -'[' (91) 353 363 391 394 -']' (93) 353 363 391 394 -'^' (94) 236 -'`' (96) 275 -'{' (123) 17 64 72 84 86 88 113 114 161 175 354 357 364 367 -'|' (124) 234 -'}' (125) 17 64 72 84 86 88 113 114 161 175 354 357 364 367 393 394 - 395 -'~' (126) 248 +'!' (33) 261 +'"' (34) 369 +'$' (36) 175 176 409 420 421 +'%' (37) 256 +'&' (38) 97 119 154 155 158 159 168 171 218 220 249 299 301 434 435 + 436 437 +'(' (40) 10 32 38 41 44 47 51 53 66 69 72 74 81 90 99 143 146 187 216 + 272 290 294 297 303 305 307 309 311 313 315 317 335 336 341 360 + 393 426 452 453 456 +')' (41) 10 32 38 41 44 47 51 53 66 69 72 74 81 90 99 143 146 187 216 + 272 290 294 297 303 305 307 309 311 313 315 317 335 336 341 360 + 393 426 452 453 456 +'*' (42) 254 +'+' (43) 252 259 358 +',' (44) 18 24 92 115 127 157 158 159 160 169 170 171 172 177 178 202 + 203 206 208 213 298 299 374 375 376 422 430 431 434 435 461 +'-' (45) 253 260 359 +'.' (46) 251 +'/' (47) 255 +':' (58) 34 41 121 123 125 130 131 137 140 146 150 275 277 +';' (59) 10 11 16 17 32 41 47 51 54 55 56 57 58 59 60 61 62 63 65 66 + 75 82 83 121 123 125 129 130 131 138 140 184 185 188 +'<' (60) 267 +'=' (61) 24 25 126 127 155 156 159 160 178 180 203 205 206 207 216 + 217 218 220 +'>' (62) 269 +'?' (63) 275 277 +'@' (64) 288 +'[' (91) 405 415 444 447 +']' (93) 405 415 444 447 +'^' (94) 250 +'`' (96) 291 +'{' (123) 13 15 35 81 90 99 101 103 128 129 176 189 294 406 409 416 + 419 +'|' (124) 248 +'}' (125) 13 15 35 81 90 99 101 103 128 129 176 189 294 406 409 416 + 419 446 447 448 +'~' (126) 262 error (256) -T_REQUIRE_ONCE (258) 405 -T_REQUIRE (259) 404 -T_EVAL (260) 403 -T_INCLUDE_ONCE (261) 402 -T_INCLUDE (262) 401 -T_LOGICAL_OR (263) 230 -T_LOGICAL_XOR (264) 233 -T_LOGICAL_AND (265) 232 -T_PRINT (266) 276 -T_SR_EQUAL (267) 220 -T_SL_EQUAL (268) 219 -T_XOR_EQUAL (269) 218 -T_OR_EQUAL (270) 217 -T_AND_EQUAL (271) 216 -T_MOD_EQUAL (272) 215 -T_CONCAT_EQUAL (273) 214 -T_DIV_EQUAL (274) 213 -T_MUL_EQUAL (275) 212 -T_MINUS_EQUAL (276) 211 -T_PLUS_EQUAL (277) 210 -T_BOOLEAN_OR (278) 226 -T_BOOLEAN_AND (279) 228 -T_IS_NOT_IDENTICAL (280) 250 -T_IS_IDENTICAL (281) 249 -T_IS_NOT_EQUAL (282) 252 -T_IS_EQUAL (283) 251 -T_IS_GREATER_OR_EQUAL (284) 256 -T_IS_SMALLER_OR_EQUAL (285) 254 -T_SR (286) 244 -T_SL (287) 243 -T_INSTANCEOF (288) 257 -T_UNSET_CAST (289) 269 -T_BOOL_CAST (290) 268 -T_OBJECT_CAST (291) 267 -T_ARRAY_CAST (292) 266 -T_STRING_CAST (293) 265 -T_DOUBLE_CAST (294) 264 -T_INT_CAST (295) 263 -T_DEC (296) 223 224 -T_INC (297) 221 222 -T_CLONE (298) 209 -T_NEW (299) 206 208 -T_EXIT (300) 270 -T_IF (301) 20 23 -T_ELSEIF (302) 128 131 -T_ELSE (303) 133 135 -T_ENDIF (304) 23 -T_LNUMBER (305) 300 -T_DNUMBER (306) 301 -T_STRING (307) 84 86 88 111 112 147 173 192 193 278 280 285 286 309 - 314 315 366 392 396 409 -T_STRING_VARNAME (308) 316 394 -T_VARIABLE (309) 64 72 138 139 140 141 142 143 144 145 159 162 163 - 164 165 188 189 190 191 356 389 391 392 398 -T_NUM_STRING (310) 397 -T_INLINE_HTML (311) 46 +T_REQUIRE_ONCE (258) 458 +T_REQUIRE (259) 457 +T_EVAL (260) 456 +T_INCLUDE_ONCE (261) 455 +T_INCLUDE (262) 454 +T_LOGICAL_OR (263) 244 +T_LOGICAL_XOR (264) 247 +T_LOGICAL_AND (265) 246 +T_PRINT (266) 292 +T_SR_EQUAL (267) 234 +T_SL_EQUAL (268) 233 +T_XOR_EQUAL (269) 232 +T_OR_EQUAL (270) 231 +T_AND_EQUAL (271) 230 +T_MOD_EQUAL (272) 229 +T_CONCAT_EQUAL (273) 228 +T_DIV_EQUAL (274) 227 +T_MUL_EQUAL (275) 226 +T_MINUS_EQUAL (276) 225 +T_PLUS_EQUAL (277) 224 +T_BOOLEAN_OR (278) 240 +T_BOOLEAN_AND (279) 242 +T_IS_NOT_IDENTICAL (280) 264 +T_IS_IDENTICAL (281) 263 +T_IS_NOT_EQUAL (282) 266 +T_IS_EQUAL (283) 265 +T_IS_GREATER_OR_EQUAL (284) 270 +T_IS_SMALLER_OR_EQUAL (285) 268 +T_SR (286) 258 +T_SL (287) 257 +T_INSTANCEOF (288) 271 +T_UNSET_CAST (289) 285 +T_BOOL_CAST (290) 284 +T_OBJECT_CAST (291) 283 +T_ARRAY_CAST (292) 282 +T_STRING_CAST (293) 281 +T_DOUBLE_CAST (294) 280 +T_INT_CAST (295) 279 +T_DEC (296) 237 238 +T_INC (297) 235 236 +T_CLONE (298) 223 +T_NEW (299) 220 222 +T_EXIT (300) 286 +T_IF (301) 38 41 +T_ELSEIF (302) 143 146 +T_ELSE (303) 148 150 +T_ENDIF (304) 41 +T_LNUMBER (305) 342 +T_DNUMBER (306) 343 +T_STRING (307) 5 6 21 23 24 25 34 83 99 101 103 126 127 187 206 207 + 309 313 362 418 445 449 462 463 +T_STRING_VARNAME (308) 363 447 +T_VARIABLE (309) 81 90 153 154 155 156 157 158 159 160 174 177 178 + 179 180 202 203 204 205 298 299 300 301 408 442 444 445 451 +T_NUM_STRING (310) 450 +T_INLINE_HTML (311) 64 T_CHARACTER (312) T_BAD_CHARACTER (313) -T_ENCAPSED_AND_WHITESPACE (314) 387 -T_CONSTANT_ENCAPSED_STRING (315) 76 77 302 -T_ECHO (316) 45 -T_DO (317) 29 -T_WHILE (318) 26 29 -T_ENDWHILE (319) 125 -T_FOR (320) 33 -T_ENDFOR (321) 106 -T_FOREACH (322) 52 55 -T_ENDFOREACH (323) 108 -T_DECLARE (324) 57 -T_ENDDECLARE (325) 110 -T_AS (326) 52 55 -T_SWITCH (327) 35 -T_ENDSWITCH (328) 115 116 -T_CASE (329) 119 -T_DEFAULT (330) 121 -T_BREAK (331) 36 37 -T_CONTINUE (332) 38 39 -T_FUNCTION (333) 84 173 -T_CONST (334) 193 -T_RETURN (335) 40 41 42 -T_TRY (336) 64 -T_CATCH (337) 64 72 -T_THROW (338) 65 -T_USE (339) 48 -T_GLOBAL (340) 43 -T_PUBLIC (341) 182 -T_PROTECTED (342) 183 -T_PRIVATE (343) 184 -T_FINAL (344) 91 187 -T_ABSTRACT (345) 90 186 -T_STATIC (346) 44 185 -T_VAR (347) 177 -T_UNSET (348) 49 -T_ISSET (349) 399 -T_EMPTY (350) 400 -T_HALT_COMPILER (351) 8 15 -T_CLASS (352) 89 90 91 -T_INTERFACE (353) 94 -T_EXTENDS (354) 93 96 -T_IMPLEMENTS (355) 98 -T_OBJECT_OPERATOR (356) 290 294 336 341 392 -T_DOUBLE_ARROW (357) 102 325 327 378 380 382 384 -T_LIST (358) 202 374 -T_ARRAY (359) 148 274 312 -T_CLASS_C (360) 305 -T_METHOD_C (361) 306 -T_FUNC_C (362) 307 -T_LINE (363) 303 -T_FILE (364) 304 -T_COMMENT (365) -T_DOC_COMMENT (366) -T_OPEN_TAG (367) -T_OPEN_TAG_WITH_ECHO (368) -T_CLOSE_TAG (369) -T_WHITESPACE (370) -T_START_HEREDOC (371) 320 -T_END_HEREDOC (372) 320 -T_DOLLAR_OPEN_CURLY_BRACES (373) 393 394 -T_CURLY_OPEN (374) 395 -T_PAAMAYIM_NEKUDOTAYIM (375) 280 282 314 347 409 +T_ENCAPSED_AND_WHITESPACE (314) 338 352 439 441 +T_CONSTANT_ENCAPSED_STRING (315) 344 +T_ECHO (316) 63 +T_DO (317) 47 +T_WHILE (318) 44 47 +T_ENDWHILE (319) 140 +T_FOR (320) 51 +T_ENDFOR (321) 121 +T_FOREACH (322) 69 72 +T_ENDFOREACH (323) 123 +T_DECLARE (324) 74 +T_ENDDECLARE (325) 125 +T_AS (326) 21 23 69 72 +T_SWITCH (327) 53 +T_ENDSWITCH (328) 130 131 +T_CASE (329) 134 +T_DEFAULT (330) 136 +T_BREAK (331) 54 55 +T_CONTINUE (332) 56 57 +T_GOTO (333) 83 +T_FUNCTION (334) 295 +T_CONST (335) 25 207 +T_RETURN (336) 58 59 60 +T_TRY (337) 81 +T_CATCH (338) 81 90 +T_THROW (339) 82 +T_USE (340) 16 297 +T_GLOBAL (341) 61 +T_PUBLIC (342) 196 +T_PROTECTED (343) 197 +T_PRIVATE (344) 198 +T_FINAL (345) 106 201 +T_ABSTRACT (346) 105 200 +T_STATIC (347) 62 199 318 +T_VAR (348) 191 +T_UNSET (349) 66 +T_ISSET (350) 452 +T_EMPTY (351) 453 +T_HALT_COMPILER (352) 10 32 +T_CLASS (353) 104 105 106 +T_INTERFACE (354) 109 +T_EXTENDS (355) 108 111 +T_IMPLEMENTS (356) 113 +T_OBJECT_OPERATOR (357) 329 333 386 391 445 +T_DOUBLE_ARROW (358) 117 375 377 430 432 434 436 +T_LIST (359) 216 426 +T_ARRAY (360) 163 290 360 +T_CLASS_C (361) 348 +T_METHOD_C (362) 349 +T_FUNC_C (363) 350 +T_LINE (364) 345 +T_FILE (365) 346 +T_COMMENT (366) +T_DOC_COMMENT (367) +T_OPEN_TAG (368) +T_OPEN_TAG_WITH_ECHO (369) +T_CLOSE_TAG (370) +T_WHITESPACE (371) +T_START_HEREDOC (372) 352 353 370 +T_END_HEREDOC (373) 352 353 370 +T_DOLLAR_OPEN_CURLY_BRACES (374) 446 447 +T_CURLY_OPEN (375) 448 +T_PAAMAYIM_NEKUDOTAYIM (376) 309 311 313 315 362 397 398 462 463 +T_NAMESPACE (377) 11 13 15 305 320 323 356 366 +T_NS_C (378) 351 +T_DIR (379) 347 +T_NS_SEPARATOR (380) 6 22 23 305 307 320 321 323 324 356 357 366 367 Nonterminals, with rules where they appear -$accept (149) +$accept (154) on left: 0 -start (150) +start (155) on left: 1, on right: 0 -top_statement_list (151) - on left: 3 4, on right: 1 3 -@1 (152) +top_statement_list (156) + on left: 3 4, on right: 1 3 13 15 +@1 (157) on left: 2, on right: 3 -top_statement (153) - on left: 5 6 7 8, on right: 3 -inner_statement_list (154) - on left: 10 11, on right: 10 17 23 64 72 84 106 108 110 119 121 - 125 131 135 175 -@2 (155) - on left: 9, on right: 10 -inner_statement (156) - on left: 12 13 14 15, on right: 10 -statement (157) - on left: 16, on right: 5 12 20 29 105 107 109 124 128 133 -unticked_statement (158) - on left: 17 20 23 26 29 33 35 36 37 38 39 40 41 42 43 44 45 46 - 47 48 49 52 55 57 58 64 65, on right: 16 -@3 (159) - on left: 18, on right: 20 -@4 (160) - on left: 19, on right: 20 -@5 (161) - on left: 21, on right: 23 -@6 (162) - on left: 22, on right: 23 -@7 (163) - on left: 24, on right: 26 -@8 (164) - on left: 25, on right: 26 -@9 (165) - on left: 27, on right: 29 -@10 (166) - on left: 28, on right: 29 -@11 (167) - on left: 30, on right: 33 -@12 (168) - on left: 31, on right: 33 -@13 (169) - on left: 32, on right: 33 -@14 (170) - on left: 34, on right: 35 -@15 (171) - on left: 50, on right: 52 -@16 (172) - on left: 51, on right: 52 -@17 (173) - on left: 53, on right: 55 -@18 (174) - on left: 54, on right: 55 -@19 (175) - on left: 56, on right: 57 -@20 (176) - on left: 59, on right: 64 -@21 (177) - on left: 60, on right: 64 -@22 (178) - on left: 61, on right: 64 -@23 (179) - on left: 62, on right: 64 -@24 (180) - on left: 63, on right: 64 -additional_catches (181) - on left: 66 67, on right: 64 -non_empty_additional_catches (182) - on left: 68 69, on right: 66 69 -additional_catch (183) - on left: 72, on right: 68 69 -@25 (184) +namespace_name (158) + on left: 5 6, on right: 6 11 13 20 21 22 23 303 305 307 319 320 + 321 322 323 324 355 356 357 365 366 367 +top_statement (159) + on left: 7 8 9 10 11 13 15 16 17, on right: 3 +@2 (160) + on left: 12, on right: 13 +@3 (161) + on left: 14, on right: 15 +use_declarations (162) + on left: 18 19, on right: 16 18 +use_declaration (163) + on left: 20 21 22 23, on right: 18 19 +constant_declaration (164) + on left: 24 25, on right: 17 24 +inner_statement_list (165) + on left: 27 28, on right: 27 35 41 81 90 99 121 123 125 134 136 + 140 146 150 189 294 +@4 (166) + on left: 26, on right: 27 +inner_statement (167) + on left: 29 30 31 32, on right: 27 +statement (168) + on left: 33 34, on right: 7 29 38 47 120 122 124 139 143 148 +unticked_statement (169) + on left: 35 38 41 44 47 51 53 54 55 56 57 58 59 60 61 62 63 64 + 65 66 69 72 74 75 81 82 83, on right: 33 +@5 (170) + on left: 36, on right: 38 +@6 (171) + on left: 37, on right: 38 +@7 (172) + on left: 39, on right: 41 +@8 (173) + on left: 40, on right: 41 +@9 (174) + on left: 42, on right: 44 +@10 (175) + on left: 43, on right: 44 +@11 (176) + on left: 45, on right: 47 +@12 (177) + on left: 46, on right: 47 +@13 (178) + on left: 48, on right: 51 +@14 (179) + on left: 49, on right: 51 +@15 (180) + on left: 50, on right: 51 +@16 (181) + on left: 52, on right: 53 +@17 (182) + on left: 67, on right: 69 +@18 (183) + on left: 68, on right: 69 +@19 (184) on left: 70, on right: 72 -@26 (185) +@20 (185) on left: 71, on right: 72 -unset_variables (186) - on left: 73 74, on right: 49 74 -unset_variable (187) - on left: 75, on right: 73 74 -use_filename (188) - on left: 76 77, on right: 48 -function_declaration_statement (189) - on left: 78, on right: 6 13 -class_declaration_statement (190) - on left: 79, on right: 7 14 -is_reference (191) - on left: 80 81, on right: 84 173 -unticked_function_declaration_statement (192) - on left: 84, on right: 78 -@27 (193) - on left: 82, on right: 84 -@28 (194) - on left: 83, on right: 84 -unticked_class_declaration_statement (195) - on left: 86 88, on right: 79 -@29 (196) - on left: 85, on right: 86 -@30 (197) - on left: 87, on right: 88 -class_entry_type (198) - on left: 89 90 91, on right: 86 -extends_from (199) - on left: 92 93, on right: 86 -interface_entry (200) - on left: 94, on right: 88 -interface_extends_list (201) - on left: 95 96, on right: 88 -implements_list (202) - on left: 97 98, on right: 86 -interface_list (203) - on left: 99 100, on right: 96 98 100 -foreach_optional_arg (204) - on left: 101 102, on right: 52 55 -foreach_variable (205) - on left: 103 104, on right: 52 102 -for_statement (206) - on left: 105 106, on right: 33 -foreach_statement (207) - on left: 107 108, on right: 52 55 -declare_statement (208) - on left: 109 110, on right: 57 -declare_list (209) - on left: 111 112, on right: 57 112 -switch_case_list (210) - on left: 113 114 115 116, on right: 35 -case_list (211) - on left: 117 119 121, on right: 113 114 115 116 119 121 -@31 (212) - on left: 118, on right: 119 -@32 (213) - on left: 120, on right: 121 -case_separator (214) - on left: 122 123, on right: 119 121 -while_statement (215) - on left: 124 125, on right: 26 -elseif_list (216) - on left: 126 128, on right: 20 128 -@33 (217) - on left: 127, on right: 128 -new_elseif_list (218) - on left: 129 131, on right: 23 131 -@34 (219) - on left: 130, on right: 131 -else_single (220) - on left: 132 133, on right: 20 -new_else_single (221) - on left: 134 135, on right: 23 -parameter_list (222) - on left: 136 137, on right: 84 173 -non_empty_parameter_list (223) - on left: 138 139 140 141 142 143 144 145, on right: 136 142 143 - 144 145 -optional_class_type (224) - on left: 146 147 148, on right: 138 139 140 141 142 143 144 145 -function_call_parameter_list (225) - on left: 149 150, on right: 278 280 282 284 299 343 -non_empty_function_call_parameter_list (226) - on left: 151 152 153 154 155 156, on right: 149 154 155 156 -global_var_list (227) - on left: 157 158, on right: 43 157 -global_var (228) - on left: 159 160 161, on right: 157 158 -static_var_list (229) - on left: 162 163 164 165, on right: 44 162 163 -class_statement_list (230) - on left: 166 167, on right: 86 88 166 -class_statement (231) - on left: 169 170 173, on right: 166 -@35 (232) - on left: 168, on right: 169 -@36 (233) - on left: 171, on right: 173 -@37 (234) - on left: 172, on right: 173 -method_body (235) - on left: 174 175, on right: 173 -variable_modifiers (236) - on left: 176 177, on right: 169 -method_modifiers (237) - on left: 178 179, on right: 173 -non_empty_member_modifiers (238) - on left: 180 181, on right: 176 179 181 -member_modifier (239) - on left: 182 183 184 185 186 187, on right: 180 181 -class_variable_declaration (240) - on left: 188 189 190 191, on right: 169 188 189 -class_constant_declaration (241) - on left: 192 193, on right: 170 192 -echo_expr_list (242) - on left: 194 195, on right: 45 194 -for_expr (243) - on left: 196 197, on right: 33 -non_empty_for_expr (244) - on left: 199 200, on right: 197 199 -@38 (245) - on left: 198, on right: 199 -expr_without_variable (246) - on left: 202 203 204 206 208 209 210 211 212 213 214 215 216 217 - 218 219 220 221 222 223 224 226 228 230 232 233 234 235 236 237 - 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 - 254 255 256 257 258 261 262 263 264 265 266 267 268 269 270 272 - 273 274 275 276, on right: 41 55 151 154 330 -@39 (247) - on left: 201, on right: 202 -@40 (248) - on left: 205, on right: 206 -@41 (249) - on left: 207, on right: 208 -@42 (250) - on left: 225, on right: 226 -@43 (251) - on left: 227, on right: 228 -@44 (252) - on left: 229, on right: 230 -@45 (253) - on left: 231, on right: 232 -@46 (254) - on left: 259, on right: 261 -@47 (255) - on left: 260, on right: 261 -@48 (256) - on left: 271, on right: 272 -function_call (257) - on left: 278 280 282 284, on right: 349 -@49 (258) - on left: 277, on right: 278 -@50 (259) - on left: 279, on right: 280 -@51 (260) - on left: 281, on right: 282 -@52 (261) - on left: 283, on right: 284 -fully_qualified_class_name (262) - on left: 285, on right: 64 72 93 99 100 280 282 347 409 -class_name_reference (263) - on left: 286 287, on right: 206 208 257 -dynamic_class_name_reference (264) - on left: 290 291, on right: 287 -@53 (265) - on left: 288, on right: 290 -@54 (266) - on left: 289, on right: 290 -dynamic_class_name_variable_properties (267) - on left: 292 293, on right: 290 292 -dynamic_class_name_variable_property (268) - on left: 294, on right: 292 -exit_expr (269) - on left: 295 296 297, on right: 270 -ctor_arguments (270) - on left: 298 299, on right: 206 208 -common_scalar (271) - on left: 300 301 302 303 304 305 306 307, on right: 308 318 -static_scalar (272) - on left: 308 309 310 311 312 313, on right: 111 112 140 141 144 - 145 163 165 189 191 192 193 310 311 325 326 327 328 -static_class_constant (273) - on left: 314, on right: 313 -scalar (274) - on left: 315 316 317 318 319 320, on right: 273 -static_array_pair_list (275) - on left: 321 322, on right: 312 -possible_comma (276) - on left: 323 324, on right: 322 377 -non_empty_static_array_pair_list (277) - on left: 325 326 327 328, on right: 322 325 326 -expr (278) - on left: 329 330, on right: 20 23 26 29 35 37 39 47 65 119 128 - 131 161 194 195 199 200 202 203 209 210 211 212 213 214 215 216 - 217 218 219 220 226 228 230 232 233 234 235 236 237 238 239 240 - 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 - 257 258 261 263 264 265 266 267 268 269 272 276 297 354 357 359 - 364 367 378 379 380 381 382 384 393 394 401 402 403 404 405 -r_variable (279) - on left: 331, on right: 160 329 -w_variable (280) - on left: 332, on right: 153 156 382 383 384 385 -rw_variable (281) - on left: 333, on right: 221 222 223 224 -variable (282) - on left: 336 337, on right: 42 52 55 75 103 104 152 155 203 204 - 206 210 211 212 213 214 215 216 217 218 219 220 331 332 333 372 - 395 400 406 408 -@55 (283) - on left: 334, on right: 336 -@56 (284) - on left: 335, on right: 336 -variable_properties (285) - on left: 338 339, on right: 336 338 -variable_property (286) - on left: 341, on right: 338 -@57 (287) - on left: 340, on right: 341 -method_or_not (288) - on left: 343 344, on right: 336 341 -@58 (289) - on left: 342, on right: 343 -variable_without_objects (290) - on left: 345 346, on right: 282 284 347 362 -static_member (291) - on left: 347, on right: 352 -base_variable_with_function_calls (292) - on left: 348 349, on right: 336 337 -base_variable (293) - on left: 350 351 352, on right: 290 291 348 -reference_variable (294) - on left: 353 354 355, on right: 345 346 350 351 353 354 -compound_variable (295) - on left: 356 357, on right: 355 -dim_offset (296) - on left: 358 359, on right: 353 363 -object_property (297) - on left: 360 362, on right: 290 294 336 341 -@59 (298) - on left: 361, on right: 362 -object_dim_list (299) - on left: 363 364 365, on right: 360 363 364 -variable_name (300) - on left: 366 367, on right: 365 -simple_indirect_reference (301) - on left: 368 369, on right: 346 351 369 -assignment_list (302) - on left: 370 371, on right: 202 370 374 -assignment_list_element (303) - on left: 372 374 375, on right: 370 371 -@60 (304) - on left: 373, on right: 374 -array_pair_list (305) - on left: 376 377, on right: 274 -non_empty_array_pair_list (306) - on left: 378 379 380 381 382 383 384 385, on right: 377 378 379 - 382 383 -encaps_list (307) - on left: 386 387 388, on right: 275 319 320 386 387 -encaps_var (308) - on left: 389 391 392 393 394 395, on right: 386 -@61 (309) +@21 (186) + on left: 73, on right: 74 +@22 (187) + on left: 76, on right: 81 +@23 (188) + on left: 77, on right: 81 +@24 (189) + on left: 78, on right: 81 +@25 (190) + on left: 79, on right: 81 +@26 (191) + on left: 80, on right: 81 +additional_catches (192) + on left: 84 85, on right: 81 +non_empty_additional_catches (193) + on left: 86 87, on right: 84 87 +additional_catch (194) + on left: 90, on right: 86 87 +@27 (195) + on left: 88, on right: 90 +@28 (196) + on left: 89, on right: 90 +unset_variables (197) + on left: 91 92, on right: 66 92 +unset_variable (198) + on left: 93, on right: 91 92 +function_declaration_statement (199) + on left: 94, on right: 8 30 +class_declaration_statement (200) + on left: 95, on right: 9 31 +is_reference (201) + on left: 96 97, on right: 99 187 294 +unticked_function_declaration_statement (202) + on left: 99, on right: 94 +@29 (203) + on left: 98, on right: 99 +unticked_class_declaration_statement (204) + on left: 101 103, on right: 95 +@30 (205) + on left: 100, on right: 101 +@31 (206) + on left: 102, on right: 103 +class_entry_type (207) + on left: 104 105 106, on right: 101 +extends_from (208) + on left: 107 108, on right: 101 +interface_entry (209) + on left: 109, on right: 103 +interface_extends_list (210) + on left: 110 111, on right: 103 +implements_list (211) + on left: 112 113, on right: 101 +interface_list (212) + on left: 114 115, on right: 111 113 115 +foreach_optional_arg (213) + on left: 116 117, on right: 69 72 +foreach_variable (214) + on left: 118 119, on right: 69 117 +for_statement (215) + on left: 120 121, on right: 51 +foreach_statement (216) + on left: 122 123, on right: 69 72 +declare_statement (217) + on left: 124 125, on right: 74 +declare_list (218) + on left: 126 127, on right: 74 127 +switch_case_list (219) + on left: 128 129 130 131, on right: 53 +case_list (220) + on left: 132 134 136, on right: 128 129 130 131 134 136 +@32 (221) + on left: 133, on right: 134 +@33 (222) + on left: 135, on right: 136 +case_separator (223) + on left: 137 138, on right: 134 136 +while_statement (224) + on left: 139 140, on right: 44 +elseif_list (225) + on left: 141 143, on right: 38 143 +@34 (226) + on left: 142, on right: 143 +new_elseif_list (227) + on left: 144 146, on right: 41 146 +@35 (228) + on left: 145, on right: 146 +else_single (229) + on left: 147 148, on right: 38 +new_else_single (230) + on left: 149 150, on right: 41 +parameter_list (231) + on left: 151 152, on right: 99 187 294 +non_empty_parameter_list (232) + on left: 153 154 155 156 157 158 159 160, on right: 151 157 158 + 159 160 +optional_class_type (233) + on left: 161 162 163, on right: 153 154 155 156 157 158 159 160 +function_call_parameter_list (234) + on left: 164 165, on right: 303 305 307 309 311 313 315 317 341 + 393 +non_empty_function_call_parameter_list (235) + on left: 166 167 168 169 170 171, on right: 164 169 170 171 +global_var_list (236) + on left: 172 173, on right: 61 172 +global_var (237) + on left: 174 175 176, on right: 172 173 +static_var_list (238) + on left: 177 178 179 180, on right: 62 177 178 +class_statement_list (239) + on left: 181 182, on right: 101 103 181 +class_statement (240) + on left: 184 185 187, on right: 181 +@36 (241) + on left: 183, on right: 184 +@37 (242) + on left: 186, on right: 187 +method_body (243) + on left: 188 189, on right: 187 +variable_modifiers (244) + on left: 190 191, on right: 184 +method_modifiers (245) + on left: 192 193, on right: 187 +non_empty_member_modifiers (246) + on left: 194 195, on right: 190 193 195 +member_modifier (247) + on left: 196 197 198 199 200 201, on right: 194 195 +class_variable_declaration (248) + on left: 202 203 204 205, on right: 184 202 203 +class_constant_declaration (249) + on left: 206 207, on right: 185 206 +echo_expr_list (250) + on left: 208 209, on right: 63 208 +for_expr (251) + on left: 210 211, on right: 51 +non_empty_for_expr (252) + on left: 213 214, on right: 211 213 +@38 (253) + on left: 212, on right: 213 +expr_without_variable (254) + on left: 216 217 218 220 222 223 224 225 226 227 228 229 230 231 + 232 233 234 235 236 237 238 240 242 244 246 247 248 249 250 251 + 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 + 268 269 270 271 272 275 277 278 279 280 281 282 283 284 285 286 + 288 289 290 291 292 294, on right: 59 72 166 169 380 +@39 (255) + on left: 215, on right: 216 +@40 (256) + on left: 219, on right: 220 +@41 (257) + on left: 221, on right: 222 +@42 (258) + on left: 239, on right: 240 +@43 (259) + on left: 241, on right: 242 +@44 (260) + on left: 243, on right: 244 +@45 (261) + on left: 245, on right: 246 +@46 (262) + on left: 273, on right: 275 +@47 (263) + on left: 274, on right: 275 +@48 (264) + on left: 276, on right: 277 +@49 (265) + on left: 287, on right: 288 +@50 (266) + on left: 293, on right: 294 +function (267) + on left: 295, on right: 99 187 294 +lexical_vars (268) + on left: 296 297, on right: 294 +lexical_var_list (269) + on left: 298 299 300 301, on right: 297 298 299 +function_call (270) + on left: 303 305 307 309 311 313 315 317, on right: 401 +@51 (271) + on left: 302, on right: 303 +@52 (272) + on left: 304, on right: 305 +@53 (273) + on left: 306, on right: 307 +@54 (274) + on left: 308, on right: 309 +@55 (275) + on left: 310, on right: 311 +@56 (276) + on left: 312, on right: 313 +@57 (277) + on left: 314, on right: 315 +@58 (278) + on left: 316, on right: 317 +class_name (279) + on left: 318 319 320 321, on right: 309 311 325 362 397 462 +fully_qualified_class_name (280) + on left: 322 323 324, on right: 81 90 108 114 115 162 +class_name_reference (281) + on left: 325 326, on right: 220 222 271 +dynamic_class_name_reference (282) + on left: 329 330, on right: 326 +@59 (283) + on left: 327, on right: 329 +@60 (284) + on left: 328, on right: 329 +dynamic_class_name_variable_properties (285) + on left: 331 332, on right: 329 331 +dynamic_class_name_variable_property (286) + on left: 333, on right: 331 +exit_expr (287) + on left: 334 335 336, on right: 286 +backticks_expr (288) + on left: 337 338 339, on right: 291 +ctor_arguments (289) + on left: 340 341, on right: 220 222 +common_scalar (290) + on left: 342 343 344 345 346 347 348 349 350 351 352 353, + on right: 354 368 +static_scalar (291) + on left: 354 355 356 357 358 359 360 361, on right: 24 25 126 127 + 155 156 159 160 178 180 203 205 206 207 358 359 375 376 377 378 +static_class_constant (292) + on left: 362, on right: 361 +scalar (293) + on left: 363 364 365 366 367 368 369 370, on right: 289 +static_array_pair_list (294) + on left: 371 372, on right: 360 +possible_comma (295) + on left: 373 374, on right: 372 429 +non_empty_static_array_pair_list (296) + on left: 375 376 377 378, on right: 372 375 376 +expr (297) + on left: 379 380, on right: 38 41 44 47 53 55 57 65 82 134 143 + 146 176 208 209 213 214 216 217 223 224 225 226 227 228 229 230 + 231 232 233 234 240 242 244 246 247 248 249 250 251 252 253 254 + 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 + 271 272 275 277 279 280 281 282 283 284 285 288 292 336 406 409 + 411 416 419 430 431 432 433 434 436 446 447 454 455 456 457 458 +r_variable (298) + on left: 381, on right: 175 379 +w_variable (299) + on left: 382, on right: 168 171 434 435 436 437 +rw_variable (300) + on left: 383, on right: 235 236 237 238 +variable (301) + on left: 386 387, on right: 60 69 72 93 118 119 167 170 217 218 + 220 224 225 226 227 228 229 230 231 232 233 234 381 382 383 424 + 448 453 459 461 +@61 (302) + on left: 384, on right: 386 +@62 (303) + on left: 385, on right: 386 +variable_properties (304) + on left: 388 389, on right: 386 388 +variable_property (305) + on left: 391, on right: 388 +@63 (306) on left: 390, on right: 391 -encaps_var_offset (310) - on left: 396 397 398, on right: 391 -internal_functions_in_yacc (311) - on left: 399 400 401 402 403 404 405, on right: 262 -isset_variables (312) - on left: 406 408, on right: 399 408 -@62 (313) - on left: 407, on right: 408 -class_constant (314) - on left: 409, on right: 317 +method_or_not (307) + on left: 393 394, on right: 386 391 +@64 (308) + on left: 392, on right: 393 +variable_without_objects (309) + on left: 395 396, on right: 311 315 317 397 398 414 +static_member (310) + on left: 397 398, on right: 404 +variable_class_name (311) + on left: 399, on right: 313 315 398 463 +base_variable_with_function_calls (312) + on left: 400 401, on right: 386 387 +base_variable (313) + on left: 402 403 404, on right: 329 330 400 +reference_variable (314) + on left: 405 406 407, on right: 395 396 399 402 403 405 406 +compound_variable (315) + on left: 408 409, on right: 407 +dim_offset (316) + on left: 410 411, on right: 405 415 +object_property (317) + on left: 412 414, on right: 329 333 386 391 +@65 (318) + on left: 413, on right: 414 +object_dim_list (319) + on left: 415 416 417, on right: 412 415 416 +variable_name (320) + on left: 418 419, on right: 417 +simple_indirect_reference (321) + on left: 420 421, on right: 396 403 421 +assignment_list (322) + on left: 422 423, on right: 216 422 426 +assignment_list_element (323) + on left: 424 426 427, on right: 422 423 +@66 (324) + on left: 425, on right: 426 +array_pair_list (325) + on left: 428 429, on right: 290 +non_empty_array_pair_list (326) + on left: 430 431 432 433 434 435 436 437, on right: 429 430 431 + 434 435 +encaps_list (327) + on left: 438 439 440 441, on right: 339 369 370 438 439 +encaps_var (328) + on left: 442 444 445 446 447 448, on right: 438 440 441 +@67 (329) + on left: 443, on right: 444 +encaps_var_offset (330) + on left: 449 450 451, on right: 444 +internal_functions_in_yacc (331) + on left: 452 453 454 455 456 457 458, on right: 278 +isset_variables (332) + on left: 459 461, on right: 452 461 +@68 (333) + on left: 460, on right: 461 +class_constant (334) + on left: 462 463, on right: 364 state 0 @@ -1214,68 +1333,78 @@ state 4 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_FUNCTION shift, and go to state 45 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_FINAL shift, and go to state 51 - T_ABSTRACT shift, and go to state 52 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_HALT_COMPILER shift, and go to state 57 - T_CLASS shift, and go to state 58 - T_INTERFACE shift, and go to state 59 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - top_statement go to state 74 - statement go to state 75 - unticked_statement go to state 76 - function_declaration_statement go to state 77 - class_declaration_statement go to state 78 - unticked_function_declaration_statement go to state 79 - unticked_class_declaration_statement go to state 80 - class_entry_type go to state 81 - interface_entry go to state 82 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_CONST shift, and go to state 47 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_USE shift, and go to state 51 + T_GLOBAL shift, and go to state 52 + T_FINAL shift, and go to state 53 + T_ABSTRACT shift, and go to state 54 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_HALT_COMPILER shift, and go to state 59 + T_CLASS shift, and go to state 60 + T_INTERFACE shift, and go to state 61 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 70 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + top_statement go to state 81 + constant_declaration go to state 82 + statement go to state 83 + unticked_statement go to state 84 + function_declaration_statement go to state 85 + class_declaration_statement go to state 86 + unticked_function_declaration_statement go to state 87 + unticked_class_declaration_statement go to state 88 + class_entry_type go to state 89 + interface_entry go to state 90 + expr_without_variable go to state 91 + function go to state 92 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 5 - 405 internal_functions_in_yacc: T_REQUIRE_ONCE . expr + 458 internal_functions_in_yacc: T_REQUIRE_ONCE . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1302,48 +1431,57 @@ state 5 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 101 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 115 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 6 - 404 internal_functions_in_yacc: T_REQUIRE . expr + 457 internal_functions_in_yacc: T_REQUIRE . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1370,55 +1508,64 @@ state 6 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 102 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 116 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 7 - 403 internal_functions_in_yacc: T_EVAL . '(' expr ')' + 456 internal_functions_in_yacc: T_EVAL . '(' expr ')' - '(' shift, and go to state 103 + '(' shift, and go to state 117 state 8 - 402 internal_functions_in_yacc: T_INCLUDE_ONCE . expr + 455 internal_functions_in_yacc: T_INCLUDE_ONCE . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1445,48 +1592,57 @@ state 8 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 104 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 118 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 9 - 401 internal_functions_in_yacc: T_INCLUDE . expr + 454 internal_functions_in_yacc: T_INCLUDE . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1513,48 +1669,57 @@ state 9 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 105 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 119 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 10 - 276 expr_without_variable: T_PRINT . expr + 292 expr_without_variable: T_PRINT . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1581,48 +1746,57 @@ state 10 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 106 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 120 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 11 - 245 expr_without_variable: '+' . expr + 259 expr_without_variable: '+' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1649,48 +1823,57 @@ state 11 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 107 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 121 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 12 - 246 expr_without_variable: '-' . expr + 260 expr_without_variable: '-' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1717,48 +1900,57 @@ state 12 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 108 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 122 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 13 - 247 expr_without_variable: '!' . expr + 261 expr_without_variable: '!' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1785,48 +1977,57 @@ state 13 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 109 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 123 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 14 - 248 expr_without_variable: '~' . expr + 262 expr_without_variable: '~' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1853,57 +2054,66 @@ state 14 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 110 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 124 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 15 - 272 expr_without_variable: '@' . @48 expr + 288 expr_without_variable: '@' . @49 expr - $default reduce using rule 271 (@48) + $default reduce using rule 287 (@49) - @48 go to state 111 + @49 go to state 125 state 16 - 269 expr_without_variable: T_UNSET_CAST . expr + 285 expr_without_variable: T_UNSET_CAST . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1930,48 +2140,57 @@ state 16 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 112 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 126 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 17 - 268 expr_without_variable: T_BOOL_CAST . expr + 284 expr_without_variable: T_BOOL_CAST . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -1998,48 +2217,57 @@ state 17 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 113 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 127 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 18 - 267 expr_without_variable: T_OBJECT_CAST . expr + 283 expr_without_variable: T_OBJECT_CAST . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2066,48 +2294,57 @@ state 18 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 114 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 128 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 19 - 266 expr_without_variable: T_ARRAY_CAST . expr + 282 expr_without_variable: T_ARRAY_CAST . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2134,48 +2371,57 @@ state 19 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 115 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 129 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 20 - 265 expr_without_variable: T_STRING_CAST . expr + 281 expr_without_variable: T_STRING_CAST . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2202,48 +2448,57 @@ state 20 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 116 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 130 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 21 - 264 expr_without_variable: T_DOUBLE_CAST . expr + 280 expr_without_variable: T_DOUBLE_CAST . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2270,48 +2525,57 @@ state 21 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 117 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 131 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 22 - 263 expr_without_variable: T_INT_CAST . expr + 279 expr_without_variable: T_INT_CAST . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2338,90 +2602,109 @@ state 22 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 118 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 132 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 23 - 224 expr_without_variable: T_DEC . rw_variable - - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - - function_call go to state 84 - fully_qualified_class_name go to state 120 - rw_variable go to state 121 - variable go to state 122 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + 238 expr_without_variable: T_DEC . rw_variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + rw_variable go to state 137 + variable go to state 138 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 state 24 - 222 expr_without_variable: T_INC . rw_variable - - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - - function_call go to state 84 - fully_qualified_class_name go to state 120 - rw_variable go to state 123 - variable go to state 122 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + 236 expr_without_variable: T_INC . rw_variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + rw_variable go to state 140 + variable go to state 138 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 state 25 - 209 expr_without_variable: T_CLONE . expr + 223 expr_without_variable: T_CLONE . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2448,139 +2731,151 @@ state 25 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 124 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 141 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 26 - 208 expr_without_variable: T_NEW . class_name_reference @41 ctor_arguments + 222 expr_without_variable: T_NEW . class_name_reference @41 ctor_arguments - T_STRING shift, and go to state 125 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 142 + T_NS_SEPARATOR shift, and go to state 143 + '$' shift, and go to state 77 - fully_qualified_class_name go to state 126 - class_name_reference go to state 127 - dynamic_class_name_reference go to state 128 - static_member go to state 93 - base_variable go to state 129 - reference_variable go to state 130 - compound_variable go to state 97 - simple_indirect_reference go to state 131 + namespace_name go to state 144 + class_name go to state 145 + class_name_reference go to state 146 + dynamic_class_name_reference go to state 147 + static_member go to state 102 + variable_class_name go to state 148 + base_variable go to state 149 + reference_variable go to state 150 + compound_variable go to state 107 + simple_indirect_reference go to state 151 state 27 - 270 expr_without_variable: T_EXIT . exit_expr + 286 expr_without_variable: T_EXIT . exit_expr - '(' shift, and go to state 132 + '(' shift, and go to state 152 - $default reduce using rule 295 (exit_expr) + $default reduce using rule 334 (exit_expr) - exit_expr go to state 133 + exit_expr go to state 153 state 28 - 20 unticked_statement: T_IF . '(' expr ')' @3 statement @4 elseif_list else_single - 23 | T_IF . '(' expr ')' ':' @5 inner_statement_list @6 new_elseif_list new_else_single T_ENDIF ';' + 38 unticked_statement: T_IF . '(' expr ')' @5 statement @6 elseif_list else_single + 41 | T_IF . '(' expr ')' ':' @7 inner_statement_list @8 new_elseif_list new_else_single T_ENDIF ';' - '(' shift, and go to state 134 + '(' shift, and go to state 154 state 29 - 300 common_scalar: T_LNUMBER . + 342 common_scalar: T_LNUMBER . - $default reduce using rule 300 (common_scalar) + $default reduce using rule 342 (common_scalar) state 30 - 301 common_scalar: T_DNUMBER . + 343 common_scalar: T_DNUMBER . - $default reduce using rule 301 (common_scalar) + $default reduce using rule 343 (common_scalar) state 31 - 278 function_call: T_STRING . '(' @49 function_call_parameter_list ')' - 285 fully_qualified_class_name: T_STRING . - 315 scalar: T_STRING . + 5 namespace_name: T_STRING . + 34 statement: T_STRING . ':' - '(' shift, and go to state 135 + ':' shift, and go to state 155 - T_PAAMAYIM_NEKUDOTAYIM reduce using rule 285 (fully_qualified_class_name) - $default reduce using rule 315 (scalar) + $default reduce using rule 5 (namespace_name) state 32 - 316 scalar: T_STRING_VARNAME . + 363 scalar: T_STRING_VARNAME . - $default reduce using rule 316 (scalar) + $default reduce using rule 363 (scalar) state 33 - 356 compound_variable: T_VARIABLE . + 408 compound_variable: T_VARIABLE . - $default reduce using rule 356 (compound_variable) + $default reduce using rule 408 (compound_variable) state 34 - 46 unticked_statement: T_INLINE_HTML . + 64 unticked_statement: T_INLINE_HTML . - $default reduce using rule 46 (unticked_statement) + $default reduce using rule 64 (unticked_statement) state 35 - 302 common_scalar: T_CONSTANT_ENCAPSED_STRING . + 344 common_scalar: T_CONSTANT_ENCAPSED_STRING . - $default reduce using rule 302 (common_scalar) + $default reduce using rule 344 (common_scalar) state 36 - 45 unticked_statement: T_ECHO . echo_expr_list ';' + 63 unticked_statement: T_ECHO . echo_expr_list ';' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2607,97 +2902,106 @@ state 36 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - echo_expr_list go to state 136 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 137 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + echo_expr_list go to state 156 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 157 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 37 - 29 unticked_statement: T_DO . @9 statement T_WHILE '(' @10 expr ')' ';' + 47 unticked_statement: T_DO . @11 statement T_WHILE '(' @12 expr ')' ';' - $default reduce using rule 27 (@9) + $default reduce using rule 45 (@11) - @9 go to state 138 + @11 go to state 158 state 38 - 26 unticked_statement: T_WHILE . '(' @7 expr ')' @8 while_statement + 44 unticked_statement: T_WHILE . '(' @9 expr ')' @10 while_statement - '(' shift, and go to state 139 + '(' shift, and go to state 159 state 39 - 33 unticked_statement: T_FOR . '(' for_expr ';' @11 for_expr ';' @12 for_expr ')' @13 for_statement + 51 unticked_statement: T_FOR . '(' for_expr ';' @13 for_expr ';' @14 for_expr ')' @15 for_statement - '(' shift, and go to state 140 + '(' shift, and go to state 160 state 40 - 52 unticked_statement: T_FOREACH . '(' variable T_AS @15 foreach_variable foreach_optional_arg ')' @16 foreach_statement - 55 | T_FOREACH . '(' expr_without_variable T_AS @17 variable foreach_optional_arg ')' @18 foreach_statement + 69 unticked_statement: T_FOREACH . '(' variable T_AS @17 foreach_variable foreach_optional_arg ')' @18 foreach_statement + 72 | T_FOREACH . '(' expr_without_variable T_AS @19 variable foreach_optional_arg ')' @20 foreach_statement - '(' shift, and go to state 141 + '(' shift, and go to state 161 state 41 - 57 unticked_statement: T_DECLARE . @19 '(' declare_list ')' declare_statement + 74 unticked_statement: T_DECLARE . @21 '(' declare_list ')' declare_statement - $default reduce using rule 56 (@19) + $default reduce using rule 73 (@21) - @19 go to state 142 + @21 go to state 162 state 42 - 35 unticked_statement: T_SWITCH . '(' expr ')' @14 switch_case_list + 53 unticked_statement: T_SWITCH . '(' expr ')' @16 switch_case_list - '(' shift, and go to state 143 + '(' shift, and go to state 163 state 43 - 36 unticked_statement: T_BREAK . ';' - 37 | T_BREAK . expr ';' + 54 unticked_statement: T_BREAK . ';' + 55 | T_BREAK . expr ';' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2724,50 +3028,59 @@ state 43 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 144 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 145 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 164 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 165 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 44 - 38 unticked_statement: T_CONTINUE . ';' - 39 | T_CONTINUE . expr ';' + 56 unticked_statement: T_CONTINUE . ';' + 57 | T_CONTINUE . expr ';' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2794,60 +3107,81 @@ state 44 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 146 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 147 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 166 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 167 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 45 - 84 unticked_function_declaration_statement: T_FUNCTION . @27 is_reference T_STRING @28 '(' parameter_list ')' '{' inner_statement_list '}' - - $default reduce using rule 82 (@27) + 83 unticked_statement: T_GOTO . T_STRING ';' - @27 go to state 148 + T_STRING shift, and go to state 168 state 46 - 40 unticked_statement: T_RETURN . ';' - 41 | T_RETURN . expr_without_variable ';' - 42 | T_RETURN . variable ';' + 295 function: T_FUNCTION . + + $default reduce using rule 295 (function) + + +state 47 + + 25 constant_declaration: T_CONST . T_STRING '=' static_scalar + + T_STRING shift, and go to state 169 + + +state 48 + + 58 unticked_statement: T_RETURN . ';' + 59 | T_RETURN . expr_without_variable ';' + 60 | T_RETURN . variable ';' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2874,58 +3208,67 @@ state 46 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 149 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 150 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 151 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 152 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 170 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 171 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 173 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 47 +state 49 - 64 unticked_statement: T_TRY . @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches + 81 unticked_statement: T_TRY . @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches - $default reduce using rule 59 (@20) + $default reduce using rule 76 (@22) - @20 go to state 153 + @22 go to state 174 -state 48 +state 50 - 65 unticked_statement: T_THROW . expr ';' + 82 unticked_statement: T_THROW . expr ';' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -2952,1095 +3295,882 @@ state 48 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 154 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 49 - - 48 unticked_statement: T_USE . use_filename ';' - - T_CONSTANT_ENCAPSED_STRING shift, and go to state 155 - '(' shift, and go to state 156 - - use_filename go to state 157 - - -state 50 - - 43 unticked_statement: T_GLOBAL . global_var_list ';' - - T_VARIABLE shift, and go to state 158 - '$' shift, and go to state 159 - - global_var_list go to state 160 - global_var go to state 161 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 175 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 51 - 91 class_entry_type: T_FINAL . T_CLASS + 16 top_statement: T_USE . use_declarations ';' - T_CLASS shift, and go to state 162 + T_STRING shift, and go to state 111 + T_NS_SEPARATOR shift, and go to state 176 + + namespace_name go to state 177 + use_declarations go to state 178 + use_declaration go to state 179 state 52 - 90 class_entry_type: T_ABSTRACT . T_CLASS + 61 unticked_statement: T_GLOBAL . global_var_list ';' - T_CLASS shift, and go to state 163 + T_VARIABLE shift, and go to state 180 + '$' shift, and go to state 181 + global_var_list go to state 182 + global_var go to state 183 -state 53 - 44 unticked_statement: T_STATIC . static_var_list ';' +state 53 - T_VARIABLE shift, and go to state 164 + 106 class_entry_type: T_FINAL . T_CLASS - static_var_list go to state 165 + T_CLASS shift, and go to state 184 state 54 - 49 unticked_statement: T_UNSET . '(' unset_variables ')' ';' + 105 class_entry_type: T_ABSTRACT . T_CLASS - '(' shift, and go to state 166 + T_CLASS shift, and go to state 185 state 55 - 399 internal_functions_in_yacc: T_ISSET . '(' isset_variables ')' + 62 unticked_statement: T_STATIC . static_var_list ';' + 318 class_name: T_STATIC . + + T_VARIABLE shift, and go to state 186 - '(' shift, and go to state 167 + $default reduce using rule 318 (class_name) + + static_var_list go to state 187 state 56 - 400 internal_functions_in_yacc: T_EMPTY . '(' variable ')' + 66 unticked_statement: T_UNSET . '(' unset_variables ')' ';' - '(' shift, and go to state 168 + '(' shift, and go to state 188 state 57 - 8 top_statement: T_HALT_COMPILER . '(' ')' ';' + 452 internal_functions_in_yacc: T_ISSET . '(' isset_variables ')' - '(' shift, and go to state 169 + '(' shift, and go to state 189 state 58 - 89 class_entry_type: T_CLASS . + 453 internal_functions_in_yacc: T_EMPTY . '(' variable ')' - $default reduce using rule 89 (class_entry_type) + '(' shift, and go to state 190 state 59 - 94 interface_entry: T_INTERFACE . + 10 top_statement: T_HALT_COMPILER . '(' ')' ';' - $default reduce using rule 94 (interface_entry) + '(' shift, and go to state 191 state 60 - 202 expr_without_variable: T_LIST . '(' @39 assignment_list ')' '=' expr + 104 class_entry_type: T_CLASS . - '(' shift, and go to state 170 + $default reduce using rule 104 (class_entry_type) state 61 - 274 expr_without_variable: T_ARRAY . '(' array_pair_list ')' + 109 interface_entry: T_INTERFACE . - '(' shift, and go to state 171 + $default reduce using rule 109 (interface_entry) state 62 - 305 common_scalar: T_CLASS_C . + 216 expr_without_variable: T_LIST . '(' @39 assignment_list ')' '=' expr - $default reduce using rule 305 (common_scalar) + '(' shift, and go to state 192 state 63 - 306 common_scalar: T_METHOD_C . + 290 expr_without_variable: T_ARRAY . '(' array_pair_list ')' - $default reduce using rule 306 (common_scalar) + '(' shift, and go to state 193 state 64 - 307 common_scalar: T_FUNC_C . + 348 common_scalar: T_CLASS_C . - $default reduce using rule 307 (common_scalar) + $default reduce using rule 348 (common_scalar) state 65 - 303 common_scalar: T_LINE . + 349 common_scalar: T_METHOD_C . - $default reduce using rule 303 (common_scalar) + $default reduce using rule 349 (common_scalar) state 66 - 304 common_scalar: T_FILE . + 350 common_scalar: T_FUNC_C . - $default reduce using rule 304 (common_scalar) + $default reduce using rule 350 (common_scalar) state 67 - 320 scalar: T_START_HEREDOC . encaps_list T_END_HEREDOC - - $default reduce using rule 388 (encaps_list) + 345 common_scalar: T_LINE . - encaps_list go to state 172 + $default reduce using rule 345 (common_scalar) state 68 - 258 expr_without_variable: '(' . expr ')' + 346 common_scalar: T_FILE . - T_REQUIRE_ONCE shift, and go to state 5 - T_REQUIRE shift, and go to state 6 - T_EVAL shift, and go to state 7 - T_INCLUDE_ONCE shift, and go to state 8 - T_INCLUDE shift, and go to state 9 - T_PRINT shift, and go to state 10 - '+' shift, and go to state 11 - '-' shift, and go to state 12 - '!' shift, and go to state 13 - '~' shift, and go to state 14 - '@' shift, and go to state 15 - T_UNSET_CAST shift, and go to state 16 - T_BOOL_CAST shift, and go to state 17 - T_OBJECT_CAST shift, and go to state 18 - T_ARRAY_CAST shift, and go to state 19 - T_STRING_CAST shift, and go to state 20 - T_DOUBLE_CAST shift, and go to state 21 - T_INT_CAST shift, and go to state 22 - T_DEC shift, and go to state 23 - T_INC shift, and go to state 24 - T_CLONE shift, and go to state 25 - T_NEW shift, and go to state 26 - T_EXIT shift, and go to state 27 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 - T_STRING_VARNAME shift, and go to state 32 - T_VARIABLE shift, and go to state 33 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 173 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + $default reduce using rule 346 (common_scalar) state 69 - 58 unticked_statement: ';' . + 352 common_scalar: T_START_HEREDOC . T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC + 353 | T_START_HEREDOC . T_END_HEREDOC + 370 scalar: T_START_HEREDOC . encaps_list T_END_HEREDOC - $default reduce using rule 58 (unticked_statement) + T_VARIABLE shift, and go to state 194 + T_ENCAPSED_AND_WHITESPACE shift, and go to state 195 + T_END_HEREDOC shift, and go to state 196 + T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 197 + T_CURLY_OPEN shift, and go to state 198 + + encaps_list go to state 199 + encaps_var go to state 200 state 70 - 17 unticked_statement: '{' . inner_statement_list '}' + 11 top_statement: T_NAMESPACE . namespace_name ';' + 13 | T_NAMESPACE . namespace_name '{' @2 top_statement_list '}' + 15 | T_NAMESPACE . '{' @3 top_statement_list '}' + 305 function_call: T_NAMESPACE . T_NS_SEPARATOR namespace_name '(' @52 function_call_parameter_list ')' + 320 class_name: T_NAMESPACE . T_NS_SEPARATOR namespace_name + 366 scalar: T_NAMESPACE . T_NS_SEPARATOR namespace_name - $default reduce using rule 11 (inner_statement_list) + T_STRING shift, and go to state 111 + T_NS_SEPARATOR shift, and go to state 201 + '{' shift, and go to state 202 - inner_statement_list go to state 174 + namespace_name go to state 203 state 71 - 357 compound_variable: '$' . '{' expr '}' - 368 simple_indirect_reference: '$' . - - '{' shift, and go to state 175 + 351 common_scalar: T_NS_C . - $default reduce using rule 368 (simple_indirect_reference) + $default reduce using rule 351 (common_scalar) state 72 - 275 expr_without_variable: '`' . encaps_list '`' + 347 common_scalar: T_DIR . - $default reduce using rule 388 (encaps_list) - - encaps_list go to state 176 + $default reduce using rule 347 (common_scalar) state 73 - 319 scalar: '"' . encaps_list '"' + 307 function_call: T_NS_SEPARATOR . namespace_name '(' @53 function_call_parameter_list ')' + 321 class_name: T_NS_SEPARATOR . namespace_name + 367 scalar: T_NS_SEPARATOR . namespace_name - $default reduce using rule 388 (encaps_list) + T_STRING shift, and go to state 111 - encaps_list go to state 177 + namespace_name go to state 204 state 74 - 3 top_statement_list: top_statement_list @1 top_statement . + 272 expr_without_variable: '(' . expr ')' - $default reduce using rule 3 (top_statement_list) + T_REQUIRE_ONCE shift, and go to state 5 + T_REQUIRE shift, and go to state 6 + T_EVAL shift, and go to state 7 + T_INCLUDE_ONCE shift, and go to state 8 + T_INCLUDE shift, and go to state 9 + T_PRINT shift, and go to state 10 + '+' shift, and go to state 11 + '-' shift, and go to state 12 + '!' shift, and go to state 13 + '~' shift, and go to state 14 + '@' shift, and go to state 15 + T_UNSET_CAST shift, and go to state 16 + T_BOOL_CAST shift, and go to state 17 + T_OBJECT_CAST shift, and go to state 18 + T_ARRAY_CAST shift, and go to state 19 + T_STRING_CAST shift, and go to state 20 + T_DOUBLE_CAST shift, and go to state 21 + T_INT_CAST shift, and go to state 22 + T_DEC shift, and go to state 23 + T_INC shift, and go to state 24 + T_CLONE shift, and go to state 25 + T_NEW shift, and go to state 26 + T_EXIT shift, and go to state 27 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 32 + T_VARIABLE shift, and go to state 33 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 205 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 state 75 - 5 top_statement: statement . + 75 unticked_statement: ';' . - $default reduce using rule 5 (top_statement) + $default reduce using rule 75 (unticked_statement) state 76 - 16 statement: unticked_statement . + 35 unticked_statement: '{' . inner_statement_list '}' + + $default reduce using rule 28 (inner_statement_list) - $default reduce using rule 16 (statement) + inner_statement_list go to state 206 state 77 - 6 top_statement: function_declaration_statement . + 409 compound_variable: '$' . '{' expr '}' + 420 simple_indirect_reference: '$' . - $default reduce using rule 6 (top_statement) + '{' shift, and go to state 207 + + $default reduce using rule 420 (simple_indirect_reference) state 78 - 7 top_statement: class_declaration_statement . + 291 expr_without_variable: '`' . backticks_expr '`' - $default reduce using rule 7 (top_statement) + T_VARIABLE shift, and go to state 194 + T_ENCAPSED_AND_WHITESPACE shift, and go to state 208 + T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 197 + T_CURLY_OPEN shift, and go to state 198 + + $default reduce using rule 337 (backticks_expr) + + backticks_expr go to state 209 + encaps_list go to state 210 + encaps_var go to state 200 state 79 - 78 function_declaration_statement: unticked_function_declaration_statement . + 369 scalar: '"' . encaps_list '"' - $default reduce using rule 78 (function_declaration_statement) + T_VARIABLE shift, and go to state 194 + T_ENCAPSED_AND_WHITESPACE shift, and go to state 211 + T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 197 + T_CURLY_OPEN shift, and go to state 198 + + encaps_list go to state 212 + encaps_var go to state 200 state 80 - 79 class_declaration_statement: unticked_class_declaration_statement . + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 303 function_call: namespace_name . '(' @51 function_call_parameter_list ')' + 319 class_name: namespace_name . + 365 scalar: namespace_name . + + T_NS_SEPARATOR shift, and go to state 213 + '(' shift, and go to state 214 - $default reduce using rule 79 (class_declaration_statement) + T_PAAMAYIM_NEKUDOTAYIM reduce using rule 319 (class_name) + $default reduce using rule 365 (scalar) state 81 - 86 unticked_class_declaration_statement: class_entry_type . T_STRING extends_from @29 implements_list '{' class_statement_list '}' + 3 top_statement_list: top_statement_list @1 top_statement . - T_STRING shift, and go to state 178 + $default reduce using rule 3 (top_statement_list) state 82 - 88 unticked_class_declaration_statement: interface_entry . T_STRING @30 interface_extends_list '{' class_statement_list '}' + 17 top_statement: constant_declaration . ';' + 24 constant_declaration: constant_declaration . ',' T_STRING '=' static_scalar - T_STRING shift, and go to state 179 + ',' shift, and go to state 215 + ';' shift, and go to state 216 state 83 - 330 expr: expr_without_variable . + 7 top_statement: statement . - $default reduce using rule 330 (expr) + $default reduce using rule 7 (top_statement) state 84 - 349 base_variable_with_function_calls: function_call . + 33 statement: unticked_statement . - $default reduce using rule 349 (base_variable_with_function_calls) + $default reduce using rule 33 (statement) state 85 - 280 function_call: fully_qualified_class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @50 function_call_parameter_list ')' - 282 | fully_qualified_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @51 function_call_parameter_list ')' - 347 static_member: fully_qualified_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects - 409 class_constant: fully_qualified_class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING + 8 top_statement: function_declaration_statement . - T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 180 + $default reduce using rule 8 (top_statement) state 86 - 318 scalar: common_scalar . + 9 top_statement: class_declaration_statement . - $default reduce using rule 318 (scalar) + $default reduce using rule 9 (top_statement) state 87 - 273 expr_without_variable: scalar . + 94 function_declaration_statement: unticked_function_declaration_statement . - $default reduce using rule 273 (expr_without_variable) + $default reduce using rule 94 (function_declaration_statement) state 88 - 47 unticked_statement: expr . ';' - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ';' shift, and go to state 207 + 95 class_declaration_statement: unticked_class_declaration_statement . + + $default reduce using rule 95 (class_declaration_statement) state 89 - 329 expr: r_variable . + 101 unticked_class_declaration_statement: class_entry_type . T_STRING extends_from @30 implements_list '{' class_statement_list '}' - $default reduce using rule 329 (expr) + T_STRING shift, and go to state 217 state 90 - 221 expr_without_variable: rw_variable . T_INC - 223 | rw_variable . T_DEC + 103 unticked_class_declaration_statement: interface_entry . T_STRING @31 interface_extends_list '{' class_statement_list '}' - T_DEC shift, and go to state 208 - T_INC shift, and go to state 209 + T_STRING shift, and go to state 218 state 91 - 203 expr_without_variable: variable . '=' expr - 204 | variable . '=' '&' variable - 206 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments - 210 | variable . T_PLUS_EQUAL expr - 211 | variable . T_MINUS_EQUAL expr - 212 | variable . T_MUL_EQUAL expr - 213 | variable . T_DIV_EQUAL expr - 214 | variable . T_CONCAT_EQUAL expr - 215 | variable . T_MOD_EQUAL expr - 216 | variable . T_AND_EQUAL expr - 217 | variable . T_OR_EQUAL expr - 218 | variable . T_XOR_EQUAL expr - 219 | variable . T_SL_EQUAL expr - 220 | variable . T_SR_EQUAL expr - 331 r_variable: variable . - 333 rw_variable: variable . - - '=' shift, and go to state 210 - T_SR_EQUAL shift, and go to state 211 - T_SL_EQUAL shift, and go to state 212 - T_XOR_EQUAL shift, and go to state 213 - T_OR_EQUAL shift, and go to state 214 - T_AND_EQUAL shift, and go to state 215 - T_MOD_EQUAL shift, and go to state 216 - T_CONCAT_EQUAL shift, and go to state 217 - T_DIV_EQUAL shift, and go to state 218 - T_MUL_EQUAL shift, and go to state 219 - T_MINUS_EQUAL shift, and go to state 220 - T_PLUS_EQUAL shift, and go to state 221 - - T_DEC reduce using rule 333 (rw_variable) - T_INC reduce using rule 333 (rw_variable) - $default reduce using rule 331 (r_variable) + 380 expr: expr_without_variable . + + $default reduce using rule 380 (expr) state 92 - 284 function_call: variable_without_objects . '(' @52 function_call_parameter_list ')' + 99 unticked_function_declaration_statement: function . is_reference T_STRING @29 '(' parameter_list ')' '{' inner_statement_list '}' + 294 expr_without_variable: function . is_reference '(' @50 parameter_list ')' lexical_vars '{' inner_statement_list '}' + + '&' shift, and go to state 219 + + $default reduce using rule 96 (is_reference) - '(' shift, and go to state 222 + is_reference go to state 220 state 93 - 352 base_variable: static_member . + 401 base_variable_with_function_calls: function_call . - $default reduce using rule 352 (base_variable) + $default reduce using rule 401 (base_variable_with_function_calls) state 94 - 336 variable: base_variable_with_function_calls . T_OBJECT_OPERATOR @55 object_property @56 method_or_not variable_properties - 337 | base_variable_with_function_calls . + 309 function_call: class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @54 function_call_parameter_list ')' + 311 | class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @55 function_call_parameter_list ')' + 397 static_member: class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects + 462 class_constant: class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING - T_OBJECT_OPERATOR shift, and go to state 223 - - $default reduce using rule 337 (variable) + T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 221 state 95 - 348 base_variable_with_function_calls: base_variable . + 368 scalar: common_scalar . - $default reduce using rule 348 (base_variable_with_function_calls) + $default reduce using rule 368 (scalar) state 96 - 345 variable_without_objects: reference_variable . - 350 base_variable: reference_variable . - 353 reference_variable: reference_variable . '[' dim_offset ']' - 354 | reference_variable . '{' expr '}' - - '[' shift, and go to state 224 - '{' shift, and go to state 225 + 289 expr_without_variable: scalar . - '(' reduce using rule 345 (variable_without_objects) - $default reduce using rule 350 (base_variable) + $default reduce using rule 289 (expr_without_variable) state 97 - 355 reference_variable: compound_variable . - - $default reduce using rule 355 (reference_variable) + 65 unticked_statement: expr . ';' + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ';' shift, and go to state 248 state 98 - 346 variable_without_objects: simple_indirect_reference . reference_variable - 351 base_variable: simple_indirect_reference . reference_variable - 369 simple_indirect_reference: simple_indirect_reference . '$' - - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 226 + 379 expr: r_variable . - reference_variable go to state 227 - compound_variable go to state 97 + $default reduce using rule 379 (expr) state 99 - 262 expr_without_variable: internal_functions_in_yacc . + 235 expr_without_variable: rw_variable . T_INC + 237 | rw_variable . T_DEC - $default reduce using rule 262 (expr_without_variable) + T_DEC shift, and go to state 249 + T_INC shift, and go to state 250 state 100 - 317 scalar: class_constant . - - $default reduce using rule 317 (scalar) + 217 expr_without_variable: variable . '=' expr + 218 | variable . '=' '&' variable + 220 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments + 224 | variable . T_PLUS_EQUAL expr + 225 | variable . T_MINUS_EQUAL expr + 226 | variable . T_MUL_EQUAL expr + 227 | variable . T_DIV_EQUAL expr + 228 | variable . T_CONCAT_EQUAL expr + 229 | variable . T_MOD_EQUAL expr + 230 | variable . T_AND_EQUAL expr + 231 | variable . T_OR_EQUAL expr + 232 | variable . T_XOR_EQUAL expr + 233 | variable . T_SL_EQUAL expr + 234 | variable . T_SR_EQUAL expr + 381 r_variable: variable . + 383 rw_variable: variable . + + '=' shift, and go to state 251 + T_SR_EQUAL shift, and go to state 252 + T_SL_EQUAL shift, and go to state 253 + T_XOR_EQUAL shift, and go to state 254 + T_OR_EQUAL shift, and go to state 255 + T_AND_EQUAL shift, and go to state 256 + T_MOD_EQUAL shift, and go to state 257 + T_CONCAT_EQUAL shift, and go to state 258 + T_DIV_EQUAL shift, and go to state 259 + T_MUL_EQUAL shift, and go to state 260 + T_MINUS_EQUAL shift, and go to state 261 + T_PLUS_EQUAL shift, and go to state 262 + + T_DEC reduce using rule 383 (rw_variable) + T_INC reduce using rule 383 (rw_variable) + $default reduce using rule 381 (r_variable) state 101 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 405 internal_functions_in_yacc: T_REQUIRE_ONCE expr . - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 405 (internal_functions_in_yacc) + 317 function_call: variable_without_objects . '(' @58 function_call_parameter_list ')' + + '(' shift, and go to state 263 state 102 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 404 internal_functions_in_yacc: T_REQUIRE expr . - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 404 (internal_functions_in_yacc) + 404 base_variable: static_member . + + $default reduce using rule 404 (base_variable) state 103 - 403 internal_functions_in_yacc: T_EVAL '(' . expr ')' + 313 function_call: variable_class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @56 function_call_parameter_list ')' + 315 | variable_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @57 function_call_parameter_list ')' + 398 static_member: variable_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects + 463 class_constant: variable_class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING - T_REQUIRE_ONCE shift, and go to state 5 - T_REQUIRE shift, and go to state 6 - T_EVAL shift, and go to state 7 - T_INCLUDE_ONCE shift, and go to state 8 - T_INCLUDE shift, and go to state 9 - T_PRINT shift, and go to state 10 - '+' shift, and go to state 11 - '-' shift, and go to state 12 - '!' shift, and go to state 13 - '~' shift, and go to state 14 - '@' shift, and go to state 15 - T_UNSET_CAST shift, and go to state 16 - T_BOOL_CAST shift, and go to state 17 - T_OBJECT_CAST shift, and go to state 18 - T_ARRAY_CAST shift, and go to state 19 - T_STRING_CAST shift, and go to state 20 - T_DOUBLE_CAST shift, and go to state 21 - T_INT_CAST shift, and go to state 22 - T_DEC shift, and go to state 23 - T_INC shift, and go to state 24 - T_CLONE shift, and go to state 25 - T_NEW shift, and go to state 26 - T_EXIT shift, and go to state 27 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 - T_STRING_VARNAME shift, and go to state 32 - T_VARIABLE shift, and go to state 33 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 228 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 264 state 104 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 402 internal_functions_in_yacc: T_INCLUDE_ONCE expr . - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 402 (internal_functions_in_yacc) + 386 variable: base_variable_with_function_calls . T_OBJECT_OPERATOR @61 object_property @62 method_or_not variable_properties + 387 | base_variable_with_function_calls . + + T_OBJECT_OPERATOR shift, and go to state 265 + + $default reduce using rule 387 (variable) state 105 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 401 internal_functions_in_yacc: T_INCLUDE expr . - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 401 (internal_functions_in_yacc) + 400 base_variable_with_function_calls: base_variable . + + $default reduce using rule 400 (base_variable_with_function_calls) state 106 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 276 | T_PRINT expr . - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 276 (expr_without_variable) + 395 variable_without_objects: reference_variable . + 399 variable_class_name: reference_variable . + 402 base_variable: reference_variable . + 405 reference_variable: reference_variable . '[' dim_offset ']' + 406 | reference_variable . '{' expr '}' + + '[' shift, and go to state 266 + '{' shift, and go to state 267 + + T_PAAMAYIM_NEKUDOTAYIM reduce using rule 399 (variable_class_name) + '(' reduce using rule 395 (variable_without_objects) + $default reduce using rule 402 (base_variable) state 107 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 245 | '+' expr . - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - $default reduce using rule 245 (expr_without_variable) + 407 reference_variable: compound_variable . + + $default reduce using rule 407 (reference_variable) state 108 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 246 | '-' expr . - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr + 396 variable_without_objects: simple_indirect_reference . reference_variable + 403 base_variable: simple_indirect_reference . reference_variable + 421 simple_indirect_reference: simple_indirect_reference . '$' - $default reduce using rule 246 (expr_without_variable) + T_VARIABLE shift, and go to state 33 + '$' shift, and go to state 268 + + reference_variable go to state 269 + compound_variable go to state 107 state 109 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 247 | '!' expr . - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_INSTANCEOF shift, and go to state 206 + 278 expr_without_variable: internal_functions_in_yacc . - $default reduce using rule 247 (expr_without_variable) + $default reduce using rule 278 (expr_without_variable) state 110 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 248 | '~' expr . - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr + 364 scalar: class_constant . - $default reduce using rule 248 (expr_without_variable) + $default reduce using rule 364 (scalar) state 111 - 272 expr_without_variable: '@' @48 . expr + 5 namespace_name: T_STRING . + + $default reduce using rule 5 (namespace_name) + + +state 112 + + 318 class_name: T_STATIC . + + $default reduce using rule 318 (class_name) + + +state 113 + + 305 function_call: T_NAMESPACE . T_NS_SEPARATOR namespace_name '(' @52 function_call_parameter_list ')' + 320 class_name: T_NAMESPACE . T_NS_SEPARATOR namespace_name + 366 scalar: T_NAMESPACE . T_NS_SEPARATOR namespace_name + + T_NS_SEPARATOR shift, and go to state 201 + + +state 114 + + 294 expr_without_variable: function . is_reference '(' @50 parameter_list ')' lexical_vars '{' inner_statement_list '}' + + '&' shift, and go to state 219 + + $default reduce using rule 96 (is_reference) + + is_reference go to state 270 + + +state 115 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 458 internal_functions_in_yacc: T_REQUIRE_ONCE expr . + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 458 (internal_functions_in_yacc) + + +state 116 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 457 internal_functions_in_yacc: T_REQUIRE expr . + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 457 (internal_functions_in_yacc) + + +state 117 + + 456 internal_functions_in_yacc: T_EVAL '(' . expr ')' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -4067,419 +4197,889 @@ state 111 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 229 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 271 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 112 +state 118 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 269 | T_UNSET_CAST expr . + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 455 internal_functions_in_yacc: T_INCLUDE_ONCE expr . + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 455 (internal_functions_in_yacc) - $default reduce using rule 269 (expr_without_variable) +state 119 -state 113 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 454 internal_functions_in_yacc: T_INCLUDE expr . + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 454 (internal_functions_in_yacc) - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 268 | T_BOOL_CAST expr . - $default reduce using rule 268 (expr_without_variable) +state 120 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 292 | T_PRINT expr . + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 292 (expr_without_variable) -state 114 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 267 | T_OBJECT_CAST expr . +state 121 - $default reduce using rule 267 (expr_without_variable) + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 259 | '+' expr . + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + $default reduce using rule 259 (expr_without_variable) -state 115 +state 122 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 266 | T_ARRAY_CAST expr . + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 260 | '-' expr . + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + $default reduce using rule 260 (expr_without_variable) - $default reduce using rule 266 (expr_without_variable) +state 123 -state 116 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 261 | '!' expr . + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_INSTANCEOF shift, and go to state 247 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 265 | T_STRING_CAST expr . + $default reduce using rule 261 (expr_without_variable) - $default reduce using rule 265 (expr_without_variable) +state 124 -state 117 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 262 | '~' expr . + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 264 | T_DOUBLE_CAST expr . + $default reduce using rule 262 (expr_without_variable) - $default reduce using rule 264 (expr_without_variable) +state 125 -state 118 + 288 expr_without_variable: '@' @49 . expr - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 263 | T_INT_CAST expr . + T_REQUIRE_ONCE shift, and go to state 5 + T_REQUIRE shift, and go to state 6 + T_EVAL shift, and go to state 7 + T_INCLUDE_ONCE shift, and go to state 8 + T_INCLUDE shift, and go to state 9 + T_PRINT shift, and go to state 10 + '+' shift, and go to state 11 + '-' shift, and go to state 12 + '!' shift, and go to state 13 + '~' shift, and go to state 14 + '@' shift, and go to state 15 + T_UNSET_CAST shift, and go to state 16 + T_BOOL_CAST shift, and go to state 17 + T_OBJECT_CAST shift, and go to state 18 + T_ARRAY_CAST shift, and go to state 19 + T_STRING_CAST shift, and go to state 20 + T_DOUBLE_CAST shift, and go to state 21 + T_INT_CAST shift, and go to state 22 + T_DEC shift, and go to state 23 + T_INC shift, and go to state 24 + T_CLONE shift, and go to state 25 + T_NEW shift, and go to state 26 + T_EXIT shift, and go to state 27 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 32 + T_VARIABLE shift, and go to state 33 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 272 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 - $default reduce using rule 263 (expr_without_variable) +state 126 -state 119 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 285 | T_UNSET_CAST expr . + + $default reduce using rule 285 (expr_without_variable) - 278 function_call: T_STRING . '(' @49 function_call_parameter_list ')' - 285 fully_qualified_class_name: T_STRING . - '(' shift, and go to state 135 +state 127 - $default reduce using rule 285 (fully_qualified_class_name) + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 284 | T_BOOL_CAST expr . + + $default reduce using rule 284 (expr_without_variable) -state 120 +state 128 - 280 function_call: fully_qualified_class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @50 function_call_parameter_list ')' - 282 | fully_qualified_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @51 function_call_parameter_list ')' - 347 static_member: fully_qualified_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 283 | T_OBJECT_CAST expr . + + $default reduce using rule 283 (expr_without_variable) - T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 230 +state 129 -state 121 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 282 | T_ARRAY_CAST expr . + + $default reduce using rule 282 (expr_without_variable) - 224 expr_without_variable: T_DEC rw_variable . - $default reduce using rule 224 (expr_without_variable) +state 130 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 281 | T_STRING_CAST expr . + + $default reduce using rule 281 (expr_without_variable) -state 122 - 333 rw_variable: variable . +state 131 - $default reduce using rule 333 (rw_variable) + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 280 | T_DOUBLE_CAST expr . + + $default reduce using rule 280 (expr_without_variable) -state 123 +state 132 - 222 expr_without_variable: T_INC rw_variable . + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 279 | T_INT_CAST expr . + + $default reduce using rule 279 (expr_without_variable) - $default reduce using rule 222 (expr_without_variable) +state 133 -state 124 + 305 function_call: T_NAMESPACE . T_NS_SEPARATOR namespace_name '(' @52 function_call_parameter_list ')' + 320 class_name: T_NAMESPACE . T_NS_SEPARATOR namespace_name - 209 expr_without_variable: T_CLONE expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - $default reduce using rule 209 (expr_without_variable) + T_NS_SEPARATOR shift, and go to state 273 -state 125 +state 134 - 285 fully_qualified_class_name: T_STRING . - 286 class_name_reference: T_STRING . + 307 function_call: T_NS_SEPARATOR . namespace_name '(' @53 function_call_parameter_list ')' + 321 class_name: T_NS_SEPARATOR . namespace_name - T_PAAMAYIM_NEKUDOTAYIM reduce using rule 285 (fully_qualified_class_name) - $default reduce using rule 286 (class_name_reference) + T_STRING shift, and go to state 111 + namespace_name go to state 274 -state 126 - 347 static_member: fully_qualified_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects +state 135 + + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 303 function_call: namespace_name . '(' @51 function_call_parameter_list ')' + 319 class_name: namespace_name . - T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 231 + T_NS_SEPARATOR shift, and go to state 213 + '(' shift, and go to state 214 + $default reduce using rule 319 (class_name) -state 127 - 208 expr_without_variable: T_NEW class_name_reference . @41 ctor_arguments +state 136 - $default reduce using rule 207 (@41) + 309 function_call: class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @54 function_call_parameter_list ')' + 311 | class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @55 function_call_parameter_list ')' + 397 static_member: class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects - @41 go to state 232 + T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 275 -state 128 +state 137 - 287 class_name_reference: dynamic_class_name_reference . + 238 expr_without_variable: T_DEC rw_variable . - $default reduce using rule 287 (class_name_reference) + $default reduce using rule 238 (expr_without_variable) -state 129 +state 138 - 290 dynamic_class_name_reference: base_variable . T_OBJECT_OPERATOR @53 object_property @54 dynamic_class_name_variable_properties - 291 | base_variable . + 383 rw_variable: variable . - T_OBJECT_OPERATOR shift, and go to state 233 + $default reduce using rule 383 (rw_variable) - $default reduce using rule 291 (dynamic_class_name_reference) +state 139 -state 130 + 313 function_call: variable_class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @56 function_call_parameter_list ')' + 315 | variable_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @57 function_call_parameter_list ')' + 398 static_member: variable_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects - 350 base_variable: reference_variable . - 353 reference_variable: reference_variable . '[' dim_offset ']' - 354 | reference_variable . '{' expr '}' + T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 276 - '[' shift, and go to state 224 - '{' shift, and go to state 225 - $default reduce using rule 350 (base_variable) +state 140 + 236 expr_without_variable: T_INC rw_variable . -state 131 + $default reduce using rule 236 (expr_without_variable) + + +state 141 + + 223 expr_without_variable: T_CLONE expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + $default reduce using rule 223 (expr_without_variable) + + +state 142 + + 320 class_name: T_NAMESPACE . T_NS_SEPARATOR namespace_name + + T_NS_SEPARATOR shift, and go to state 277 + + +state 143 + + 321 class_name: T_NS_SEPARATOR . namespace_name + + T_STRING shift, and go to state 111 + + namespace_name go to state 278 + + +state 144 + + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 319 class_name: namespace_name . + + T_NS_SEPARATOR shift, and go to state 213 + + $default reduce using rule 319 (class_name) + + +state 145 + + 325 class_name_reference: class_name . + 397 static_member: class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects + + T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 279 + + $default reduce using rule 325 (class_name_reference) + + +state 146 + + 222 expr_without_variable: T_NEW class_name_reference . @41 ctor_arguments + + $default reduce using rule 221 (@41) + + @41 go to state 280 + + +state 147 + + 326 class_name_reference: dynamic_class_name_reference . + + $default reduce using rule 326 (class_name_reference) + + +state 148 + + 398 static_member: variable_class_name . T_PAAMAYIM_NEKUDOTAYIM variable_without_objects + + T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 281 + + +state 149 + + 329 dynamic_class_name_reference: base_variable . T_OBJECT_OPERATOR @59 object_property @60 dynamic_class_name_variable_properties + 330 | base_variable . + + T_OBJECT_OPERATOR shift, and go to state 282 + + $default reduce using rule 330 (dynamic_class_name_reference) + + +state 150 + + 399 variable_class_name: reference_variable . + 402 base_variable: reference_variable . + 405 reference_variable: reference_variable . '[' dim_offset ']' + 406 | reference_variable . '{' expr '}' - 351 base_variable: simple_indirect_reference . reference_variable - 369 simple_indirect_reference: simple_indirect_reference . '$' + '[' shift, and go to state 266 + '{' shift, and go to state 267 + + T_PAAMAYIM_NEKUDOTAYIM reduce using rule 399 (variable_class_name) + $default reduce using rule 402 (base_variable) + + +state 151 + + 403 base_variable: simple_indirect_reference . reference_variable + 421 simple_indirect_reference: simple_indirect_reference . '$' T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 226 + '$' shift, and go to state 268 - reference_variable go to state 234 - compound_variable go to state 97 + reference_variable go to state 283 + compound_variable go to state 107 -state 132 +state 152 - 296 exit_expr: '(' . ')' - 297 | '(' . expr ')' + 335 exit_expr: '(' . ')' + 336 | '(' . expr ')' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -4506,57 +5106,66 @@ state 132 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ')' shift, and go to state 235 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 236 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ')' shift, and go to state 284 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 285 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 133 +state 153 - 270 expr_without_variable: T_EXIT exit_expr . + 286 expr_without_variable: T_EXIT exit_expr . - $default reduce using rule 270 (expr_without_variable) + $default reduce using rule 286 (expr_without_variable) -state 134 +state 154 - 20 unticked_statement: T_IF '(' . expr ')' @3 statement @4 elseif_list else_single - 23 | T_IF '(' . expr ')' ':' @5 inner_statement_list @6 new_elseif_list new_else_single T_ENDIF ';' + 38 unticked_statement: T_IF '(' . expr ')' @5 statement @6 elseif_list else_single + 41 | T_IF '(' . expr ')' ':' @7 inner_statement_list @8 new_elseif_list new_else_single T_ENDIF ';' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -4583,126 +5192,134 @@ state 134 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 237 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 286 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 135 - - 278 function_call: T_STRING '(' . @49 function_call_parameter_list ')' +state 155 - $default reduce using rule 277 (@49) + 34 statement: T_STRING ':' . - @49 go to state 238 + $default reduce using rule 34 (statement) -state 136 +state 156 - 45 unticked_statement: T_ECHO echo_expr_list . ';' - 194 echo_expr_list: echo_expr_list . ',' expr + 63 unticked_statement: T_ECHO echo_expr_list . ';' + 208 echo_expr_list: echo_expr_list . ',' expr - ',' shift, and go to state 239 - ';' shift, and go to state 240 + ',' shift, and go to state 287 + ';' shift, and go to state 288 -state 137 +state 157 - 195 echo_expr_list: expr . - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 195 (echo_expr_list) + 209 echo_expr_list: expr . + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 209 (echo_expr_list) -state 138 +state 158 - 29 unticked_statement: T_DO @9 . statement T_WHILE '(' @10 expr ')' ';' + 47 unticked_statement: T_DO @11 . statement T_WHILE '(' @12 expr ')' ';' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -4744,64 +5361,72 @@ state 138 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - statement go to state 241 - unticked_statement go to state 76 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + statement go to state 289 + unticked_statement go to state 84 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 139 +state 159 - 26 unticked_statement: T_WHILE '(' . @7 expr ')' @8 while_statement + 44 unticked_statement: T_WHILE '(' . @9 expr ')' @10 while_statement - $default reduce using rule 24 (@7) + $default reduce using rule 42 (@9) - @7 go to state 242 + @9 go to state 290 -state 140 +state 160 - 33 unticked_statement: T_FOR '(' . for_expr ';' @11 for_expr ';' @12 for_expr ')' @13 for_statement + 51 unticked_statement: T_FOR '(' . for_expr ';' @13 for_expr ';' @14 for_expr ')' @15 for_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -4828,53 +5453,62 @@ state 140 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 196 (for_expr) - - for_expr go to state 243 - non_empty_for_expr go to state 244 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 245 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 210 (for_expr) + + namespace_name go to state 80 + for_expr go to state 291 + non_empty_for_expr go to state 292 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 293 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 141 +state 161 - 52 unticked_statement: T_FOREACH '(' . variable T_AS @15 foreach_variable foreach_optional_arg ')' @16 foreach_statement - 55 | T_FOREACH '(' . expr_without_variable T_AS @17 variable foreach_optional_arg ')' @18 foreach_statement + 69 unticked_statement: T_FOREACH '(' . variable T_AS @17 foreach_variable foreach_optional_arg ')' @18 foreach_statement + 72 | T_FOREACH '(' . expr_without_variable T_AS @19 variable foreach_optional_arg ')' @20 foreach_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -4901,55 +5535,64 @@ state 141 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 246 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 151 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 247 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 294 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 295 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 142 +state 162 - 57 unticked_statement: T_DECLARE @19 . '(' declare_list ')' declare_statement + 74 unticked_statement: T_DECLARE @21 . '(' declare_list ')' declare_statement - '(' shift, and go to state 248 + '(' shift, and go to state 296 -state 143 +state 163 - 35 unticked_statement: T_SWITCH '(' . expr ')' @14 switch_case_list + 53 unticked_statement: T_SWITCH '(' . expr ')' @16 switch_case_list T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -4976,550 +5619,603 @@ state 143 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 249 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 297 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 144 +state 164 - 36 unticked_statement: T_BREAK ';' . + 54 unticked_statement: T_BREAK ';' . - $default reduce using rule 36 (unticked_statement) + $default reduce using rule 54 (unticked_statement) -state 145 +state 165 - 37 unticked_statement: T_BREAK expr . ';' - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ';' shift, and go to state 250 + 55 unticked_statement: T_BREAK expr . ';' + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ';' shift, and go to state 298 -state 146 +state 166 - 38 unticked_statement: T_CONTINUE ';' . + 56 unticked_statement: T_CONTINUE ';' . - $default reduce using rule 38 (unticked_statement) + $default reduce using rule 56 (unticked_statement) -state 147 +state 167 - 39 unticked_statement: T_CONTINUE expr . ';' - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ';' shift, and go to state 251 + 57 unticked_statement: T_CONTINUE expr . ';' + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ';' shift, and go to state 299 -state 148 +state 168 - 84 unticked_function_declaration_statement: T_FUNCTION @27 . is_reference T_STRING @28 '(' parameter_list ')' '{' inner_statement_list '}' + 83 unticked_statement: T_GOTO T_STRING . ';' - '&' shift, and go to state 252 + ';' shift, and go to state 300 - $default reduce using rule 80 (is_reference) - is_reference go to state 253 +state 169 + 25 constant_declaration: T_CONST T_STRING . '=' static_scalar -state 149 + '=' shift, and go to state 301 - 40 unticked_statement: T_RETURN ';' . - $default reduce using rule 40 (unticked_statement) +state 170 + 58 unticked_statement: T_RETURN ';' . -state 150 + $default reduce using rule 58 (unticked_statement) - 41 unticked_statement: T_RETURN expr_without_variable . ';' - 330 expr: expr_without_variable . - ';' shift, and go to state 254 +state 171 - $default reduce using rule 330 (expr) + 59 unticked_statement: T_RETURN expr_without_variable . ';' + 380 expr: expr_without_variable . + ';' shift, and go to state 302 -state 151 + $default reduce using rule 380 (expr) - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 +state 172 -state 152 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - 42 unticked_statement: T_RETURN variable . ';' - 203 expr_without_variable: variable . '=' expr - 204 | variable . '=' '&' variable - 206 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments - 210 | variable . T_PLUS_EQUAL expr - 211 | variable . T_MINUS_EQUAL expr - 212 | variable . T_MUL_EQUAL expr - 213 | variable . T_DIV_EQUAL expr - 214 | variable . T_CONCAT_EQUAL expr - 215 | variable . T_MOD_EQUAL expr - 216 | variable . T_AND_EQUAL expr - 217 | variable . T_OR_EQUAL expr - 218 | variable . T_XOR_EQUAL expr - 219 | variable . T_SL_EQUAL expr - 220 | variable . T_SR_EQUAL expr - 331 r_variable: variable . - 333 rw_variable: variable . - - '=' shift, and go to state 210 - T_SR_EQUAL shift, and go to state 211 - T_SL_EQUAL shift, and go to state 212 - T_XOR_EQUAL shift, and go to state 213 - T_OR_EQUAL shift, and go to state 214 - T_AND_EQUAL shift, and go to state 215 - T_MOD_EQUAL shift, and go to state 216 - T_CONCAT_EQUAL shift, and go to state 217 - T_DIV_EQUAL shift, and go to state 218 - T_MUL_EQUAL shift, and go to state 219 - T_MINUS_EQUAL shift, and go to state 220 - T_PLUS_EQUAL shift, and go to state 221 - ';' shift, and go to state 255 - - T_DEC reduce using rule 333 (rw_variable) - T_INC reduce using rule 333 (rw_variable) - $default reduce using rule 331 (r_variable) +state 173 -state 153 + 60 unticked_statement: T_RETURN variable . ';' + 217 expr_without_variable: variable . '=' expr + 218 | variable . '=' '&' variable + 220 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments + 224 | variable . T_PLUS_EQUAL expr + 225 | variable . T_MINUS_EQUAL expr + 226 | variable . T_MUL_EQUAL expr + 227 | variable . T_DIV_EQUAL expr + 228 | variable . T_CONCAT_EQUAL expr + 229 | variable . T_MOD_EQUAL expr + 230 | variable . T_AND_EQUAL expr + 231 | variable . T_OR_EQUAL expr + 232 | variable . T_XOR_EQUAL expr + 233 | variable . T_SL_EQUAL expr + 234 | variable . T_SR_EQUAL expr + 381 r_variable: variable . + 383 rw_variable: variable . + + '=' shift, and go to state 251 + T_SR_EQUAL shift, and go to state 252 + T_SL_EQUAL shift, and go to state 253 + T_XOR_EQUAL shift, and go to state 254 + T_OR_EQUAL shift, and go to state 255 + T_AND_EQUAL shift, and go to state 256 + T_MOD_EQUAL shift, and go to state 257 + T_CONCAT_EQUAL shift, and go to state 258 + T_DIV_EQUAL shift, and go to state 259 + T_MUL_EQUAL shift, and go to state 260 + T_MINUS_EQUAL shift, and go to state 261 + T_PLUS_EQUAL shift, and go to state 262 + ';' shift, and go to state 303 + + T_DEC reduce using rule 383 (rw_variable) + T_INC reduce using rule 383 (rw_variable) + $default reduce using rule 381 (r_variable) - 64 unticked_statement: T_TRY @20 . '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches - '{' shift, and go to state 256 +state 174 + 81 unticked_statement: T_TRY @22 . '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches -state 154 + '{' shift, and go to state 304 - 65 unticked_statement: T_THROW expr . ';' - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ';' shift, and go to state 257 +state 175 -state 155 + 82 unticked_statement: T_THROW expr . ';' + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ';' shift, and go to state 305 - 76 use_filename: T_CONSTANT_ENCAPSED_STRING . - $default reduce using rule 76 (use_filename) +state 176 + 22 use_declaration: T_NS_SEPARATOR . namespace_name + 23 | T_NS_SEPARATOR . namespace_name T_AS T_STRING -state 156 + T_STRING shift, and go to state 111 - 77 use_filename: '(' . T_CONSTANT_ENCAPSED_STRING ')' + namespace_name go to state 306 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 258 +state 177 -state 157 + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 20 use_declaration: namespace_name . + 21 | namespace_name . T_AS T_STRING - 48 unticked_statement: T_USE use_filename . ';' + T_AS shift, and go to state 307 + T_NS_SEPARATOR shift, and go to state 213 - ';' shift, and go to state 259 + $default reduce using rule 20 (use_declaration) -state 158 +state 178 - 159 global_var: T_VARIABLE . + 16 top_statement: T_USE use_declarations . ';' + 18 use_declarations: use_declarations . ',' use_declaration - $default reduce using rule 159 (global_var) + ',' shift, and go to state 308 + ';' shift, and go to state 309 -state 159 +state 179 - 160 global_var: '$' . r_variable - 161 | '$' . '{' expr '}' + 19 use_declarations: use_declaration . - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '{' shift, and go to state 260 - '$' shift, and go to state 71 - - function_call go to state 84 - fully_qualified_class_name go to state 120 - r_variable go to state 261 - variable go to state 262 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + $default reduce using rule 19 (use_declarations) -state 160 +state 180 - 43 unticked_statement: T_GLOBAL global_var_list . ';' - 157 global_var_list: global_var_list . ',' global_var + 174 global_var: T_VARIABLE . - ',' shift, and go to state 263 - ';' shift, and go to state 264 + $default reduce using rule 174 (global_var) -state 161 +state 181 - 158 global_var_list: global_var . + 175 global_var: '$' . r_variable + 176 | '$' . '{' expr '}' + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '{' shift, and go to state 310 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + r_variable go to state 311 + variable go to state 312 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 - $default reduce using rule 158 (global_var_list) +state 182 -state 162 + 61 unticked_statement: T_GLOBAL global_var_list . ';' + 172 global_var_list: global_var_list . ',' global_var - 91 class_entry_type: T_FINAL T_CLASS . + ',' shift, and go to state 313 + ';' shift, and go to state 314 - $default reduce using rule 91 (class_entry_type) +state 183 -state 163 + 173 global_var_list: global_var . - 90 class_entry_type: T_ABSTRACT T_CLASS . + $default reduce using rule 173 (global_var_list) - $default reduce using rule 90 (class_entry_type) +state 184 -state 164 + 106 class_entry_type: T_FINAL T_CLASS . - 164 static_var_list: T_VARIABLE . - 165 | T_VARIABLE . '=' static_scalar + $default reduce using rule 106 (class_entry_type) - '=' shift, and go to state 265 - $default reduce using rule 164 (static_var_list) +state 185 + 105 class_entry_type: T_ABSTRACT T_CLASS . -state 165 + $default reduce using rule 105 (class_entry_type) - 44 unticked_statement: T_STATIC static_var_list . ';' - 162 static_var_list: static_var_list . ',' T_VARIABLE - 163 | static_var_list . ',' T_VARIABLE '=' static_scalar - ',' shift, and go to state 266 - ';' shift, and go to state 267 +state 186 + 179 static_var_list: T_VARIABLE . + 180 | T_VARIABLE . '=' static_scalar -state 166 + '=' shift, and go to state 315 - 49 unticked_statement: T_UNSET '(' . unset_variables ')' ';' + $default reduce using rule 179 (static_var_list) - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - - unset_variables go to state 268 - unset_variable go to state 269 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 270 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 +state 187 -state 167 + 62 unticked_statement: T_STATIC static_var_list . ';' + 177 static_var_list: static_var_list . ',' T_VARIABLE + 178 | static_var_list . ',' T_VARIABLE '=' static_scalar - 399 internal_functions_in_yacc: T_ISSET '(' . isset_variables ')' + ',' shift, and go to state 316 + ';' shift, and go to state 317 - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 271 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - isset_variables go to state 272 +state 188 + + 66 unticked_statement: T_UNSET '(' . unset_variables ')' ';' + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + unset_variables go to state 318 + unset_variable go to state 319 + function_call go to state 93 + class_name go to state 136 + variable go to state 320 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 -state 168 +state 189 - 400 internal_functions_in_yacc: T_EMPTY '(' . variable ')' + 452 internal_functions_in_yacc: T_ISSET '(' . isset_variables ')' + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 321 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + isset_variables go to state 322 - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 273 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 +state 190 + 453 internal_functions_in_yacc: T_EMPTY '(' . variable ')' + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 323 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 -state 169 - 8 top_statement: T_HALT_COMPILER '(' . ')' ';' +state 191 - ')' shift, and go to state 274 + 10 top_statement: T_HALT_COMPILER '(' . ')' ';' + ')' shift, and go to state 324 -state 170 - 202 expr_without_variable: T_LIST '(' . @39 assignment_list ')' '=' expr +state 192 - $default reduce using rule 201 (@39) + 216 expr_without_variable: T_LIST '(' . @39 assignment_list ')' '=' expr - @39 go to state 275 + $default reduce using rule 215 (@39) + @39 go to state 325 -state 171 - 274 expr_without_variable: T_ARRAY '(' . array_pair_list ')' +state 193 + + 290 expr_without_variable: T_ARRAY '(' . array_pair_list ')' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -5527,7 +6223,7 @@ state 171 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 276 + '&' shift, and go to state 326 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -5547,138 +6243,94 @@ state 171 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 376 (array_pair_list) - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 277 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - array_pair_list go to state 278 - non_empty_array_pair_list go to state 279 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 428 (array_pair_list) + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 327 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + array_pair_list go to state 328 + non_empty_array_pair_list go to state 329 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 172 +state 194 - 320 scalar: T_START_HEREDOC encaps_list . T_END_HEREDOC - 386 encaps_list: encaps_list . encaps_var - 387 | encaps_list . T_ENCAPSED_AND_WHITESPACE + 442 encaps_var: T_VARIABLE . + 444 | T_VARIABLE . '[' @67 encaps_var_offset ']' + 445 | T_VARIABLE . T_OBJECT_OPERATOR T_STRING - T_VARIABLE shift, and go to state 280 - T_ENCAPSED_AND_WHITESPACE shift, and go to state 281 - T_END_HEREDOC shift, and go to state 282 - T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 283 - T_CURLY_OPEN shift, and go to state 284 + '[' shift, and go to state 330 + T_OBJECT_OPERATOR shift, and go to state 331 - encaps_var go to state 285 + $default reduce using rule 442 (encaps_var) -state 173 +state 195 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 258 | '(' expr . ')' - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ')' shift, and go to state 286 + 352 common_scalar: T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE . T_END_HEREDOC + 441 encaps_list: T_ENCAPSED_AND_WHITESPACE . encaps_var + T_VARIABLE shift, and go to state 194 + T_END_HEREDOC shift, and go to state 332 + T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 197 + T_CURLY_OPEN shift, and go to state 198 -state 174 + encaps_var go to state 333 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 17 unticked_statement: '{' inner_statement_list . '}' - '}' shift, and go to state 287 +state 196 - $default reduce using rule 9 (@2) + 353 common_scalar: T_START_HEREDOC T_END_HEREDOC . - @2 go to state 288 + $default reduce using rule 353 (common_scalar) -state 175 +state 197 - 357 compound_variable: '$' '{' . expr '}' + 446 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES . expr '}' + 447 | T_DOLLAR_OPEN_CURLY_BRACES . T_STRING_VARNAME '[' expr ']' '}' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -5705,124 +6357,453 @@ state 175 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 - T_STRING_VARNAME shift, and go to state 32 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 334 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 289 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 335 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 176 +state 198 - 275 expr_without_variable: '`' encaps_list . '`' - 386 encaps_list: encaps_list . encaps_var - 387 | encaps_list . T_ENCAPSED_AND_WHITESPACE + 448 encaps_var: T_CURLY_OPEN . variable '}' + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 336 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 - T_VARIABLE shift, and go to state 280 - T_ENCAPSED_AND_WHITESPACE shift, and go to state 281 - T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 283 - T_CURLY_OPEN shift, and go to state 284 - '`' shift, and go to state 290 - encaps_var go to state 285 +state 199 + 370 scalar: T_START_HEREDOC encaps_list . T_END_HEREDOC + 438 encaps_list: encaps_list . encaps_var + 439 | encaps_list . T_ENCAPSED_AND_WHITESPACE -state 177 + T_VARIABLE shift, and go to state 194 + T_ENCAPSED_AND_WHITESPACE shift, and go to state 337 + T_END_HEREDOC shift, and go to state 338 + T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 197 + T_CURLY_OPEN shift, and go to state 198 - 319 scalar: '"' encaps_list . '"' - 386 encaps_list: encaps_list . encaps_var - 387 | encaps_list . T_ENCAPSED_AND_WHITESPACE + encaps_var go to state 339 - T_VARIABLE shift, and go to state 280 - T_ENCAPSED_AND_WHITESPACE shift, and go to state 281 - T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 283 - T_CURLY_OPEN shift, and go to state 284 - '"' shift, and go to state 291 - encaps_var go to state 285 +state 200 + 440 encaps_list: encaps_var . + + $default reduce using rule 440 (encaps_list) -state 178 - 86 unticked_class_declaration_statement: class_entry_type T_STRING . extends_from @29 implements_list '{' class_statement_list '}' +state 201 - T_EXTENDS shift, and go to state 292 + 305 function_call: T_NAMESPACE T_NS_SEPARATOR . namespace_name '(' @52 function_call_parameter_list ')' + 320 class_name: T_NAMESPACE T_NS_SEPARATOR . namespace_name + 366 scalar: T_NAMESPACE T_NS_SEPARATOR . namespace_name - $default reduce using rule 92 (extends_from) + T_STRING shift, and go to state 111 - extends_from go to state 293 + namespace_name go to state 340 -state 179 +state 202 - 88 unticked_class_declaration_statement: interface_entry T_STRING . @30 interface_extends_list '{' class_statement_list '}' + 15 top_statement: T_NAMESPACE '{' . @3 top_statement_list '}' - $default reduce using rule 87 (@30) + $default reduce using rule 14 (@3) - @30 go to state 294 + @3 go to state 341 -state 180 +state 203 + + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 11 top_statement: T_NAMESPACE namespace_name . ';' + 13 | T_NAMESPACE namespace_name . '{' @2 top_statement_list '}' + + T_NS_SEPARATOR shift, and go to state 213 + ';' shift, and go to state 342 + '{' shift, and go to state 343 + + +state 204 + + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 307 function_call: T_NS_SEPARATOR namespace_name . '(' @53 function_call_parameter_list ')' + 321 class_name: T_NS_SEPARATOR namespace_name . + 367 scalar: T_NS_SEPARATOR namespace_name . + + T_NS_SEPARATOR shift, and go to state 213 + '(' shift, and go to state 344 + + T_PAAMAYIM_NEKUDOTAYIM reduce using rule 321 (class_name) + $default reduce using rule 367 (scalar) + + +state 205 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 272 | '(' expr . ')' + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ')' shift, and go to state 345 + + +state 206 + + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 35 unticked_statement: '{' inner_statement_list . '}' + + '}' shift, and go to state 346 + + $default reduce using rule 26 (@4) + + @4 go to state 347 + + +state 207 + + 409 compound_variable: '$' '{' . expr '}' + + T_REQUIRE_ONCE shift, and go to state 5 + T_REQUIRE shift, and go to state 6 + T_EVAL shift, and go to state 7 + T_INCLUDE_ONCE shift, and go to state 8 + T_INCLUDE shift, and go to state 9 + T_PRINT shift, and go to state 10 + '+' shift, and go to state 11 + '-' shift, and go to state 12 + '!' shift, and go to state 13 + '~' shift, and go to state 14 + '@' shift, and go to state 15 + T_UNSET_CAST shift, and go to state 16 + T_BOOL_CAST shift, and go to state 17 + T_OBJECT_CAST shift, and go to state 18 + T_ARRAY_CAST shift, and go to state 19 + T_STRING_CAST shift, and go to state 20 + T_DOUBLE_CAST shift, and go to state 21 + T_INT_CAST shift, and go to state 22 + T_DEC shift, and go to state 23 + T_INC shift, and go to state 24 + T_CLONE shift, and go to state 25 + T_NEW shift, and go to state 26 + T_EXIT shift, and go to state 27 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 32 + T_VARIABLE shift, and go to state 33 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 348 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 + + +state 208 + + 338 backticks_expr: T_ENCAPSED_AND_WHITESPACE . + 441 encaps_list: T_ENCAPSED_AND_WHITESPACE . encaps_var + + T_VARIABLE shift, and go to state 194 + T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 197 + T_CURLY_OPEN shift, and go to state 198 + + $default reduce using rule 338 (backticks_expr) + + encaps_var go to state 333 + + +state 209 + + 291 expr_without_variable: '`' backticks_expr . '`' + + '`' shift, and go to state 349 + + +state 210 + + 339 backticks_expr: encaps_list . + 438 encaps_list: encaps_list . encaps_var + 439 | encaps_list . T_ENCAPSED_AND_WHITESPACE + + T_VARIABLE shift, and go to state 194 + T_ENCAPSED_AND_WHITESPACE shift, and go to state 337 + T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 197 + T_CURLY_OPEN shift, and go to state 198 + + $default reduce using rule 339 (backticks_expr) + + encaps_var go to state 339 + + +state 211 + + 441 encaps_list: T_ENCAPSED_AND_WHITESPACE . encaps_var + + T_VARIABLE shift, and go to state 194 + T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 197 + T_CURLY_OPEN shift, and go to state 198 + + encaps_var go to state 333 + + +state 212 + + 369 scalar: '"' encaps_list . '"' + 438 encaps_list: encaps_list . encaps_var + 439 | encaps_list . T_ENCAPSED_AND_WHITESPACE + + T_VARIABLE shift, and go to state 194 + T_ENCAPSED_AND_WHITESPACE shift, and go to state 337 + T_DOLLAR_OPEN_CURLY_BRACES shift, and go to state 197 + T_CURLY_OPEN shift, and go to state 198 + '"' shift, and go to state 350 + + encaps_var go to state 339 + + +state 213 + + 6 namespace_name: namespace_name T_NS_SEPARATOR . T_STRING + + T_STRING shift, and go to state 351 + + +state 214 + + 303 function_call: namespace_name '(' . @51 function_call_parameter_list ')' + + $default reduce using rule 302 (@51) + + @51 go to state 352 + + +state 215 + + 24 constant_declaration: constant_declaration ',' . T_STRING '=' static_scalar + + T_STRING shift, and go to state 353 + + +state 216 + + 17 top_statement: constant_declaration ';' . + + $default reduce using rule 17 (top_statement) + + +state 217 + + 101 unticked_class_declaration_statement: class_entry_type T_STRING . extends_from @30 implements_list '{' class_statement_list '}' + + T_EXTENDS shift, and go to state 354 + + $default reduce using rule 107 (extends_from) + + extends_from go to state 355 + + +state 218 + + 103 unticked_class_declaration_statement: interface_entry T_STRING . @31 interface_extends_list '{' class_statement_list '}' + + $default reduce using rule 102 (@31) + + @31 go to state 356 + + +state 219 + + 97 is_reference: '&' . - 280 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING '(' @50 function_call_parameter_list ')' - 282 | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects '(' @51 function_call_parameter_list ')' - 347 static_member: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects - 409 class_constant: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING + $default reduce using rule 97 (is_reference) - T_STRING shift, and go to state 295 + +state 220 + + 99 unticked_function_declaration_statement: function is_reference . T_STRING @29 '(' parameter_list ')' '{' inner_statement_list '}' + 294 expr_without_variable: function is_reference . '(' @50 parameter_list ')' lexical_vars '{' inner_statement_list '}' + + T_STRING shift, and go to state 357 + '(' shift, and go to state 358 + + +state 221 + + 309 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING '(' @54 function_call_parameter_list ')' + 311 | class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects '(' @55 function_call_parameter_list ')' + 397 static_member: class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects + 462 class_constant: class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING + + T_STRING shift, and go to state 359 T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + '$' shift, and go to state 77 - variable_without_objects go to state 296 - reference_variable go to state 297 - compound_variable go to state 97 - simple_indirect_reference go to state 298 + variable_without_objects go to state 360 + reference_variable go to state 361 + compound_variable go to state 107 + simple_indirect_reference go to state 362 -state 181 +state 222 - 230 expr_without_variable: expr T_LOGICAL_OR . @44 expr + 244 expr_without_variable: expr T_LOGICAL_OR . @44 expr - $default reduce using rule 229 (@44) + $default reduce using rule 243 (@44) - @44 go to state 299 + @44 go to state 363 -state 182 +state 223 - 233 expr_without_variable: expr T_LOGICAL_XOR . expr + 247 expr_without_variable: expr T_LOGICAL_XOR . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -5849,84 +6830,96 @@ state 182 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 300 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 364 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 183 +state 224 - 232 expr_without_variable: expr T_LOGICAL_AND . @45 expr + 246 expr_without_variable: expr T_LOGICAL_AND . @45 expr - $default reduce using rule 231 (@45) + $default reduce using rule 245 (@45) - @45 go to state 301 + @45 go to state 365 -state 184 +state 225 - 261 expr_without_variable: expr '?' . @46 expr ':' @47 expr + 275 expr_without_variable: expr '?' . @46 expr ':' @47 expr + 277 | expr '?' . ':' @48 expr - $default reduce using rule 259 (@46) + ':' shift, and go to state 366 - @46 go to state 302 + $default reduce using rule 273 (@46) + @46 go to state 367 -state 185 - 226 expr_without_variable: expr T_BOOLEAN_OR . @42 expr +state 226 + + 240 expr_without_variable: expr T_BOOLEAN_OR . @42 expr - $default reduce using rule 225 (@42) + $default reduce using rule 239 (@42) - @42 go to state 303 + @42 go to state 368 -state 186 +state 227 - 228 expr_without_variable: expr T_BOOLEAN_AND . @43 expr + 242 expr_without_variable: expr T_BOOLEAN_AND . @43 expr - $default reduce using rule 227 (@43) + $default reduce using rule 241 (@43) - @43 go to state 304 + @43 go to state 369 -state 187 +state 228 - 234 expr_without_variable: expr '|' . expr + 248 expr_without_variable: expr '|' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -5953,48 +6946,57 @@ state 187 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 305 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 370 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 188 +state 229 - 236 expr_without_variable: expr '^' . expr + 250 expr_without_variable: expr '^' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6021,48 +7023,57 @@ state 188 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 306 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 371 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 189 +state 230 - 235 expr_without_variable: expr '&' . expr + 249 expr_without_variable: expr '&' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6089,48 +7100,57 @@ state 189 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 307 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 372 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 190 +state 231 - 250 expr_without_variable: expr T_IS_NOT_IDENTICAL . expr + 264 expr_without_variable: expr T_IS_NOT_IDENTICAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6157,48 +7177,57 @@ state 190 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 308 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 373 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 191 +state 232 - 249 expr_without_variable: expr T_IS_IDENTICAL . expr + 263 expr_without_variable: expr T_IS_IDENTICAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6225,48 +7254,57 @@ state 191 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 309 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 374 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 192 +state 233 - 252 expr_without_variable: expr T_IS_NOT_EQUAL . expr + 266 expr_without_variable: expr T_IS_NOT_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6293,48 +7331,57 @@ state 192 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 310 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 375 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 193 +state 234 - 251 expr_without_variable: expr T_IS_EQUAL . expr + 265 expr_without_variable: expr T_IS_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6361,48 +7408,57 @@ state 193 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 311 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 376 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 194 +state 235 - 253 expr_without_variable: expr '<' . expr + 267 expr_without_variable: expr '<' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6429,48 +7485,57 @@ state 194 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 312 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 377 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 195 +state 236 - 255 expr_without_variable: expr '>' . expr + 269 expr_without_variable: expr '>' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6497,48 +7562,57 @@ state 195 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 313 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 378 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 196 +state 237 - 256 expr_without_variable: expr T_IS_GREATER_OR_EQUAL . expr + 270 expr_without_variable: expr T_IS_GREATER_OR_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6565,48 +7639,57 @@ state 196 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 314 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 379 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 197 +state 238 - 254 expr_without_variable: expr T_IS_SMALLER_OR_EQUAL . expr + 268 expr_without_variable: expr T_IS_SMALLER_OR_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6633,48 +7716,57 @@ state 197 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 315 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 380 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 198 +state 239 - 244 expr_without_variable: expr T_SR . expr + 258 expr_without_variable: expr T_SR . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6701,48 +7793,57 @@ state 198 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 316 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 381 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 199 +state 240 - 243 expr_without_variable: expr T_SL . expr + 257 expr_without_variable: expr T_SL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6769,48 +7870,57 @@ state 199 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 317 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 382 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 200 +state 241 - 238 expr_without_variable: expr '+' . expr + 252 expr_without_variable: expr '+' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6837,48 +7947,57 @@ state 200 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 318 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 383 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 201 +state 242 - 239 expr_without_variable: expr '-' . expr + 253 expr_without_variable: expr '-' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6905,48 +8024,57 @@ state 201 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 319 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 384 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 202 +state 243 - 237 expr_without_variable: expr '.' . expr + 251 expr_without_variable: expr '.' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -6973,48 +8101,57 @@ state 202 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 320 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 385 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 203 +state 244 - 240 expr_without_variable: expr '*' . expr + 254 expr_without_variable: expr '*' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7041,48 +8178,57 @@ state 203 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 321 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 386 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 204 +state 245 - 241 expr_without_variable: expr '/' . expr + 255 expr_without_variable: expr '/' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7109,48 +8255,57 @@ state 204 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 322 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 387 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 205 +state 246 - 242 expr_without_variable: expr '%' . expr + 256 expr_without_variable: expr '%' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7177,89 +8332,103 @@ state 205 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 323 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 388 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 206 +state 247 - 257 expr_without_variable: expr T_INSTANCEOF . class_name_reference + 271 expr_without_variable: expr T_INSTANCEOF . class_name_reference - T_STRING shift, and go to state 125 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 142 + T_NS_SEPARATOR shift, and go to state 143 + '$' shift, and go to state 77 - fully_qualified_class_name go to state 126 - class_name_reference go to state 324 - dynamic_class_name_reference go to state 128 - static_member go to state 93 - base_variable go to state 129 - reference_variable go to state 130 - compound_variable go to state 97 - simple_indirect_reference go to state 131 + namespace_name go to state 144 + class_name go to state 145 + class_name_reference go to state 389 + dynamic_class_name_reference go to state 147 + static_member go to state 102 + variable_class_name go to state 148 + base_variable go to state 149 + reference_variable go to state 150 + compound_variable go to state 107 + simple_indirect_reference go to state 151 -state 207 +state 248 - 47 unticked_statement: expr ';' . + 65 unticked_statement: expr ';' . - $default reduce using rule 47 (unticked_statement) + $default reduce using rule 65 (unticked_statement) -state 208 +state 249 - 223 expr_without_variable: rw_variable T_DEC . + 237 expr_without_variable: rw_variable T_DEC . - $default reduce using rule 223 (expr_without_variable) + $default reduce using rule 237 (expr_without_variable) -state 209 +state 250 - 221 expr_without_variable: rw_variable T_INC . + 235 expr_without_variable: rw_variable T_INC . - $default reduce using rule 221 (expr_without_variable) + $default reduce using rule 235 (expr_without_variable) -state 210 +state 251 - 203 expr_without_variable: variable '=' . expr - 204 | variable '=' . '&' variable - 206 | variable '=' . '&' T_NEW class_name_reference @40 ctor_arguments + 217 expr_without_variable: variable '=' . expr + 218 | variable '=' . '&' variable + 220 | variable '=' . '&' T_NEW class_name_reference @40 ctor_arguments T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7267,7 +8436,7 @@ state 210 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 325 + '&' shift, and go to state 390 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -7287,48 +8456,57 @@ state 210 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 326 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 391 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 211 +state 252 - 220 expr_without_variable: variable T_SR_EQUAL . expr + 234 expr_without_variable: variable T_SR_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7355,48 +8533,57 @@ state 211 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 327 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 392 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 212 +state 253 - 219 expr_without_variable: variable T_SL_EQUAL . expr + 233 expr_without_variable: variable T_SL_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7423,48 +8610,57 @@ state 212 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 328 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 393 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 213 +state 254 - 218 expr_without_variable: variable T_XOR_EQUAL . expr + 232 expr_without_variable: variable T_XOR_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7491,48 +8687,57 @@ state 213 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 329 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 394 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 214 +state 255 - 217 expr_without_variable: variable T_OR_EQUAL . expr + 231 expr_without_variable: variable T_OR_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7559,48 +8764,57 @@ state 214 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 330 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 395 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 215 +state 256 - 216 expr_without_variable: variable T_AND_EQUAL . expr + 230 expr_without_variable: variable T_AND_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7627,48 +8841,57 @@ state 215 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 331 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 396 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 216 +state 257 - 215 expr_without_variable: variable T_MOD_EQUAL . expr + 229 expr_without_variable: variable T_MOD_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7695,48 +8918,57 @@ state 216 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 332 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 397 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 217 +state 258 - 214 expr_without_variable: variable T_CONCAT_EQUAL . expr + 228 expr_without_variable: variable T_CONCAT_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7763,48 +8995,57 @@ state 217 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 333 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 398 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 218 +state 259 - 213 expr_without_variable: variable T_DIV_EQUAL . expr + 227 expr_without_variable: variable T_DIV_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7831,48 +9072,57 @@ state 218 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 334 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 399 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 219 +state 260 - 212 expr_without_variable: variable T_MUL_EQUAL . expr + 226 expr_without_variable: variable T_MUL_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7899,48 +9149,57 @@ state 219 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 335 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 400 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 220 +state 261 - 211 expr_without_variable: variable T_MINUS_EQUAL . expr + 225 expr_without_variable: variable T_MINUS_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -7967,48 +9226,57 @@ state 220 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 336 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 401 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 221 +state 262 - 210 expr_without_variable: variable T_PLUS_EQUAL . expr + 224 expr_without_variable: variable T_PLUS_EQUAL . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -8035,66 +9303,92 @@ state 221 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 337 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 402 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 222 +state 263 - 284 function_call: variable_without_objects '(' . @52 function_call_parameter_list ')' + 317 function_call: variable_without_objects '(' . @58 function_call_parameter_list ')' - $default reduce using rule 283 (@52) + $default reduce using rule 316 (@58) - @52 go to state 338 + @58 go to state 403 -state 223 +state 264 - 336 variable: base_variable_with_function_calls T_OBJECT_OPERATOR . @55 object_property @56 method_or_not variable_properties + 313 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING '(' @56 function_call_parameter_list ')' + 315 | variable_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects '(' @57 function_call_parameter_list ')' + 398 static_member: variable_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects + 463 class_constant: variable_class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING - $default reduce using rule 334 (@55) + T_STRING shift, and go to state 404 + T_VARIABLE shift, and go to state 33 + '$' shift, and go to state 77 - @55 go to state 339 + variable_without_objects go to state 405 + reference_variable go to state 361 + compound_variable go to state 107 + simple_indirect_reference go to state 362 -state 224 +state 265 + + 386 variable: base_variable_with_function_calls T_OBJECT_OPERATOR . @61 object_property @62 method_or_not variable_properties + + $default reduce using rule 384 (@61) + + @61 go to state 406 + - 353 reference_variable: reference_variable '[' . dim_offset ']' +state 266 + + 405 reference_variable: reference_variable '[' . dim_offset ']' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -8121,51 +9415,60 @@ state 224 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 358 (dim_offset) - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 340 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - dim_offset go to state 341 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 410 (dim_offset) + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 407 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + dim_offset go to state 408 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 225 +state 267 - 354 reference_variable: reference_variable '{' . expr '}' + 406 reference_variable: reference_variable '{' . expr '}' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -8192,424 +9495,441 @@ state 225 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 342 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 409 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 226 +state 268 - 357 compound_variable: '$' . '{' expr '}' - 369 simple_indirect_reference: simple_indirect_reference '$' . + 409 compound_variable: '$' . '{' expr '}' + 421 simple_indirect_reference: simple_indirect_reference '$' . - '{' shift, and go to state 175 + '{' shift, and go to state 207 - $default reduce using rule 369 (simple_indirect_reference) + $default reduce using rule 421 (simple_indirect_reference) -state 227 +state 269 - 346 variable_without_objects: simple_indirect_reference reference_variable . - 351 base_variable: simple_indirect_reference reference_variable . - 353 reference_variable: reference_variable . '[' dim_offset ']' - 354 | reference_variable . '{' expr '}' + 396 variable_without_objects: simple_indirect_reference reference_variable . + 403 base_variable: simple_indirect_reference reference_variable . + 405 reference_variable: reference_variable . '[' dim_offset ']' + 406 | reference_variable . '{' expr '}' - '[' shift, and go to state 224 - '{' shift, and go to state 225 + '[' shift, and go to state 266 + '{' shift, and go to state 267 - '(' reduce using rule 346 (variable_without_objects) - $default reduce using rule 351 (base_variable) + '(' reduce using rule 396 (variable_without_objects) + $default reduce using rule 403 (base_variable) -state 228 +state 270 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 403 internal_functions_in_yacc: T_EVAL '(' expr . ')' - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ')' shift, and go to state 343 + 294 expr_without_variable: function is_reference . '(' @50 parameter_list ')' lexical_vars '{' inner_statement_list '}' + '(' shift, and go to state 358 -state 229 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 272 | '@' @48 expr . +state 271 - $default reduce using rule 272 (expr_without_variable) + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 456 internal_functions_in_yacc: T_EVAL '(' expr . ')' + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ')' shift, and go to state 410 -state 230 +state 272 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 288 | '@' @49 expr . + + $default reduce using rule 288 (expr_without_variable) + + +state 273 + + 305 function_call: T_NAMESPACE T_NS_SEPARATOR . namespace_name '(' @52 function_call_parameter_list ')' + 320 class_name: T_NAMESPACE T_NS_SEPARATOR . namespace_name + + T_STRING shift, and go to state 111 + + namespace_name go to state 411 + + +state 274 + + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 307 function_call: T_NS_SEPARATOR namespace_name . '(' @53 function_call_parameter_list ')' + 321 class_name: T_NS_SEPARATOR namespace_name . + + T_NS_SEPARATOR shift, and go to state 213 + '(' shift, and go to state 344 + + $default reduce using rule 321 (class_name) + + +state 275 - 280 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING '(' @50 function_call_parameter_list ')' - 282 | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects '(' @51 function_call_parameter_list ')' - 347 static_member: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects + 309 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING '(' @54 function_call_parameter_list ')' + 311 | class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects '(' @55 function_call_parameter_list ')' + 397 static_member: class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects - T_STRING shift, and go to state 344 + T_STRING shift, and go to state 412 T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + '$' shift, and go to state 77 - variable_without_objects go to state 296 - reference_variable go to state 297 - compound_variable go to state 97 - simple_indirect_reference go to state 298 + variable_without_objects go to state 360 + reference_variable go to state 361 + compound_variable go to state 107 + simple_indirect_reference go to state 362 -state 231 +state 276 - 347 static_member: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects + 313 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING '(' @56 function_call_parameter_list ')' + 315 | variable_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects '(' @57 function_call_parameter_list ')' + 398 static_member: variable_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects + T_STRING shift, and go to state 413 T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + '$' shift, and go to state 77 - variable_without_objects go to state 345 - reference_variable go to state 297 - compound_variable go to state 97 - simple_indirect_reference go to state 298 + variable_without_objects go to state 405 + reference_variable go to state 361 + compound_variable go to state 107 + simple_indirect_reference go to state 362 -state 232 +state 277 - 208 expr_without_variable: T_NEW class_name_reference @41 . ctor_arguments + 320 class_name: T_NAMESPACE T_NS_SEPARATOR . namespace_name - '(' shift, and go to state 346 + T_STRING shift, and go to state 111 - $default reduce using rule 298 (ctor_arguments) + namespace_name go to state 414 - ctor_arguments go to state 347 +state 278 -state 233 + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 321 class_name: T_NS_SEPARATOR namespace_name . - 290 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR . @53 object_property @54 dynamic_class_name_variable_properties + T_NS_SEPARATOR shift, and go to state 213 - $default reduce using rule 288 (@53) + $default reduce using rule 321 (class_name) - @53 go to state 348 +state 279 -state 234 + 397 static_member: class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects - 351 base_variable: simple_indirect_reference reference_variable . - 353 reference_variable: reference_variable . '[' dim_offset ']' - 354 | reference_variable . '{' expr '}' + T_VARIABLE shift, and go to state 33 + '$' shift, and go to state 77 - '[' shift, and go to state 224 - '{' shift, and go to state 225 + variable_without_objects go to state 415 + reference_variable go to state 361 + compound_variable go to state 107 + simple_indirect_reference go to state 362 - $default reduce using rule 351 (base_variable) +state 280 -state 235 + 222 expr_without_variable: T_NEW class_name_reference @41 . ctor_arguments - 296 exit_expr: '(' ')' . + '(' shift, and go to state 416 - $default reduce using rule 296 (exit_expr) + $default reduce using rule 340 (ctor_arguments) + ctor_arguments go to state 417 -state 236 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 297 exit_expr: '(' expr . ')' - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ')' shift, and go to state 349 +state 281 + 398 static_member: variable_class_name T_PAAMAYIM_NEKUDOTAYIM . variable_without_objects -state 237 + T_VARIABLE shift, and go to state 33 + '$' shift, and go to state 77 - 20 unticked_statement: T_IF '(' expr . ')' @3 statement @4 elseif_list else_single - 23 | T_IF '(' expr . ')' ':' @5 inner_statement_list @6 new_elseif_list new_else_single T_ENDIF ';' - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ')' shift, and go to state 350 + variable_without_objects go to state 418 + reference_variable go to state 361 + compound_variable go to state 107 + simple_indirect_reference go to state 362 -state 238 +state 282 - 278 function_call: T_STRING '(' @49 . function_call_parameter_list ')' + 329 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR . @59 object_property @60 dynamic_class_name_variable_properties - T_REQUIRE_ONCE shift, and go to state 5 - T_REQUIRE shift, and go to state 6 - T_EVAL shift, and go to state 7 - T_INCLUDE_ONCE shift, and go to state 8 - T_INCLUDE shift, and go to state 9 - T_PRINT shift, and go to state 10 - '&' shift, and go to state 351 - '+' shift, and go to state 11 - '-' shift, and go to state 12 - '!' shift, and go to state 13 - '~' shift, and go to state 14 - '@' shift, and go to state 15 - T_UNSET_CAST shift, and go to state 16 - T_BOOL_CAST shift, and go to state 17 - T_OBJECT_CAST shift, and go to state 18 - T_ARRAY_CAST shift, and go to state 19 - T_STRING_CAST shift, and go to state 20 - T_DOUBLE_CAST shift, and go to state 21 - T_INT_CAST shift, and go to state 22 - T_DEC shift, and go to state 23 - T_INC shift, and go to state 24 - T_CLONE shift, and go to state 25 - T_NEW shift, and go to state 26 - T_EXIT shift, and go to state 27 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 - T_STRING_VARNAME shift, and go to state 32 - T_VARIABLE shift, and go to state 33 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 150 (function_call_parameter_list) - - function_call_parameter_list go to state 352 - non_empty_function_call_parameter_list go to state 353 - expr_without_variable go to state 354 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 151 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 355 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + $default reduce using rule 327 (@59) + @59 go to state 419 -state 239 - 194 echo_expr_list: echo_expr_list ',' . expr +state 283 + + 403 base_variable: simple_indirect_reference reference_variable . + 405 reference_variable: reference_variable . '[' dim_offset ']' + 406 | reference_variable . '{' expr '}' + + '[' shift, and go to state 266 + '{' shift, and go to state 267 + + $default reduce using rule 403 (base_variable) + + +state 284 + + 335 exit_expr: '(' ')' . + + $default reduce using rule 335 (exit_expr) + + +state 285 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 336 exit_expr: '(' expr . ')' + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ')' shift, and go to state 420 + + +state 286 + + 38 unticked_statement: T_IF '(' expr . ')' @5 statement @6 elseif_list else_single + 41 | T_IF '(' expr . ')' ':' @7 inner_statement_list @8 new_elseif_list new_else_single T_ENDIF ';' + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ')' shift, and go to state 421 + + +state 287 + + 208 echo_expr_list: echo_expr_list ',' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -8636,62 +9956,71 @@ state 239 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 356 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 422 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 240 +state 288 - 45 unticked_statement: T_ECHO echo_expr_list ';' . + 63 unticked_statement: T_ECHO echo_expr_list ';' . - $default reduce using rule 45 (unticked_statement) + $default reduce using rule 63 (unticked_statement) -state 241 +state 289 - 29 unticked_statement: T_DO @9 statement . T_WHILE '(' @10 expr ')' ';' + 47 unticked_statement: T_DO @11 statement . T_WHILE '(' @12 expr ')' ';' - T_WHILE shift, and go to state 357 + T_WHILE shift, and go to state 423 -state 242 +state 290 - 26 unticked_statement: T_WHILE '(' @7 . expr ')' @8 while_statement + 44 unticked_statement: T_WHILE '(' @9 . expr ')' @10 while_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -8718,314 +10047,371 @@ state 242 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 358 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 424 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 243 +state 291 - 33 unticked_statement: T_FOR '(' for_expr . ';' @11 for_expr ';' @12 for_expr ')' @13 for_statement + 51 unticked_statement: T_FOR '(' for_expr . ';' @13 for_expr ';' @14 for_expr ')' @15 for_statement - ';' shift, and go to state 359 + ';' shift, and go to state 425 -state 244 +state 292 - 197 for_expr: non_empty_for_expr . - 199 non_empty_for_expr: non_empty_for_expr . ',' @38 expr + 211 for_expr: non_empty_for_expr . + 213 non_empty_for_expr: non_empty_for_expr . ',' @38 expr - ',' shift, and go to state 360 + ',' shift, and go to state 426 - $default reduce using rule 197 (for_expr) + $default reduce using rule 211 (for_expr) -state 245 +state 293 - 200 non_empty_for_expr: expr . - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 200 (non_empty_for_expr) + 214 non_empty_for_expr: expr . + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 214 (non_empty_for_expr) -state 246 +state 294 - 55 unticked_statement: T_FOREACH '(' expr_without_variable . T_AS @17 variable foreach_optional_arg ')' @18 foreach_statement - 330 expr: expr_without_variable . + 72 unticked_statement: T_FOREACH '(' expr_without_variable . T_AS @19 variable foreach_optional_arg ')' @20 foreach_statement + 380 expr: expr_without_variable . - T_AS shift, and go to state 361 + T_AS shift, and go to state 427 - $default reduce using rule 330 (expr) + $default reduce using rule 380 (expr) -state 247 +state 295 - 52 unticked_statement: T_FOREACH '(' variable . T_AS @15 foreach_variable foreach_optional_arg ')' @16 foreach_statement - 203 expr_without_variable: variable . '=' expr - 204 | variable . '=' '&' variable - 206 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments - 210 | variable . T_PLUS_EQUAL expr - 211 | variable . T_MINUS_EQUAL expr - 212 | variable . T_MUL_EQUAL expr - 213 | variable . T_DIV_EQUAL expr - 214 | variable . T_CONCAT_EQUAL expr - 215 | variable . T_MOD_EQUAL expr - 216 | variable . T_AND_EQUAL expr - 217 | variable . T_OR_EQUAL expr - 218 | variable . T_XOR_EQUAL expr - 219 | variable . T_SL_EQUAL expr - 220 | variable . T_SR_EQUAL expr - 331 r_variable: variable . - 333 rw_variable: variable . - - '=' shift, and go to state 210 - T_SR_EQUAL shift, and go to state 211 - T_SL_EQUAL shift, and go to state 212 - T_XOR_EQUAL shift, and go to state 213 - T_OR_EQUAL shift, and go to state 214 - T_AND_EQUAL shift, and go to state 215 - T_MOD_EQUAL shift, and go to state 216 - T_CONCAT_EQUAL shift, and go to state 217 - T_DIV_EQUAL shift, and go to state 218 - T_MUL_EQUAL shift, and go to state 219 - T_MINUS_EQUAL shift, and go to state 220 - T_PLUS_EQUAL shift, and go to state 221 - T_AS shift, and go to state 362 - - T_DEC reduce using rule 333 (rw_variable) - T_INC reduce using rule 333 (rw_variable) - $default reduce using rule 331 (r_variable) + 69 unticked_statement: T_FOREACH '(' variable . T_AS @17 foreach_variable foreach_optional_arg ')' @18 foreach_statement + 217 expr_without_variable: variable . '=' expr + 218 | variable . '=' '&' variable + 220 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments + 224 | variable . T_PLUS_EQUAL expr + 225 | variable . T_MINUS_EQUAL expr + 226 | variable . T_MUL_EQUAL expr + 227 | variable . T_DIV_EQUAL expr + 228 | variable . T_CONCAT_EQUAL expr + 229 | variable . T_MOD_EQUAL expr + 230 | variable . T_AND_EQUAL expr + 231 | variable . T_OR_EQUAL expr + 232 | variable . T_XOR_EQUAL expr + 233 | variable . T_SL_EQUAL expr + 234 | variable . T_SR_EQUAL expr + 381 r_variable: variable . + 383 rw_variable: variable . + + '=' shift, and go to state 251 + T_SR_EQUAL shift, and go to state 252 + T_SL_EQUAL shift, and go to state 253 + T_XOR_EQUAL shift, and go to state 254 + T_OR_EQUAL shift, and go to state 255 + T_AND_EQUAL shift, and go to state 256 + T_MOD_EQUAL shift, and go to state 257 + T_CONCAT_EQUAL shift, and go to state 258 + T_DIV_EQUAL shift, and go to state 259 + T_MUL_EQUAL shift, and go to state 260 + T_MINUS_EQUAL shift, and go to state 261 + T_PLUS_EQUAL shift, and go to state 262 + T_AS shift, and go to state 428 + + T_DEC reduce using rule 383 (rw_variable) + T_INC reduce using rule 383 (rw_variable) + $default reduce using rule 381 (r_variable) -state 248 +state 296 - 57 unticked_statement: T_DECLARE @19 '(' . declare_list ')' declare_statement + 74 unticked_statement: T_DECLARE @21 '(' . declare_list ')' declare_statement - T_STRING shift, and go to state 363 + T_STRING shift, and go to state 429 - declare_list go to state 364 + declare_list go to state 430 -state 249 +state 297 - 35 unticked_statement: T_SWITCH '(' expr . ')' @14 switch_case_list - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ')' shift, and go to state 365 + 53 unticked_statement: T_SWITCH '(' expr . ')' @16 switch_case_list + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ')' shift, and go to state 431 -state 250 +state 298 - 37 unticked_statement: T_BREAK expr ';' . + 55 unticked_statement: T_BREAK expr ';' . - $default reduce using rule 37 (unticked_statement) + $default reduce using rule 55 (unticked_statement) -state 251 +state 299 - 39 unticked_statement: T_CONTINUE expr ';' . + 57 unticked_statement: T_CONTINUE expr ';' . - $default reduce using rule 39 (unticked_statement) + $default reduce using rule 57 (unticked_statement) -state 252 +state 300 - 81 is_reference: '&' . + 83 unticked_statement: T_GOTO T_STRING ';' . - $default reduce using rule 81 (is_reference) + $default reduce using rule 83 (unticked_statement) -state 253 +state 301 - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference . T_STRING @28 '(' parameter_list ')' '{' inner_statement_list '}' + 25 constant_declaration: T_CONST T_STRING '=' . static_scalar - T_STRING shift, and go to state 366 + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 441 + static_class_constant go to state 442 -state 254 +state 302 - 41 unticked_statement: T_RETURN expr_without_variable ';' . + 59 unticked_statement: T_RETURN expr_without_variable ';' . - $default reduce using rule 41 (unticked_statement) + $default reduce using rule 59 (unticked_statement) -state 255 +state 303 - 42 unticked_statement: T_RETURN variable ';' . + 60 unticked_statement: T_RETURN variable ';' . - $default reduce using rule 42 (unticked_statement) + $default reduce using rule 60 (unticked_statement) -state 256 +state 304 - 64 unticked_statement: T_TRY @20 '{' . inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches + 81 unticked_statement: T_TRY @22 '{' . inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches - $default reduce using rule 11 (inner_statement_list) + $default reduce using rule 28 (inner_statement_list) - inner_statement_list go to state 367 + inner_statement_list go to state 443 -state 257 +state 305 - 65 unticked_statement: T_THROW expr ';' . + 82 unticked_statement: T_THROW expr ';' . - $default reduce using rule 65 (unticked_statement) + $default reduce using rule 82 (unticked_statement) -state 258 +state 306 - 77 use_filename: '(' T_CONSTANT_ENCAPSED_STRING . ')' + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 22 use_declaration: T_NS_SEPARATOR namespace_name . + 23 | T_NS_SEPARATOR namespace_name . T_AS T_STRING - ')' shift, and go to state 368 + T_AS shift, and go to state 444 + T_NS_SEPARATOR shift, and go to state 213 + $default reduce using rule 22 (use_declaration) -state 259 - 48 unticked_statement: T_USE use_filename ';' . +state 307 + + 21 use_declaration: namespace_name T_AS . T_STRING - $default reduce using rule 48 (unticked_statement) + T_STRING shift, and go to state 445 -state 260 +state 308 + + 18 use_declarations: use_declarations ',' . use_declaration + + T_STRING shift, and go to state 111 + T_NS_SEPARATOR shift, and go to state 176 + + namespace_name go to state 177 + use_declaration go to state 446 + + +state 309 + + 16 top_statement: T_USE use_declarations ';' . - 161 global_var: '$' '{' . expr '}' + $default reduce using rule 16 (top_statement) + + +state 310 + + 176 global_var: '$' '{' . expr '}' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -9052,436 +10438,518 @@ state 260 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 369 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 447 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 261 +state 311 - 160 global_var: '$' r_variable . + 175 global_var: '$' r_variable . - $default reduce using rule 160 (global_var) + $default reduce using rule 175 (global_var) -state 262 +state 312 - 331 r_variable: variable . + 381 r_variable: variable . - $default reduce using rule 331 (r_variable) + $default reduce using rule 381 (r_variable) -state 263 +state 313 - 157 global_var_list: global_var_list ',' . global_var + 172 global_var_list: global_var_list ',' . global_var - T_VARIABLE shift, and go to state 158 - '$' shift, and go to state 159 + T_VARIABLE shift, and go to state 180 + '$' shift, and go to state 181 - global_var go to state 370 + global_var go to state 448 -state 264 +state 314 - 43 unticked_statement: T_GLOBAL global_var_list ';' . + 61 unticked_statement: T_GLOBAL global_var_list ';' . - $default reduce using rule 43 (unticked_statement) + $default reduce using rule 61 (unticked_statement) -state 265 +state 315 - 165 static_var_list: T_VARIABLE '=' . static_scalar + 180 static_var_list: T_VARIABLE '=' . static_scalar - '+' shift, and go to state 371 - '-' shift, and go to state 372 + '+' shift, and go to state 432 + '-' shift, and go to state 433 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 + T_STRING shift, and go to state 111 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 449 + static_class_constant go to state 442 - common_scalar go to state 375 - static_scalar go to state 376 - static_class_constant go to state 377 +state 316 -state 266 + 177 static_var_list: static_var_list ',' . T_VARIABLE + 178 | static_var_list ',' . T_VARIABLE '=' static_scalar - 162 static_var_list: static_var_list ',' . T_VARIABLE - 163 | static_var_list ',' . T_VARIABLE '=' static_scalar + T_VARIABLE shift, and go to state 450 - T_VARIABLE shift, and go to state 378 +state 317 -state 267 + 62 unticked_statement: T_STATIC static_var_list ';' . - 44 unticked_statement: T_STATIC static_var_list ';' . + $default reduce using rule 62 (unticked_statement) - $default reduce using rule 44 (unticked_statement) +state 318 -state 268 + 66 unticked_statement: T_UNSET '(' unset_variables . ')' ';' + 92 unset_variables: unset_variables . ',' unset_variable - 49 unticked_statement: T_UNSET '(' unset_variables . ')' ';' - 74 unset_variables: unset_variables . ',' unset_variable + ',' shift, and go to state 451 + ')' shift, and go to state 452 - ',' shift, and go to state 379 - ')' shift, and go to state 380 +state 319 -state 269 + 91 unset_variables: unset_variable . - 73 unset_variables: unset_variable . + $default reduce using rule 91 (unset_variables) - $default reduce using rule 73 (unset_variables) +state 320 -state 270 + 93 unset_variable: variable . - 75 unset_variable: variable . + $default reduce using rule 93 (unset_variable) - $default reduce using rule 75 (unset_variable) +state 321 -state 271 + 459 isset_variables: variable . - 406 isset_variables: variable . + $default reduce using rule 459 (isset_variables) - $default reduce using rule 406 (isset_variables) +state 322 -state 272 + 452 internal_functions_in_yacc: T_ISSET '(' isset_variables . ')' + 461 isset_variables: isset_variables . ',' @68 variable - 399 internal_functions_in_yacc: T_ISSET '(' isset_variables . ')' - 408 isset_variables: isset_variables . ',' @62 variable + ',' shift, and go to state 453 + ')' shift, and go to state 454 - ',' shift, and go to state 381 - ')' shift, and go to state 382 +state 323 -state 273 + 453 internal_functions_in_yacc: T_EMPTY '(' variable . ')' - 400 internal_functions_in_yacc: T_EMPTY '(' variable . ')' + ')' shift, and go to state 455 - ')' shift, and go to state 383 +state 324 -state 274 + 10 top_statement: T_HALT_COMPILER '(' ')' . ';' - 8 top_statement: T_HALT_COMPILER '(' ')' . ';' + ';' shift, and go to state 456 - ';' shift, and go to state 384 +state 325 -state 275 + 216 expr_without_variable: T_LIST '(' @39 . assignment_list ')' '=' expr + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_LIST shift, and go to state 457 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + $default reduce using rule 427 (assignment_list_element) + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 458 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + assignment_list go to state 459 + assignment_list_element go to state 460 - 202 expr_without_variable: T_LIST '(' @39 . assignment_list ')' '=' expr - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - T_LIST shift, and go to state 385 - '$' shift, and go to state 71 +state 326 - $default reduce using rule 375 (assignment_list_element) + 437 non_empty_array_pair_list: '&' . w_variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + w_variable go to state 461 + variable go to state 462 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 386 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - assignment_list go to state 387 - assignment_list_element go to state 388 +state 327 -state 276 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 432 non_empty_array_pair_list: expr . T_DOUBLE_ARROW expr + 433 | expr . + 436 | expr . T_DOUBLE_ARROW '&' w_variable + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + T_DOUBLE_ARROW shift, and go to state 463 + + $default reduce using rule 433 (non_empty_array_pair_list) - 385 non_empty_array_pair_list: '&' . w_variable - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 +state 328 - function_call go to state 84 - fully_qualified_class_name go to state 120 - w_variable go to state 389 - variable go to state 390 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + 290 expr_without_variable: T_ARRAY '(' array_pair_list . ')' + ')' shift, and go to state 464 -state 277 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 380 non_empty_array_pair_list: expr . T_DOUBLE_ARROW expr - 381 | expr . - 384 | expr . T_DOUBLE_ARROW '&' w_variable - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - T_DOUBLE_ARROW shift, and go to state 391 - - $default reduce using rule 381 (non_empty_array_pair_list) +state 329 + 429 array_pair_list: non_empty_array_pair_list . possible_comma + 430 non_empty_array_pair_list: non_empty_array_pair_list . ',' expr T_DOUBLE_ARROW expr + 431 | non_empty_array_pair_list . ',' expr + 434 | non_empty_array_pair_list . ',' expr T_DOUBLE_ARROW '&' w_variable + 435 | non_empty_array_pair_list . ',' '&' w_variable -state 278 + ',' shift, and go to state 465 - 274 expr_without_variable: T_ARRAY '(' array_pair_list . ')' + $default reduce using rule 373 (possible_comma) - ')' shift, and go to state 392 + possible_comma go to state 466 -state 279 +state 330 - 377 array_pair_list: non_empty_array_pair_list . possible_comma - 378 non_empty_array_pair_list: non_empty_array_pair_list . ',' expr T_DOUBLE_ARROW expr - 379 | non_empty_array_pair_list . ',' expr - 382 | non_empty_array_pair_list . ',' expr T_DOUBLE_ARROW '&' w_variable - 383 | non_empty_array_pair_list . ',' '&' w_variable + 444 encaps_var: T_VARIABLE '[' . @67 encaps_var_offset ']' - ',' shift, and go to state 393 + $default reduce using rule 443 (@67) - $default reduce using rule 323 (possible_comma) + @67 go to state 467 - possible_comma go to state 394 +state 331 -state 280 + 445 encaps_var: T_VARIABLE T_OBJECT_OPERATOR . T_STRING - 389 encaps_var: T_VARIABLE . - 391 | T_VARIABLE . '[' @61 encaps_var_offset ']' - 392 | T_VARIABLE . T_OBJECT_OPERATOR T_STRING + T_STRING shift, and go to state 468 - '[' shift, and go to state 395 - T_OBJECT_OPERATOR shift, and go to state 396 - $default reduce using rule 389 (encaps_var) +state 332 + 352 common_scalar: T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC . -state 281 + $default reduce using rule 352 (common_scalar) - 387 encaps_list: encaps_list T_ENCAPSED_AND_WHITESPACE . - $default reduce using rule 387 (encaps_list) +state 333 + 441 encaps_list: T_ENCAPSED_AND_WHITESPACE encaps_var . -state 282 + $default reduce using rule 441 (encaps_list) - 320 scalar: T_START_HEREDOC encaps_list T_END_HEREDOC . - $default reduce using rule 320 (scalar) +state 334 + 363 scalar: T_STRING_VARNAME . + 447 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME . '[' expr ']' '}' -state 283 + '[' shift, and go to state 469 - 393 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES . expr '}' - 394 | T_DOLLAR_OPEN_CURLY_BRACES . T_STRING_VARNAME '[' expr ']' '}' + $default reduce using rule 363 (scalar) - T_REQUIRE_ONCE shift, and go to state 5 - T_REQUIRE shift, and go to state 6 - T_EVAL shift, and go to state 7 - T_INCLUDE_ONCE shift, and go to state 8 - T_INCLUDE shift, and go to state 9 - T_PRINT shift, and go to state 10 - '+' shift, and go to state 11 - '-' shift, and go to state 12 - '!' shift, and go to state 13 - '~' shift, and go to state 14 - '@' shift, and go to state 15 - T_UNSET_CAST shift, and go to state 16 - T_BOOL_CAST shift, and go to state 17 - T_OBJECT_CAST shift, and go to state 18 - T_ARRAY_CAST shift, and go to state 19 - T_STRING_CAST shift, and go to state 20 - T_DOUBLE_CAST shift, and go to state 21 - T_INT_CAST shift, and go to state 22 - T_DEC shift, and go to state 23 - T_INC shift, and go to state 24 - T_CLONE shift, and go to state 25 - T_NEW shift, and go to state 26 - T_EXIT shift, and go to state 27 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 - T_STRING_VARNAME shift, and go to state 397 - T_VARIABLE shift, and go to state 33 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 398 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 +state 335 -state 284 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 446 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES expr . '}' + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + '}' shift, and go to state 470 - 395 encaps_var: T_CURLY_OPEN . variable '}' - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 +state 336 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 399 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + 448 encaps_var: T_CURLY_OPEN variable . '}' + '}' shift, and go to state 471 -state 285 - 386 encaps_list: encaps_list encaps_var . +state 337 - $default reduce using rule 386 (encaps_list) + 439 encaps_list: encaps_list T_ENCAPSED_AND_WHITESPACE . + $default reduce using rule 439 (encaps_list) -state 286 - 258 expr_without_variable: '(' expr ')' . +state 338 - $default reduce using rule 258 (expr_without_variable) + 370 scalar: T_START_HEREDOC encaps_list T_END_HEREDOC . + $default reduce using rule 370 (scalar) -state 287 - 17 unticked_statement: '{' inner_statement_list '}' . +state 339 + + 438 encaps_list: encaps_list encaps_var . - $default reduce using rule 17 (unticked_statement) + $default reduce using rule 438 (encaps_list) -state 288 +state 340 + + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 305 function_call: T_NAMESPACE T_NS_SEPARATOR namespace_name . '(' @52 function_call_parameter_list ')' + 320 class_name: T_NAMESPACE T_NS_SEPARATOR namespace_name . + 366 scalar: T_NAMESPACE T_NS_SEPARATOR namespace_name . + + T_NS_SEPARATOR shift, and go to state 213 + '(' shift, and go to state 472 + + T_PAAMAYIM_NEKUDOTAYIM reduce using rule 320 (class_name) + $default reduce using rule 366 (scalar) + + +state 341 + + 15 top_statement: T_NAMESPACE '{' @3 . top_statement_list '}' + + $default reduce using rule 4 (top_statement_list) + + top_statement_list go to state 473 + + +state 342 - 10 inner_statement_list: inner_statement_list @2 . inner_statement + 11 top_statement: T_NAMESPACE namespace_name ';' . + + $default reduce using rule 11 (top_statement) + + +state 343 + + 13 top_statement: T_NAMESPACE namespace_name '{' . @2 top_statement_list '}' + + $default reduce using rule 12 (@2) + + @2 go to state 474 + + +state 344 + + 307 function_call: T_NS_SEPARATOR namespace_name '(' . @53 function_call_parameter_list ')' + + $default reduce using rule 306 (@53) + + @53 go to state 475 + + +state 345 + + 272 expr_without_variable: '(' expr ')' . + + $default reduce using rule 272 (expr_without_variable) + + +state 346 + + 35 unticked_statement: '{' inner_statement_list '}' . + + $default reduce using rule 35 (unticked_statement) + + +state 347 + + 27 inner_statement_list: inner_statement_list @4 . inner_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -9523,214 +10991,339 @@ state 288 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_FUNCTION shift, and go to state 45 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_FINAL shift, and go to state 51 - T_ABSTRACT shift, and go to state 52 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_HALT_COMPILER shift, and go to state 400 - T_CLASS shift, and go to state 58 - T_INTERFACE shift, and go to state 59 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - inner_statement go to state 401 - statement go to state 402 - unticked_statement go to state 76 - function_declaration_statement go to state 403 - class_declaration_statement go to state 404 - unticked_function_declaration_statement go to state 79 - unticked_class_declaration_statement go to state 80 - class_entry_type go to state 81 - interface_entry go to state 82 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_FINAL shift, and go to state 53 + T_ABSTRACT shift, and go to state 54 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_HALT_COMPILER shift, and go to state 476 + T_CLASS shift, and go to state 60 + T_INTERFACE shift, and go to state 61 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + inner_statement go to state 477 + statement go to state 478 + unticked_statement go to state 84 + function_declaration_statement go to state 479 + class_declaration_statement go to state 480 + unticked_function_declaration_statement go to state 87 + unticked_class_declaration_statement go to state 88 + class_entry_type go to state 89 + interface_entry go to state 90 + expr_without_variable go to state 91 + function go to state 92 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 289 +state 348 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 357 compound_variable: '$' '{' expr . '}' - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - '}' shift, and go to state 405 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 409 compound_variable: '$' '{' expr . '}' + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + '}' shift, and go to state 481 -state 290 +state 349 - 275 expr_without_variable: '`' encaps_list '`' . + 291 expr_without_variable: '`' backticks_expr '`' . - $default reduce using rule 275 (expr_without_variable) + $default reduce using rule 291 (expr_without_variable) -state 291 +state 350 - 319 scalar: '"' encaps_list '"' . + 369 scalar: '"' encaps_list '"' . - $default reduce using rule 319 (scalar) + $default reduce using rule 369 (scalar) -state 292 +state 351 - 93 extends_from: T_EXTENDS . fully_qualified_class_name + 6 namespace_name: namespace_name T_NS_SEPARATOR T_STRING . - T_STRING shift, and go to state 406 + $default reduce using rule 6 (namespace_name) - fully_qualified_class_name go to state 407 +state 352 + + 303 function_call: namespace_name '(' @51 . function_call_parameter_list ')' + + T_REQUIRE_ONCE shift, and go to state 5 + T_REQUIRE shift, and go to state 6 + T_EVAL shift, and go to state 7 + T_INCLUDE_ONCE shift, and go to state 8 + T_INCLUDE shift, and go to state 9 + T_PRINT shift, and go to state 10 + '&' shift, and go to state 482 + '+' shift, and go to state 11 + '-' shift, and go to state 12 + '!' shift, and go to state 13 + '~' shift, and go to state 14 + '@' shift, and go to state 15 + T_UNSET_CAST shift, and go to state 16 + T_BOOL_CAST shift, and go to state 17 + T_OBJECT_CAST shift, and go to state 18 + T_ARRAY_CAST shift, and go to state 19 + T_STRING_CAST shift, and go to state 20 + T_DOUBLE_CAST shift, and go to state 21 + T_INT_CAST shift, and go to state 22 + T_DEC shift, and go to state 23 + T_INC shift, and go to state 24 + T_CLONE shift, and go to state 25 + T_NEW shift, and go to state 26 + T_EXIT shift, and go to state 27 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 32 + T_VARIABLE shift, and go to state 33 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 483 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 293 - 86 unticked_class_declaration_statement: class_entry_type T_STRING extends_from . @29 implements_list '{' class_statement_list '}' +state 353 - $default reduce using rule 85 (@29) + 24 constant_declaration: constant_declaration ',' T_STRING . '=' static_scalar - @29 go to state 408 + '=' shift, and go to state 487 -state 294 +state 354 - 88 unticked_class_declaration_statement: interface_entry T_STRING @30 . interface_extends_list '{' class_statement_list '}' + 108 extends_from: T_EXTENDS . fully_qualified_class_name - T_EXTENDS shift, and go to state 409 + T_STRING shift, and go to state 111 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 - $default reduce using rule 95 (interface_extends_list) + namespace_name go to state 490 + fully_qualified_class_name go to state 491 - interface_extends_list go to state 410 +state 355 -state 295 + 101 unticked_class_declaration_statement: class_entry_type T_STRING extends_from . @30 implements_list '{' class_statement_list '}' - 280 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . '(' @50 function_call_parameter_list ')' - 409 class_constant: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . + $default reduce using rule 100 (@30) - '(' shift, and go to state 411 + @30 go to state 492 - $default reduce using rule 409 (class_constant) +state 356 -state 296 + 103 unticked_class_declaration_statement: interface_entry T_STRING @31 . interface_extends_list '{' class_statement_list '}' - 282 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects . '(' @51 function_call_parameter_list ')' - 347 static_member: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects . + T_EXTENDS shift, and go to state 493 - '(' shift, and go to state 412 + $default reduce using rule 110 (interface_extends_list) - $default reduce using rule 347 (static_member) + interface_extends_list go to state 494 -state 297 +state 357 - 345 variable_without_objects: reference_variable . - 353 reference_variable: reference_variable . '[' dim_offset ']' - 354 | reference_variable . '{' expr '}' + 99 unticked_function_declaration_statement: function is_reference T_STRING . @29 '(' parameter_list ')' '{' inner_statement_list '}' - '[' shift, and go to state 224 - '{' shift, and go to state 225 + $default reduce using rule 98 (@29) - $default reduce using rule 345 (variable_without_objects) + @29 go to state 495 -state 298 +state 358 + + 294 expr_without_variable: function is_reference '(' . @50 parameter_list ')' lexical_vars '{' inner_statement_list '}' + + $default reduce using rule 293 (@50) + + @50 go to state 496 + + +state 359 + + 309 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . '(' @54 function_call_parameter_list ')' + 462 class_constant: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . + + '(' shift, and go to state 497 + + $default reduce using rule 462 (class_constant) + + +state 360 + + 311 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects . '(' @55 function_call_parameter_list ')' + 397 static_member: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects . + + '(' shift, and go to state 498 + + $default reduce using rule 397 (static_member) - 346 variable_without_objects: simple_indirect_reference . reference_variable - 369 simple_indirect_reference: simple_indirect_reference . '$' + +state 361 + + 395 variable_without_objects: reference_variable . + 405 reference_variable: reference_variable . '[' dim_offset ']' + 406 | reference_variable . '{' expr '}' + + '[' shift, and go to state 266 + '{' shift, and go to state 267 + + $default reduce using rule 395 (variable_without_objects) + + +state 362 + + 396 variable_without_objects: simple_indirect_reference . reference_variable + 421 simple_indirect_reference: simple_indirect_reference . '$' T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 226 + '$' shift, and go to state 268 - reference_variable go to state 413 - compound_variable go to state 97 + reference_variable go to state 499 + compound_variable go to state 107 -state 299 +state 363 - 230 expr_without_variable: expr T_LOGICAL_OR @44 . expr + 244 expr_without_variable: expr T_LOGICAL_OR @44 . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -9757,106 +11350,116 @@ state 299 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 414 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 500 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 300 +state 364 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 233 | expr T_LOGICAL_XOR expr . - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 247 | expr T_LOGICAL_XOR expr . + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - $default reduce using rule 233 (expr_without_variable) + $default reduce using rule 247 (expr_without_variable) -state 301 +state 365 - 232 expr_without_variable: expr T_LOGICAL_AND @45 . expr + 246 expr_without_variable: expr T_LOGICAL_AND @45 . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -9883,48 +11486,66 @@ state 301 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 415 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 501 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 302 +state 366 + + 277 expr_without_variable: expr '?' ':' . @48 expr + + $default reduce using rule 276 (@48) + + @48 go to state 502 - 261 expr_without_variable: expr '?' @46 . expr ':' @47 expr + +state 367 + + 275 expr_without_variable: expr '?' @46 . expr ':' @47 expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -9951,48 +11572,57 @@ state 302 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 416 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 503 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 303 +state 368 - 226 expr_without_variable: expr T_BOOLEAN_OR @42 . expr + 240 expr_without_variable: expr T_BOOLEAN_OR @42 . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -10019,48 +11649,57 @@ state 303 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 417 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 504 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 304 +state 369 - 228 expr_without_variable: expr T_BOOLEAN_AND @43 . expr + 242 expr_without_variable: expr T_BOOLEAN_AND @43 . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -10087,1618 +11726,1663 @@ state 304 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 418 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 505 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 305 +state 370 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 234 | expr '|' expr . - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 248 | expr '|' expr . + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - $default reduce using rule 234 (expr_without_variable) + $default reduce using rule 248 (expr_without_variable) -state 306 +state 371 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 236 | expr '^' expr . - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 250 | expr '^' expr . + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - $default reduce using rule 236 (expr_without_variable) + $default reduce using rule 250 (expr_without_variable) -state 307 +state 372 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 235 | expr '&' expr . - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 249 | expr '&' expr . + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - $default reduce using rule 235 (expr_without_variable) + $default reduce using rule 249 (expr_without_variable) -state 308 +state 373 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 250 | expr T_IS_NOT_IDENTICAL expr . - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 264 | expr T_IS_NOT_IDENTICAL expr . + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 T_IS_NOT_IDENTICAL error (nonassociative) T_IS_IDENTICAL error (nonassociative) T_IS_NOT_EQUAL error (nonassociative) T_IS_EQUAL error (nonassociative) - $default reduce using rule 250 (expr_without_variable) + $default reduce using rule 264 (expr_without_variable) -state 309 +state 374 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 249 | expr T_IS_IDENTICAL expr . - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 263 | expr T_IS_IDENTICAL expr . + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 T_IS_NOT_IDENTICAL error (nonassociative) T_IS_IDENTICAL error (nonassociative) T_IS_NOT_EQUAL error (nonassociative) T_IS_EQUAL error (nonassociative) - $default reduce using rule 249 (expr_without_variable) + $default reduce using rule 263 (expr_without_variable) -state 310 +state 375 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 252 | expr T_IS_NOT_EQUAL expr . - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 266 | expr T_IS_NOT_EQUAL expr . + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 T_IS_NOT_IDENTICAL error (nonassociative) T_IS_IDENTICAL error (nonassociative) T_IS_NOT_EQUAL error (nonassociative) T_IS_EQUAL error (nonassociative) - $default reduce using rule 252 (expr_without_variable) + $default reduce using rule 266 (expr_without_variable) -state 311 +state 376 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 251 | expr T_IS_EQUAL expr . - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 265 | expr T_IS_EQUAL expr . + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 T_IS_NOT_IDENTICAL error (nonassociative) T_IS_IDENTICAL error (nonassociative) T_IS_NOT_EQUAL error (nonassociative) T_IS_EQUAL error (nonassociative) - $default reduce using rule 251 (expr_without_variable) + $default reduce using rule 265 (expr_without_variable) -state 312 +state 377 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 253 | expr '<' expr . - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 267 | expr '<' expr . + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 '<' error (nonassociative) '>' error (nonassociative) T_IS_GREATER_OR_EQUAL error (nonassociative) T_IS_SMALLER_OR_EQUAL error (nonassociative) - $default reduce using rule 253 (expr_without_variable) + $default reduce using rule 267 (expr_without_variable) -state 313 +state 378 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 255 | expr '>' expr . - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 269 | expr '>' expr . + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 '<' error (nonassociative) '>' error (nonassociative) T_IS_GREATER_OR_EQUAL error (nonassociative) T_IS_SMALLER_OR_EQUAL error (nonassociative) - $default reduce using rule 255 (expr_without_variable) + $default reduce using rule 269 (expr_without_variable) -state 314 +state 379 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 256 | expr T_IS_GREATER_OR_EQUAL expr . - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 270 | expr T_IS_GREATER_OR_EQUAL expr . + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 '<' error (nonassociative) '>' error (nonassociative) T_IS_GREATER_OR_EQUAL error (nonassociative) T_IS_SMALLER_OR_EQUAL error (nonassociative) - $default reduce using rule 256 (expr_without_variable) + $default reduce using rule 270 (expr_without_variable) -state 315 +state 380 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 254 | expr T_IS_SMALLER_OR_EQUAL expr . - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 268 | expr T_IS_SMALLER_OR_EQUAL expr . + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 '<' error (nonassociative) '>' error (nonassociative) T_IS_GREATER_OR_EQUAL error (nonassociative) T_IS_SMALLER_OR_EQUAL error (nonassociative) - $default reduce using rule 254 (expr_without_variable) + $default reduce using rule 268 (expr_without_variable) -state 316 +state 381 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 244 | expr T_SR expr . - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 258 | expr T_SR expr . + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - $default reduce using rule 244 (expr_without_variable) + $default reduce using rule 258 (expr_without_variable) -state 317 +state 382 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 243 | expr T_SL expr . - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 243 (expr_without_variable) + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 257 | expr T_SL expr . + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + $default reduce using rule 257 (expr_without_variable) -state 318 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 238 | expr '+' expr . - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 +state 383 - $default reduce using rule 238 (expr_without_variable) + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 252 | expr '+' expr . + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + $default reduce using rule 252 (expr_without_variable) -state 319 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 239 | expr '-' expr . - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 239 (expr_without_variable) +state 384 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 253 | expr '-' expr . + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 -state 320 + $default reduce using rule 253 (expr_without_variable) - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 237 | expr '.' expr . - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - $default reduce using rule 237 (expr_without_variable) +state 385 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 251 | expr '.' expr . + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 -state 321 + $default reduce using rule 251 (expr_without_variable) - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 240 | expr '*' expr . - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_INSTANCEOF shift, and go to state 206 - $default reduce using rule 240 (expr_without_variable) +state 386 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 254 | expr '*' expr . + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_INSTANCEOF shift, and go to state 247 -state 322 + $default reduce using rule 254 (expr_without_variable) - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 241 | expr '/' expr . - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 241 (expr_without_variable) +state 387 -state 323 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 255 | expr '/' expr . + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_INSTANCEOF shift, and go to state 247 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 242 | expr '%' expr . - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_INSTANCEOF shift, and go to state 206 + $default reduce using rule 255 (expr_without_variable) - $default reduce using rule 242 (expr_without_variable) +state 388 -state 324 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 256 | expr '%' expr . + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_INSTANCEOF shift, and go to state 247 - 257 expr_without_variable: expr T_INSTANCEOF class_name_reference . + $default reduce using rule 256 (expr_without_variable) - $default reduce using rule 257 (expr_without_variable) +state 389 -state 325 + 271 expr_without_variable: expr T_INSTANCEOF class_name_reference . - 204 expr_without_variable: variable '=' '&' . variable - 206 | variable '=' '&' . T_NEW class_name_reference @40 ctor_arguments + $default reduce using rule 271 (expr_without_variable) - T_NEW shift, and go to state 419 - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 420 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 +state 390 + 218 expr_without_variable: variable '=' '&' . variable + 220 | variable '=' '&' . T_NEW class_name_reference @40 ctor_arguments + + T_NEW shift, and go to state 506 + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 507 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 -state 326 - 203 expr_without_variable: variable '=' expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 203 (expr_without_variable) +state 391 + 217 expr_without_variable: variable '=' expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 -state 327 + $default reduce using rule 217 (expr_without_variable) - 220 expr_without_variable: variable T_SR_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - $default reduce using rule 220 (expr_without_variable) +state 392 + 234 expr_without_variable: variable T_SR_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 -state 328 + $default reduce using rule 234 (expr_without_variable) - 219 expr_without_variable: variable T_SL_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 219 (expr_without_variable) +state 393 -state 329 + 233 expr_without_variable: variable T_SL_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - 218 expr_without_variable: variable T_XOR_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + $default reduce using rule 233 (expr_without_variable) - $default reduce using rule 218 (expr_without_variable) +state 394 -state 330 + 232 expr_without_variable: variable T_XOR_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - 217 expr_without_variable: variable T_OR_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + $default reduce using rule 232 (expr_without_variable) - $default reduce using rule 217 (expr_without_variable) +state 395 -state 331 + 231 expr_without_variable: variable T_OR_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 231 (expr_without_variable) - 216 expr_without_variable: variable T_AND_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - $default reduce using rule 216 (expr_without_variable) +state 396 + 230 expr_without_variable: variable T_AND_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 -state 332 + $default reduce using rule 230 (expr_without_variable) - 215 expr_without_variable: variable T_MOD_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 215 (expr_without_variable) +state 397 -state 333 + 229 expr_without_variable: variable T_MOD_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 229 (expr_without_variable) - 214 expr_without_variable: variable T_CONCAT_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 214 (expr_without_variable) +state 398 -state 334 + 228 expr_without_variable: variable T_CONCAT_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - 213 expr_without_variable: variable T_DIV_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 213 (expr_without_variable) + $default reduce using rule 228 (expr_without_variable) -state 335 +state 399 - 212 expr_without_variable: variable T_MUL_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 212 (expr_without_variable) + 227 expr_without_variable: variable T_DIV_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 227 (expr_without_variable) -state 336 +state 400 - 211 expr_without_variable: variable T_MINUS_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 211 (expr_without_variable) + 226 expr_without_variable: variable T_MUL_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + $default reduce using rule 226 (expr_without_variable) -state 337 - 210 expr_without_variable: variable T_PLUS_EQUAL expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 210 (expr_without_variable) +state 401 + 225 expr_without_variable: variable T_MINUS_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 225 (expr_without_variable) -state 338 - 284 function_call: variable_without_objects '(' @52 . function_call_parameter_list ')' +state 402 + + 224 expr_without_variable: variable T_PLUS_EQUAL expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 224 (expr_without_variable) + + +state 403 + + 317 function_call: variable_without_objects '(' @58 . function_call_parameter_list ')' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -11706,7 +13390,7 @@ state 338 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 351 + '&' shift, and go to state 482 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -11726,217 +13410,277 @@ state 338 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 150 (function_call_parameter_list) - - function_call_parameter_list go to state 421 - non_empty_function_call_parameter_list go to state 353 - expr_without_variable go to state 354 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 151 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 355 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 508 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 339 +state 404 + + 313 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . '(' @56 function_call_parameter_list ')' + 463 class_constant: variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . - 336 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @55 . object_property @56 method_or_not variable_properties + '(' shift, and go to state 509 + + $default reduce using rule 463 (class_constant) + + +state 405 + + 315 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects . '(' @57 function_call_parameter_list ')' + 398 static_member: variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects . + + '(' shift, and go to state 510 + + $default reduce using rule 398 (static_member) - T_STRING shift, and go to state 422 + +state 406 + + 386 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @61 . object_property @62 method_or_not variable_properties + + T_STRING shift, and go to state 511 T_VARIABLE shift, and go to state 33 - '{' shift, and go to state 423 - '$' shift, and go to state 71 + '{' shift, and go to state 512 + '$' shift, and go to state 77 - variable_without_objects go to state 424 - reference_variable go to state 297 - compound_variable go to state 97 - object_property go to state 425 - object_dim_list go to state 426 - variable_name go to state 427 - simple_indirect_reference go to state 298 + variable_without_objects go to state 513 + reference_variable go to state 361 + compound_variable go to state 107 + object_property go to state 514 + object_dim_list go to state 515 + variable_name go to state 516 + simple_indirect_reference go to state 362 -state 340 +state 407 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 359 dim_offset: expr . - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 359 (dim_offset) + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 411 dim_offset: expr . + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 411 (dim_offset) -state 341 +state 408 - 353 reference_variable: reference_variable '[' dim_offset . ']' + 405 reference_variable: reference_variable '[' dim_offset . ']' - ']' shift, and go to state 428 + ']' shift, and go to state 517 -state 342 +state 409 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 354 reference_variable: reference_variable '{' expr . '}' - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - '}' shift, and go to state 429 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 406 reference_variable: reference_variable '{' expr . '}' + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + '}' shift, and go to state 518 -state 343 +state 410 - 403 internal_functions_in_yacc: T_EVAL '(' expr ')' . + 456 internal_functions_in_yacc: T_EVAL '(' expr ')' . - $default reduce using rule 403 (internal_functions_in_yacc) + $default reduce using rule 456 (internal_functions_in_yacc) -state 344 +state 411 - 280 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . '(' @50 function_call_parameter_list ')' + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 305 function_call: T_NAMESPACE T_NS_SEPARATOR namespace_name . '(' @52 function_call_parameter_list ')' + 320 class_name: T_NAMESPACE T_NS_SEPARATOR namespace_name . - '(' shift, and go to state 411 + T_NS_SEPARATOR shift, and go to state 213 + '(' shift, and go to state 472 + $default reduce using rule 320 (class_name) -state 345 - 347 static_member: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects . +state 412 + + 309 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . '(' @54 function_call_parameter_list ')' - $default reduce using rule 347 (static_member) + '(' shift, and go to state 497 -state 346 +state 413 + + 313 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . '(' @56 function_call_parameter_list ')' + + '(' shift, and go to state 509 + + +state 414 + + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 320 class_name: T_NAMESPACE T_NS_SEPARATOR namespace_name . + + T_NS_SEPARATOR shift, and go to state 213 + + $default reduce using rule 320 (class_name) + + +state 415 + + 397 static_member: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects . - 299 ctor_arguments: '(' . function_call_parameter_list ')' + $default reduce using rule 397 (static_member) + + +state 416 + + 341 ctor_arguments: '(' . function_call_parameter_list ')' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -11944,7 +13688,7 @@ state 346 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 351 + '&' shift, and go to state 482 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -11964,662 +13708,660 @@ state 346 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 150 (function_call_parameter_list) - - function_call_parameter_list go to state 430 - non_empty_function_call_parameter_list go to state 353 - expr_without_variable go to state 354 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 151 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 355 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 519 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 347 +state 417 - 208 expr_without_variable: T_NEW class_name_reference @41 ctor_arguments . + 222 expr_without_variable: T_NEW class_name_reference @41 ctor_arguments . - $default reduce using rule 208 (expr_without_variable) + $default reduce using rule 222 (expr_without_variable) -state 348 +state 418 - 290 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @53 . object_property @54 dynamic_class_name_variable_properties + 398 static_member: variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects . - T_STRING shift, and go to state 422 - T_VARIABLE shift, and go to state 33 - '{' shift, and go to state 423 - '$' shift, and go to state 71 + $default reduce using rule 398 (static_member) - variable_without_objects go to state 424 - reference_variable go to state 297 - compound_variable go to state 97 - object_property go to state 431 - object_dim_list go to state 426 - variable_name go to state 427 - simple_indirect_reference go to state 298 +state 419 -state 349 + 329 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @59 . object_property @60 dynamic_class_name_variable_properties - 297 exit_expr: '(' expr ')' . + T_STRING shift, and go to state 511 + T_VARIABLE shift, and go to state 33 + '{' shift, and go to state 512 + '$' shift, and go to state 77 - $default reduce using rule 297 (exit_expr) + variable_without_objects go to state 513 + reference_variable go to state 361 + compound_variable go to state 107 + object_property go to state 520 + object_dim_list go to state 515 + variable_name go to state 516 + simple_indirect_reference go to state 362 -state 350 +state 420 - 20 unticked_statement: T_IF '(' expr ')' . @3 statement @4 elseif_list else_single - 23 | T_IF '(' expr ')' . ':' @5 inner_statement_list @6 new_elseif_list new_else_single T_ENDIF ';' + 336 exit_expr: '(' expr ')' . - ':' shift, and go to state 432 + $default reduce using rule 336 (exit_expr) - $default reduce using rule 18 (@3) - @3 go to state 433 +state 421 + 38 unticked_statement: T_IF '(' expr ')' . @5 statement @6 elseif_list else_single + 41 | T_IF '(' expr ')' . ':' @7 inner_statement_list @8 new_elseif_list new_else_single T_ENDIF ';' -state 351 + ':' shift, and go to state 521 - 153 non_empty_function_call_parameter_list: '&' . w_variable + $default reduce using rule 36 (@5) - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + @5 go to state 522 - function_call go to state 84 - fully_qualified_class_name go to state 120 - w_variable go to state 434 - variable go to state 390 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 +state 422 -state 352 + 208 echo_expr_list: echo_expr_list ',' expr . + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 208 (echo_expr_list) - 278 function_call: T_STRING '(' @49 function_call_parameter_list . ')' - ')' shift, and go to state 435 +state 423 + 47 unticked_statement: T_DO @11 statement T_WHILE . '(' @12 expr ')' ';' -state 353 + '(' shift, and go to state 523 - 149 function_call_parameter_list: non_empty_function_call_parameter_list . - 154 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list . ',' expr_without_variable - 155 | non_empty_function_call_parameter_list . ',' variable - 156 | non_empty_function_call_parameter_list . ',' '&' w_variable - ',' shift, and go to state 436 +state 424 - $default reduce using rule 149 (function_call_parameter_list) + 44 unticked_statement: T_WHILE '(' @9 expr . ')' @10 while_statement + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ')' shift, and go to state 524 -state 354 +state 425 - 151 non_empty_function_call_parameter_list: expr_without_variable . - 330 expr: expr_without_variable . + 51 unticked_statement: T_FOR '(' for_expr ';' . @13 for_expr ';' @14 for_expr ')' @15 for_statement - ',' reduce using rule 151 (non_empty_function_call_parameter_list) - ')' reduce using rule 151 (non_empty_function_call_parameter_list) - $default reduce using rule 330 (expr) + $default reduce using rule 48 (@13) + @13 go to state 525 -state 355 - 152 non_empty_function_call_parameter_list: variable . - 203 expr_without_variable: variable . '=' expr - 204 | variable . '=' '&' variable - 206 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments - 210 | variable . T_PLUS_EQUAL expr - 211 | variable . T_MINUS_EQUAL expr - 212 | variable . T_MUL_EQUAL expr - 213 | variable . T_DIV_EQUAL expr - 214 | variable . T_CONCAT_EQUAL expr - 215 | variable . T_MOD_EQUAL expr - 216 | variable . T_AND_EQUAL expr - 217 | variable . T_OR_EQUAL expr - 218 | variable . T_XOR_EQUAL expr - 219 | variable . T_SL_EQUAL expr - 220 | variable . T_SR_EQUAL expr - 331 r_variable: variable . - 333 rw_variable: variable . - - '=' shift, and go to state 210 - T_SR_EQUAL shift, and go to state 211 - T_SL_EQUAL shift, and go to state 212 - T_XOR_EQUAL shift, and go to state 213 - T_OR_EQUAL shift, and go to state 214 - T_AND_EQUAL shift, and go to state 215 - T_MOD_EQUAL shift, and go to state 216 - T_CONCAT_EQUAL shift, and go to state 217 - T_DIV_EQUAL shift, and go to state 218 - T_MUL_EQUAL shift, and go to state 219 - T_MINUS_EQUAL shift, and go to state 220 - T_PLUS_EQUAL shift, and go to state 221 - - ',' reduce using rule 152 (non_empty_function_call_parameter_list) - T_DEC reduce using rule 333 (rw_variable) - T_INC reduce using rule 333 (rw_variable) - ')' reduce using rule 152 (non_empty_function_call_parameter_list) - $default reduce using rule 331 (r_variable) +state 426 + 213 non_empty_for_expr: non_empty_for_expr ',' . @38 expr -state 356 + $default reduce using rule 212 (@38) - 194 echo_expr_list: echo_expr_list ',' expr . - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 194 (echo_expr_list) + @38 go to state 526 -state 357 +state 427 - 29 unticked_statement: T_DO @9 statement T_WHILE . '(' @10 expr ')' ';' + 72 unticked_statement: T_FOREACH '(' expr_without_variable T_AS . @19 variable foreach_optional_arg ')' @20 foreach_statement - '(' shift, and go to state 437 + $default reduce using rule 70 (@19) + @19 go to state 527 -state 358 - 26 unticked_statement: T_WHILE '(' @7 expr . ')' @8 while_statement - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ')' shift, and go to state 438 +state 428 + 69 unticked_statement: T_FOREACH '(' variable T_AS . @17 foreach_variable foreach_optional_arg ')' @18 foreach_statement -state 359 + $default reduce using rule 67 (@17) - 33 unticked_statement: T_FOR '(' for_expr ';' . @11 for_expr ';' @12 for_expr ')' @13 for_statement + @17 go to state 528 - $default reduce using rule 30 (@11) - @11 go to state 439 +state 429 + 126 declare_list: T_STRING . '=' static_scalar -state 360 + '=' shift, and go to state 529 - 199 non_empty_for_expr: non_empty_for_expr ',' . @38 expr - $default reduce using rule 198 (@38) +state 430 - @38 go to state 440 + 74 unticked_statement: T_DECLARE @21 '(' declare_list . ')' declare_statement + 127 declare_list: declare_list . ',' T_STRING '=' static_scalar + ',' shift, and go to state 530 + ')' shift, and go to state 531 -state 361 - 55 unticked_statement: T_FOREACH '(' expr_without_variable T_AS . @17 variable foreach_optional_arg ')' @18 foreach_statement +state 431 - $default reduce using rule 53 (@17) + 53 unticked_statement: T_SWITCH '(' expr ')' . @16 switch_case_list - @17 go to state 441 + $default reduce using rule 52 (@16) + @16 go to state 532 -state 362 - 52 unticked_statement: T_FOREACH '(' variable T_AS . @15 foreach_variable foreach_optional_arg ')' @16 foreach_statement +state 432 - $default reduce using rule 50 (@15) + 358 static_scalar: '+' . static_scalar - @15 go to state 442 + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 533 + static_class_constant go to state 442 -state 363 +state 433 - 111 declare_list: T_STRING . '=' static_scalar + 359 static_scalar: '-' . static_scalar - '=' shift, and go to state 443 + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 534 + static_class_constant go to state 442 -state 364 +state 434 - 57 unticked_statement: T_DECLARE @19 '(' declare_list . ')' declare_statement - 112 declare_list: declare_list . ',' T_STRING '=' static_scalar + 360 static_scalar: T_ARRAY . '(' static_array_pair_list ')' - ',' shift, and go to state 444 - ')' shift, and go to state 445 + '(' shift, and go to state 535 -state 365 +state 435 - 35 unticked_statement: T_SWITCH '(' expr ')' . @14 switch_case_list + 352 common_scalar: T_START_HEREDOC . T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC + 353 | T_START_HEREDOC . T_END_HEREDOC - $default reduce using rule 34 (@14) + T_ENCAPSED_AND_WHITESPACE shift, and go to state 536 + T_END_HEREDOC shift, and go to state 196 - @14 go to state 446 +state 436 -state 366 + 320 class_name: T_NAMESPACE . T_NS_SEPARATOR namespace_name + 356 static_scalar: T_NAMESPACE . T_NS_SEPARATOR namespace_name - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference T_STRING . @28 '(' parameter_list ')' '{' inner_statement_list '}' + T_NS_SEPARATOR shift, and go to state 537 - $default reduce using rule 83 (@28) - @28 go to state 447 +state 437 + 321 class_name: T_NS_SEPARATOR . namespace_name + 357 static_scalar: T_NS_SEPARATOR . namespace_name -state 367 + T_STRING shift, and go to state 111 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 64 unticked_statement: T_TRY @20 '{' inner_statement_list . '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches + namespace_name go to state 538 - '}' shift, and go to state 448 - $default reduce using rule 9 (@2) +state 438 - @2 go to state 288 + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 319 class_name: namespace_name . + 355 static_scalar: namespace_name . + T_NS_SEPARATOR shift, and go to state 213 -state 368 + T_PAAMAYIM_NEKUDOTAYIM reduce using rule 319 (class_name) + $default reduce using rule 355 (static_scalar) - 77 use_filename: '(' T_CONSTANT_ENCAPSED_STRING ')' . - $default reduce using rule 77 (use_filename) +state 439 + 362 static_class_constant: class_name . T_PAAMAYIM_NEKUDOTAYIM T_STRING -state 369 + T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 539 - 161 global_var: '$' '{' expr . '}' - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - '}' shift, and go to state 449 +state 440 -state 370 + 354 static_scalar: common_scalar . - 157 global_var_list: global_var_list ',' global_var . + $default reduce using rule 354 (static_scalar) - $default reduce using rule 157 (global_var_list) +state 441 -state 371 + 25 constant_declaration: T_CONST T_STRING '=' static_scalar . - 310 static_scalar: '+' . static_scalar + $default reduce using rule 25 (constant_declaration) - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - common_scalar go to state 375 - static_scalar go to state 450 - static_class_constant go to state 377 +state 442 + 361 static_scalar: static_class_constant . -state 372 + $default reduce using rule 361 (static_scalar) - 311 static_scalar: '-' . static_scalar - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 +state 443 - common_scalar go to state 375 - static_scalar go to state 451 - static_class_constant go to state 377 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 81 unticked_statement: T_TRY @22 '{' inner_statement_list . '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches + '}' shift, and go to state 540 -state 373 + $default reduce using rule 26 (@4) - 309 static_scalar: T_STRING . - 314 static_class_constant: T_STRING . T_PAAMAYIM_NEKUDOTAYIM T_STRING + @4 go to state 347 - T_PAAMAYIM_NEKUDOTAYIM shift, and go to state 452 - $default reduce using rule 309 (static_scalar) +state 444 + 23 use_declaration: T_NS_SEPARATOR namespace_name T_AS . T_STRING -state 374 + T_STRING shift, and go to state 541 - 312 static_scalar: T_ARRAY . '(' static_array_pair_list ')' - '(' shift, and go to state 453 +state 445 + 21 use_declaration: namespace_name T_AS T_STRING . -state 375 + $default reduce using rule 21 (use_declaration) - 308 static_scalar: common_scalar . - $default reduce using rule 308 (static_scalar) +state 446 + 18 use_declarations: use_declarations ',' use_declaration . -state 376 + $default reduce using rule 18 (use_declarations) - 165 static_var_list: T_VARIABLE '=' static_scalar . - $default reduce using rule 165 (static_var_list) +state 447 + 176 global_var: '$' '{' expr . '}' + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + '}' shift, and go to state 542 -state 377 - 313 static_scalar: static_class_constant . +state 448 - $default reduce using rule 313 (static_scalar) + 172 global_var_list: global_var_list ',' global_var . + $default reduce using rule 172 (global_var_list) -state 378 - 162 static_var_list: static_var_list ',' T_VARIABLE . - 163 | static_var_list ',' T_VARIABLE . '=' static_scalar +state 449 - '=' shift, and go to state 454 + 180 static_var_list: T_VARIABLE '=' static_scalar . - $default reduce using rule 162 (static_var_list) + $default reduce using rule 180 (static_var_list) -state 379 +state 450 - 74 unset_variables: unset_variables ',' . unset_variable + 177 static_var_list: static_var_list ',' T_VARIABLE . + 178 | static_var_list ',' T_VARIABLE . '=' static_scalar - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + '=' shift, and go to state 543 - unset_variable go to state 455 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 270 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + $default reduce using rule 177 (static_var_list) -state 380 +state 451 - 49 unticked_statement: T_UNSET '(' unset_variables ')' . ';' + 92 unset_variables: unset_variables ',' . unset_variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + unset_variable go to state 544 + function_call go to state 93 + class_name go to state 136 + variable go to state 320 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 - ';' shift, and go to state 456 +state 452 -state 381 + 66 unticked_statement: T_UNSET '(' unset_variables ')' . ';' - 408 isset_variables: isset_variables ',' . @62 variable + ';' shift, and go to state 545 - $default reduce using rule 407 (@62) - @62 go to state 457 +state 453 + 461 isset_variables: isset_variables ',' . @68 variable -state 382 + $default reduce using rule 460 (@68) - 399 internal_functions_in_yacc: T_ISSET '(' isset_variables ')' . + @68 go to state 546 - $default reduce using rule 399 (internal_functions_in_yacc) +state 454 -state 383 + 452 internal_functions_in_yacc: T_ISSET '(' isset_variables ')' . - 400 internal_functions_in_yacc: T_EMPTY '(' variable ')' . + $default reduce using rule 452 (internal_functions_in_yacc) - $default reduce using rule 400 (internal_functions_in_yacc) +state 455 -state 384 + 453 internal_functions_in_yacc: T_EMPTY '(' variable ')' . - 8 top_statement: T_HALT_COMPILER '(' ')' ';' . + $default reduce using rule 453 (internal_functions_in_yacc) - $default reduce using rule 8 (top_statement) +state 456 -state 385 + 10 top_statement: T_HALT_COMPILER '(' ')' ';' . - 374 assignment_list_element: T_LIST . '(' @60 assignment_list ')' + $default reduce using rule 10 (top_statement) - '(' shift, and go to state 458 +state 457 -state 386 + 426 assignment_list_element: T_LIST . '(' @66 assignment_list ')' - 372 assignment_list_element: variable . + '(' shift, and go to state 547 - $default reduce using rule 372 (assignment_list_element) +state 458 -state 387 + 424 assignment_list_element: variable . - 202 expr_without_variable: T_LIST '(' @39 assignment_list . ')' '=' expr - 370 assignment_list: assignment_list . ',' assignment_list_element + $default reduce using rule 424 (assignment_list_element) - ',' shift, and go to state 459 - ')' shift, and go to state 460 +state 459 -state 388 + 216 expr_without_variable: T_LIST '(' @39 assignment_list . ')' '=' expr + 422 assignment_list: assignment_list . ',' assignment_list_element - 371 assignment_list: assignment_list_element . + ',' shift, and go to state 548 + ')' shift, and go to state 549 - $default reduce using rule 371 (assignment_list) +state 460 -state 389 + 423 assignment_list: assignment_list_element . - 385 non_empty_array_pair_list: '&' w_variable . + $default reduce using rule 423 (assignment_list) - $default reduce using rule 385 (non_empty_array_pair_list) +state 461 -state 390 + 437 non_empty_array_pair_list: '&' w_variable . - 332 w_variable: variable . + $default reduce using rule 437 (non_empty_array_pair_list) - $default reduce using rule 332 (w_variable) +state 462 -state 391 + 382 w_variable: variable . + + $default reduce using rule 382 (w_variable) + + +state 463 - 380 non_empty_array_pair_list: expr T_DOUBLE_ARROW . expr - 384 | expr T_DOUBLE_ARROW . '&' w_variable + 432 non_empty_array_pair_list: expr T_DOUBLE_ARROW . expr + 436 | expr T_DOUBLE_ARROW . '&' w_variable T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -12627,7 +14369,7 @@ state 391 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 461 + '&' shift, and go to state 550 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -12647,59 +14389,68 @@ state 391 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 462 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 551 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 392 +state 464 - 274 expr_without_variable: T_ARRAY '(' array_pair_list ')' . + 290 expr_without_variable: T_ARRAY '(' array_pair_list ')' . - $default reduce using rule 274 (expr_without_variable) + $default reduce using rule 290 (expr_without_variable) -state 393 +state 465 - 324 possible_comma: ',' . - 378 non_empty_array_pair_list: non_empty_array_pair_list ',' . expr T_DOUBLE_ARROW expr - 379 | non_empty_array_pair_list ',' . expr - 382 | non_empty_array_pair_list ',' . expr T_DOUBLE_ARROW '&' w_variable - 383 | non_empty_array_pair_list ',' . '&' w_variable + 374 possible_comma: ',' . + 430 non_empty_array_pair_list: non_empty_array_pair_list ',' . expr T_DOUBLE_ARROW expr + 431 | non_empty_array_pair_list ',' . expr + 434 | non_empty_array_pair_list ',' . expr T_DOUBLE_ARROW '&' w_variable + 435 | non_empty_array_pair_list ',' . '&' w_variable T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -12707,7 +14458,7 @@ state 393 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 463 + '&' shift, and go to state 552 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -12727,586 +14478,692 @@ state 393 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 324 (possible_comma) - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 464 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 394 - - 377 array_pair_list: non_empty_array_pair_list possible_comma . + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 374 (possible_comma) + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 553 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 - $default reduce using rule 377 (array_pair_list) +state 466 -state 395 - - 391 encaps_var: T_VARIABLE '[' . @61 encaps_var_offset ']' + 429 array_pair_list: non_empty_array_pair_list possible_comma . - $default reduce using rule 390 (@61) + $default reduce using rule 429 (array_pair_list) - @61 go to state 465 +state 467 -state 396 + 444 encaps_var: T_VARIABLE '[' @67 . encaps_var_offset ']' - 392 encaps_var: T_VARIABLE T_OBJECT_OPERATOR . T_STRING + T_STRING shift, and go to state 554 + T_VARIABLE shift, and go to state 555 + T_NUM_STRING shift, and go to state 556 - T_STRING shift, and go to state 466 + encaps_var_offset go to state 557 -state 397 +state 468 - 316 scalar: T_STRING_VARNAME . - 394 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME . '[' expr ']' '}' + 445 encaps_var: T_VARIABLE T_OBJECT_OPERATOR T_STRING . - '[' shift, and go to state 467 + $default reduce using rule 445 (encaps_var) - $default reduce using rule 316 (scalar) +state 469 -state 398 + 447 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' . expr ']' '}' - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 393 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES expr . '}' - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - '}' shift, and go to state 468 + T_REQUIRE_ONCE shift, and go to state 5 + T_REQUIRE shift, and go to state 6 + T_EVAL shift, and go to state 7 + T_INCLUDE_ONCE shift, and go to state 8 + T_INCLUDE shift, and go to state 9 + T_PRINT shift, and go to state 10 + '+' shift, and go to state 11 + '-' shift, and go to state 12 + '!' shift, and go to state 13 + '~' shift, and go to state 14 + '@' shift, and go to state 15 + T_UNSET_CAST shift, and go to state 16 + T_BOOL_CAST shift, and go to state 17 + T_OBJECT_CAST shift, and go to state 18 + T_ARRAY_CAST shift, and go to state 19 + T_STRING_CAST shift, and go to state 20 + T_DOUBLE_CAST shift, and go to state 21 + T_INT_CAST shift, and go to state 22 + T_DEC shift, and go to state 23 + T_INC shift, and go to state 24 + T_CLONE shift, and go to state 25 + T_NEW shift, and go to state 26 + T_EXIT shift, and go to state 27 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 32 + T_VARIABLE shift, and go to state 33 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 558 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 399 +state 470 - 395 encaps_var: T_CURLY_OPEN variable . '}' + 446 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES expr '}' . - '}' shift, and go to state 469 + $default reduce using rule 446 (encaps_var) -state 400 +state 471 - 15 inner_statement: T_HALT_COMPILER . '(' ')' ';' + 448 encaps_var: T_CURLY_OPEN variable '}' . - '(' shift, and go to state 470 + $default reduce using rule 448 (encaps_var) -state 401 +state 472 - 10 inner_statement_list: inner_statement_list @2 inner_statement . + 305 function_call: T_NAMESPACE T_NS_SEPARATOR namespace_name '(' . @52 function_call_parameter_list ')' - $default reduce using rule 10 (inner_statement_list) + $default reduce using rule 304 (@52) + @52 go to state 559 -state 402 - 12 inner_statement: statement . +state 473 - $default reduce using rule 12 (inner_statement) + 3 top_statement_list: top_statement_list . @1 top_statement + 15 top_statement: T_NAMESPACE '{' @3 top_statement_list . '}' + '}' shift, and go to state 560 -state 403 + $default reduce using rule 2 (@1) - 13 inner_statement: function_declaration_statement . + @1 go to state 4 - $default reduce using rule 13 (inner_statement) +state 474 -state 404 + 13 top_statement: T_NAMESPACE namespace_name '{' @2 . top_statement_list '}' - 14 inner_statement: class_declaration_statement . + $default reduce using rule 4 (top_statement_list) - $default reduce using rule 14 (inner_statement) + top_statement_list go to state 561 -state 405 +state 475 - 357 compound_variable: '$' '{' expr '}' . + 307 function_call: T_NS_SEPARATOR namespace_name '(' @53 . function_call_parameter_list ')' - $default reduce using rule 357 (compound_variable) + T_REQUIRE_ONCE shift, and go to state 5 + T_REQUIRE shift, and go to state 6 + T_EVAL shift, and go to state 7 + T_INCLUDE_ONCE shift, and go to state 8 + T_INCLUDE shift, and go to state 9 + T_PRINT shift, and go to state 10 + '&' shift, and go to state 482 + '+' shift, and go to state 11 + '-' shift, and go to state 12 + '!' shift, and go to state 13 + '~' shift, and go to state 14 + '@' shift, and go to state 15 + T_UNSET_CAST shift, and go to state 16 + T_BOOL_CAST shift, and go to state 17 + T_OBJECT_CAST shift, and go to state 18 + T_ARRAY_CAST shift, and go to state 19 + T_STRING_CAST shift, and go to state 20 + T_DOUBLE_CAST shift, and go to state 21 + T_INT_CAST shift, and go to state 22 + T_DEC shift, and go to state 23 + T_INC shift, and go to state 24 + T_CLONE shift, and go to state 25 + T_NEW shift, and go to state 26 + T_EXIT shift, and go to state 27 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 32 + T_VARIABLE shift, and go to state 33 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 562 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 406 +state 476 - 285 fully_qualified_class_name: T_STRING . + 32 inner_statement: T_HALT_COMPILER . '(' ')' ';' - $default reduce using rule 285 (fully_qualified_class_name) + '(' shift, and go to state 563 -state 407 +state 477 - 93 extends_from: T_EXTENDS fully_qualified_class_name . + 27 inner_statement_list: inner_statement_list @4 inner_statement . - $default reduce using rule 93 (extends_from) + $default reduce using rule 27 (inner_statement_list) -state 408 +state 478 - 86 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @29 . implements_list '{' class_statement_list '}' + 29 inner_statement: statement . - T_IMPLEMENTS shift, and go to state 471 + $default reduce using rule 29 (inner_statement) - $default reduce using rule 97 (implements_list) - implements_list go to state 472 +state 479 + 30 inner_statement: function_declaration_statement . -state 409 + $default reduce using rule 30 (inner_statement) - 96 interface_extends_list: T_EXTENDS . interface_list - T_STRING shift, and go to state 406 +state 480 - interface_list go to state 473 - fully_qualified_class_name go to state 474 + 31 inner_statement: class_declaration_statement . + $default reduce using rule 31 (inner_statement) -state 410 - 88 unticked_class_declaration_statement: interface_entry T_STRING @30 interface_extends_list . '{' class_statement_list '}' +state 481 - '{' shift, and go to state 475 + 409 compound_variable: '$' '{' expr '}' . + $default reduce using rule 409 (compound_variable) -state 411 - 280 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' . @50 function_call_parameter_list ')' +state 482 - $default reduce using rule 279 (@50) + 168 non_empty_function_call_parameter_list: '&' . w_variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + w_variable go to state 564 + variable go to state 462 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 - @50 go to state 476 +state 483 -state 412 + 303 function_call: namespace_name '(' @51 function_call_parameter_list . ')' - 282 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' . @51 function_call_parameter_list ')' + ')' shift, and go to state 565 - $default reduce using rule 281 (@51) - @51 go to state 477 +state 484 + 164 function_call_parameter_list: non_empty_function_call_parameter_list . + 169 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list . ',' expr_without_variable + 170 | non_empty_function_call_parameter_list . ',' variable + 171 | non_empty_function_call_parameter_list . ',' '&' w_variable -state 413 + ',' shift, and go to state 566 - 346 variable_without_objects: simple_indirect_reference reference_variable . - 353 reference_variable: reference_variable . '[' dim_offset ']' - 354 | reference_variable . '{' expr '}' + $default reduce using rule 164 (function_call_parameter_list) - '[' shift, and go to state 224 - '{' shift, and go to state 225 - $default reduce using rule 346 (variable_without_objects) +state 485 + 166 non_empty_function_call_parameter_list: expr_without_variable . + 380 expr: expr_without_variable . -state 414 + ',' reduce using rule 166 (non_empty_function_call_parameter_list) + ')' reduce using rule 166 (non_empty_function_call_parameter_list) + $default reduce using rule 380 (expr) - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 230 | expr T_LOGICAL_OR @44 expr . - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - $default reduce using rule 230 (expr_without_variable) +state 486 + 167 non_empty_function_call_parameter_list: variable . + 217 expr_without_variable: variable . '=' expr + 218 | variable . '=' '&' variable + 220 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments + 224 | variable . T_PLUS_EQUAL expr + 225 | variable . T_MINUS_EQUAL expr + 226 | variable . T_MUL_EQUAL expr + 227 | variable . T_DIV_EQUAL expr + 228 | variable . T_CONCAT_EQUAL expr + 229 | variable . T_MOD_EQUAL expr + 230 | variable . T_AND_EQUAL expr + 231 | variable . T_OR_EQUAL expr + 232 | variable . T_XOR_EQUAL expr + 233 | variable . T_SL_EQUAL expr + 234 | variable . T_SR_EQUAL expr + 381 r_variable: variable . + 383 rw_variable: variable . + + '=' shift, and go to state 251 + T_SR_EQUAL shift, and go to state 252 + T_SL_EQUAL shift, and go to state 253 + T_XOR_EQUAL shift, and go to state 254 + T_OR_EQUAL shift, and go to state 255 + T_AND_EQUAL shift, and go to state 256 + T_MOD_EQUAL shift, and go to state 257 + T_CONCAT_EQUAL shift, and go to state 258 + T_DIV_EQUAL shift, and go to state 259 + T_MUL_EQUAL shift, and go to state 260 + T_MINUS_EQUAL shift, and go to state 261 + T_PLUS_EQUAL shift, and go to state 262 + + ',' reduce using rule 167 (non_empty_function_call_parameter_list) + T_DEC reduce using rule 383 (rw_variable) + T_INC reduce using rule 383 (rw_variable) + ')' reduce using rule 167 (non_empty_function_call_parameter_list) + $default reduce using rule 381 (r_variable) -state 415 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 232 | expr T_LOGICAL_AND @45 expr . - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 +state 487 - $default reduce using rule 232 (expr_without_variable) + 24 constant_declaration: constant_declaration ',' T_STRING '=' . static_scalar + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 567 + static_class_constant go to state 442 -state 416 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 261 | expr '?' @46 expr . ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - ':' shift, and go to state 478 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 +state 488 + 323 fully_qualified_class_name: T_NAMESPACE . T_NS_SEPARATOR namespace_name -state 417 + T_NS_SEPARATOR shift, and go to state 568 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 226 | expr T_BOOLEAN_OR @42 expr . - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - $default reduce using rule 226 (expr_without_variable) +state 489 + 324 fully_qualified_class_name: T_NS_SEPARATOR . namespace_name -state 418 + T_STRING shift, and go to state 111 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 228 | expr T_BOOLEAN_AND @43 expr . - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + namespace_name go to state 569 - $default reduce using rule 228 (expr_without_variable) +state 490 + + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 322 fully_qualified_class_name: namespace_name . -state 419 + T_NS_SEPARATOR shift, and go to state 213 - 206 expr_without_variable: variable '=' '&' T_NEW . class_name_reference @40 ctor_arguments + $default reduce using rule 322 (fully_qualified_class_name) - T_STRING shift, and go to state 125 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - fully_qualified_class_name go to state 126 - class_name_reference go to state 479 - dynamic_class_name_reference go to state 128 - static_member go to state 93 - base_variable go to state 129 - reference_variable go to state 130 - compound_variable go to state 97 - simple_indirect_reference go to state 131 +state 491 + 108 extends_from: T_EXTENDS fully_qualified_class_name . -state 420 + $default reduce using rule 108 (extends_from) - 204 expr_without_variable: variable '=' '&' variable . - $default reduce using rule 204 (expr_without_variable) +state 492 + 101 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @30 . implements_list '{' class_statement_list '}' -state 421 + T_IMPLEMENTS shift, and go to state 570 - 284 function_call: variable_without_objects '(' @52 function_call_parameter_list . ')' + $default reduce using rule 112 (implements_list) - ')' shift, and go to state 480 + implements_list go to state 571 -state 422 +state 493 - 366 variable_name: T_STRING . + 111 interface_extends_list: T_EXTENDS . interface_list - $default reduce using rule 366 (variable_name) + T_STRING shift, and go to state 111 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 + namespace_name go to state 490 + interface_list go to state 572 + fully_qualified_class_name go to state 573 -state 423 - 367 variable_name: '{' . expr '}' +state 494 + + 103 unticked_class_declaration_statement: interface_entry T_STRING @31 interface_extends_list . '{' class_statement_list '}' + + '{' shift, and go to state 574 + + +state 495 + + 99 unticked_function_declaration_statement: function is_reference T_STRING @29 . '(' parameter_list ')' '{' inner_statement_list '}' + + '(' shift, and go to state 575 + + +state 496 + + 294 expr_without_variable: function is_reference '(' @50 . parameter_list ')' lexical_vars '{' inner_statement_list '}' + + T_STRING shift, and go to state 111 + T_ARRAY shift, and go to state 576 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 + + ')' reduce using rule 152 (parameter_list) + $default reduce using rule 161 (optional_class_type) + + namespace_name go to state 490 + parameter_list go to state 577 + non_empty_parameter_list go to state 578 + optional_class_type go to state 579 + fully_qualified_class_name go to state 580 + + +state 497 + + 309 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' . @54 function_call_parameter_list ')' + + $default reduce using rule 308 (@54) + + @54 go to state 581 + + +state 498 + + 311 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' . @55 function_call_parameter_list ')' + + $default reduce using rule 310 (@55) + + @55 go to state 582 + + +state 499 + + 396 variable_without_objects: simple_indirect_reference reference_variable . + 405 reference_variable: reference_variable . '[' dim_offset ']' + 406 | reference_variable . '{' expr '}' + + '[' shift, and go to state 266 + '{' shift, and go to state 267 + + $default reduce using rule 396 (variable_without_objects) + + +state 500 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 244 | expr T_LOGICAL_OR @44 expr . + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 244 (expr_without_variable) + + +state 501 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 246 | expr T_LOGICAL_AND @45 expr . + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 246 (expr_without_variable) + + +state 502 + + 277 expr_without_variable: expr '?' ':' @48 . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -13333,124 +15190,290 @@ state 423 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 481 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 424 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 583 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 - 362 object_property: variable_without_objects . @59 - $default reduce using rule 361 (@59) - - @59 go to state 482 +state 503 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 275 | expr '?' @46 expr . ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + ':' shift, and go to state 584 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 -state 425 - 336 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @55 object_property . @56 method_or_not variable_properties +state 504 - $default reduce using rule 335 (@56) + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 240 | expr T_BOOLEAN_OR @42 expr . + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - @56 go to state 483 + $default reduce using rule 240 (expr_without_variable) -state 426 +state 505 - 360 object_property: object_dim_list . - 363 object_dim_list: object_dim_list . '[' dim_offset ']' - 364 | object_dim_list . '{' expr '}' + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 242 | expr T_BOOLEAN_AND @43 expr . + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 - '[' shift, and go to state 484 - '{' shift, and go to state 485 + $default reduce using rule 242 (expr_without_variable) - $default reduce using rule 360 (object_property) +state 506 -state 427 + 220 expr_without_variable: variable '=' '&' T_NEW . class_name_reference @40 ctor_arguments - 365 object_dim_list: variable_name . + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 142 + T_NS_SEPARATOR shift, and go to state 143 + '$' shift, and go to state 77 - $default reduce using rule 365 (object_dim_list) + namespace_name go to state 144 + class_name go to state 145 + class_name_reference go to state 585 + dynamic_class_name_reference go to state 147 + static_member go to state 102 + variable_class_name go to state 148 + base_variable go to state 149 + reference_variable go to state 150 + compound_variable go to state 107 + simple_indirect_reference go to state 151 -state 428 +state 507 - 353 reference_variable: reference_variable '[' dim_offset ']' . + 218 expr_without_variable: variable '=' '&' variable . - $default reduce using rule 353 (reference_variable) + $default reduce using rule 218 (expr_without_variable) -state 429 +state 508 - 354 reference_variable: reference_variable '{' expr '}' . + 317 function_call: variable_without_objects '(' @58 function_call_parameter_list . ')' - $default reduce using rule 354 (reference_variable) + ')' shift, and go to state 586 -state 430 +state 509 - 299 ctor_arguments: '(' function_call_parameter_list . ')' + 313 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' . @56 function_call_parameter_list ')' - ')' shift, and go to state 486 + $default reduce using rule 312 (@56) + @56 go to state 587 -state 431 - 290 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @53 object_property . @54 dynamic_class_name_variable_properties +state 510 - $default reduce using rule 289 (@54) + 315 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' . @57 function_call_parameter_list ')' - @54 go to state 487 + $default reduce using rule 314 (@57) + @57 go to state 588 -state 432 - 23 unticked_statement: T_IF '(' expr ')' ':' . @5 inner_statement_list @6 new_elseif_list new_else_single T_ENDIF ';' +state 511 - $default reduce using rule 21 (@5) + 418 variable_name: T_STRING . - @5 go to state 488 + $default reduce using rule 418 (variable_name) -state 433 +state 512 - 20 unticked_statement: T_IF '(' expr ')' @3 . statement @4 elseif_list else_single + 419 variable_name: '{' . expr '}' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -13475,88 +15498,135 @@ state 433 T_CLONE shift, and go to state 25 T_NEW shift, and go to state 26 T_EXIT shift, and go to state 27 - T_IF shift, and go to state 28 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 - T_INLINE_HTML shift, and go to state 34 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ECHO shift, and go to state 36 - T_DO shift, and go to state 37 - T_WHILE shift, and go to state 38 - T_FOR shift, and go to state 39 - T_FOREACH shift, and go to state 40 - T_DECLARE shift, and go to state 41 - T_SWITCH shift, and go to state 42 - T_BREAK shift, and go to state 43 - T_CONTINUE shift, and go to state 44 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - statement go to state 489 - unticked_statement go to state 76 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 589 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 434 +state 513 - 153 non_empty_function_call_parameter_list: '&' w_variable . + 414 object_property: variable_without_objects . @65 - $default reduce using rule 153 (non_empty_function_call_parameter_list) + $default reduce using rule 413 (@65) + @65 go to state 590 -state 435 - 278 function_call: T_STRING '(' @49 function_call_parameter_list ')' . +state 514 - $default reduce using rule 278 (function_call) + 386 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @61 object_property . @62 method_or_not variable_properties + $default reduce using rule 385 (@62) -state 436 + @62 go to state 591 - 154 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' . expr_without_variable - 155 | non_empty_function_call_parameter_list ',' . variable - 156 | non_empty_function_call_parameter_list ',' . '&' w_variable + +state 515 + + 412 object_property: object_dim_list . + 415 object_dim_list: object_dim_list . '[' dim_offset ']' + 416 | object_dim_list . '{' expr '}' + + '[' shift, and go to state 592 + '{' shift, and go to state 593 + + $default reduce using rule 412 (object_property) + + +state 516 + + 417 object_dim_list: variable_name . + + $default reduce using rule 417 (object_dim_list) + + +state 517 + + 405 reference_variable: reference_variable '[' dim_offset ']' . + + $default reduce using rule 405 (reference_variable) + + +state 518 + + 406 reference_variable: reference_variable '{' expr '}' . + + $default reduce using rule 406 (reference_variable) + + +state 519 + + 341 ctor_arguments: '(' function_call_parameter_list . ')' + + ')' shift, and go to state 594 + + +state 520 + + 329 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @59 object_property . @60 dynamic_class_name_variable_properties + + $default reduce using rule 328 (@60) + + @60 go to state 595 + + +state 521 + + 41 unticked_statement: T_IF '(' expr ')' ':' . @7 inner_statement_list @8 new_elseif_list new_else_single T_ENDIF ';' + + $default reduce using rule 39 (@7) + + @7 go to state 596 + + +state 522 + + 38 unticked_statement: T_IF '(' expr ')' @5 . statement @6 elseif_list else_single T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -13564,7 +15634,6 @@ state 436 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 490 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -13582,68 +15651,98 @@ state 436 T_CLONE shift, and go to state 25 T_NEW shift, and go to state 26 T_EXIT shift, and go to state 27 + T_IF shift, and go to state 28 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 T_STRING shift, and go to state 31 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 + T_INLINE_HTML shift, and go to state 34 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 491 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 151 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 492 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_ECHO shift, and go to state 36 + T_DO shift, and go to state 37 + T_WHILE shift, and go to state 38 + T_FOR shift, and go to state 39 + T_FOREACH shift, and go to state 40 + T_DECLARE shift, and go to state 41 + T_SWITCH shift, and go to state 42 + T_BREAK shift, and go to state 43 + T_CONTINUE shift, and go to state 44 + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + statement go to state 597 + unticked_statement go to state 84 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 437 +state 523 - 29 unticked_statement: T_DO @9 statement T_WHILE '(' . @10 expr ')' ';' + 47 unticked_statement: T_DO @11 statement T_WHILE '(' . @12 expr ')' ';' - $default reduce using rule 28 (@10) + $default reduce using rule 46 (@12) - @10 go to state 493 + @12 go to state 598 -state 438 +state 524 - 26 unticked_statement: T_WHILE '(' @7 expr ')' . @8 while_statement + 44 unticked_statement: T_WHILE '(' @9 expr ')' . @10 while_statement - $default reduce using rule 25 (@8) + $default reduce using rule 43 (@10) - @8 go to state 494 + @10 go to state 599 -state 439 +state 525 - 33 unticked_statement: T_FOR '(' for_expr ';' @11 . for_expr ';' @12 for_expr ')' @13 for_statement + 51 unticked_statement: T_FOR '(' for_expr ';' @13 . for_expr ';' @14 for_expr ')' @15 for_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -13670,52 +15769,61 @@ state 439 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 196 (for_expr) - - for_expr go to state 495 - non_empty_for_expr go to state 244 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 245 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 210 (for_expr) + + namespace_name go to state 80 + for_expr go to state 600 + non_empty_for_expr go to state 292 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 293 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 440 +state 526 - 199 non_empty_for_expr: non_empty_for_expr ',' @38 . expr + 213 non_empty_for_expr: non_empty_for_expr ',' @38 . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -13742,119 +15850,146 @@ state 440 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 496 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 601 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 441 - - 55 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @17 . variable foreach_optional_arg ')' @18 foreach_statement - - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 497 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - +state 527 -state 442 + 72 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @19 . variable foreach_optional_arg ')' @20 foreach_statement + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 602 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 - 52 unticked_statement: T_FOREACH '(' variable T_AS @15 . foreach_variable foreach_optional_arg ')' @16 foreach_statement - '&' shift, and go to state 498 - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 +state 528 - foreach_variable go to state 499 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 500 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + 69 unticked_statement: T_FOREACH '(' variable T_AS @17 . foreach_variable foreach_optional_arg ')' @18 foreach_statement + + '&' shift, and go to state 603 + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + foreach_variable go to state 604 + function_call go to state 93 + class_name go to state 136 + variable go to state 605 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 -state 443 +state 529 - 111 declare_list: T_STRING '=' . static_scalar + 126 declare_list: T_STRING '=' . static_scalar - '+' shift, and go to state 371 - '-' shift, and go to state 372 + '+' shift, and go to state 432 + '-' shift, and go to state 433 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 + T_STRING shift, and go to state 111 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 606 + static_class_constant go to state 442 - common_scalar go to state 375 - static_scalar go to state 501 - static_class_constant go to state 377 +state 530 -state 444 - - 112 declare_list: declare_list ',' . T_STRING '=' static_scalar + 127 declare_list: declare_list ',' . T_STRING '=' static_scalar - T_STRING shift, and go to state 502 + T_STRING shift, and go to state 607 -state 445 +state 531 - 57 unticked_statement: T_DECLARE @19 '(' declare_list ')' . declare_statement + 74 unticked_statement: T_DECLARE @21 '(' declare_list ')' . declare_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -13862,7 +15997,7 @@ state 445 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - ':' shift, and go to state 503 + ':' shift, and go to state 608 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -13897,413 +16032,985 @@ state 445 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - statement go to state 504 - unticked_statement go to state 76 - declare_statement go to state 505 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + statement go to state 609 + unticked_statement go to state 84 + declare_statement go to state 610 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 446 +state 532 - 35 unticked_statement: T_SWITCH '(' expr ')' @14 . switch_case_list + 53 unticked_statement: T_SWITCH '(' expr ')' @16 . switch_case_list - ':' shift, and go to state 506 - '{' shift, and go to state 507 + ':' shift, and go to state 611 + '{' shift, and go to state 612 - switch_case_list go to state 508 + switch_case_list go to state 613 -state 447 +state 533 - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference T_STRING @28 . '(' parameter_list ')' '{' inner_statement_list '}' + 358 static_scalar: '+' static_scalar . - '(' shift, and go to state 509 + $default reduce using rule 358 (static_scalar) -state 448 +state 534 - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' . T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches + 359 static_scalar: '-' static_scalar . - T_CATCH shift, and go to state 510 + $default reduce using rule 359 (static_scalar) -state 449 +state 535 - 161 global_var: '$' '{' expr '}' . + 360 static_scalar: T_ARRAY '(' . static_array_pair_list ')' - $default reduce using rule 161 (global_var) + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + $default reduce using rule 371 (static_array_pair_list) + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 614 + static_class_constant go to state 442 + static_array_pair_list go to state 615 + non_empty_static_array_pair_list go to state 616 -state 450 +state 536 - 310 static_scalar: '+' static_scalar . + 352 common_scalar: T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE . T_END_HEREDOC - $default reduce using rule 310 (static_scalar) + T_END_HEREDOC shift, and go to state 332 -state 451 +state 537 - 311 static_scalar: '-' static_scalar . + 320 class_name: T_NAMESPACE T_NS_SEPARATOR . namespace_name + 356 static_scalar: T_NAMESPACE T_NS_SEPARATOR . namespace_name - $default reduce using rule 311 (static_scalar) + T_STRING shift, and go to state 111 + namespace_name go to state 617 -state 452 - 314 static_class_constant: T_STRING T_PAAMAYIM_NEKUDOTAYIM . T_STRING +state 538 + + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 321 class_name: T_NS_SEPARATOR namespace_name . + 357 static_scalar: T_NS_SEPARATOR namespace_name . - T_STRING shift, and go to state 511 + T_NS_SEPARATOR shift, and go to state 213 + T_PAAMAYIM_NEKUDOTAYIM reduce using rule 321 (class_name) + $default reduce using rule 357 (static_scalar) -state 453 - 312 static_scalar: T_ARRAY '(' . static_array_pair_list ')' +state 539 + + 362 static_class_constant: class_name T_PAAMAYIM_NEKUDOTAYIM . T_STRING + + T_STRING shift, and go to state 618 + + +state 540 + + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' . T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches + + T_CATCH shift, and go to state 619 + + +state 541 + + 23 use_declaration: T_NS_SEPARATOR namespace_name T_AS T_STRING . + + $default reduce using rule 23 (use_declaration) + + +state 542 + + 176 global_var: '$' '{' expr '}' . + + $default reduce using rule 176 (global_var) - '+' shift, and go to state 371 - '-' shift, and go to state 372 + +state 543 + + 178 static_var_list: static_var_list ',' T_VARIABLE '=' . static_scalar + + '+' shift, and go to state 432 + '-' shift, and go to state 433 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 + T_STRING shift, and go to state 111 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 620 + static_class_constant go to state 442 - $default reduce using rule 321 (static_array_pair_list) - common_scalar go to state 375 - static_scalar go to state 512 - static_class_constant go to state 377 - static_array_pair_list go to state 513 - non_empty_static_array_pair_list go to state 514 +state 544 + 92 unset_variables: unset_variables ',' unset_variable . + + $default reduce using rule 92 (unset_variables) + + +state 545 + + 66 unticked_statement: T_UNSET '(' unset_variables ')' ';' . + + $default reduce using rule 66 (unticked_statement) + + +state 546 + + 461 isset_variables: isset_variables ',' @68 . variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 621 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + + +state 547 + + 426 assignment_list_element: T_LIST '(' . @66 assignment_list ')' + + $default reduce using rule 425 (@66) + + @66 go to state 622 + + +state 548 + + 422 assignment_list: assignment_list ',' . assignment_list_element + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_LIST shift, and go to state 457 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + $default reduce using rule 427 (assignment_list_element) + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 458 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + assignment_list_element go to state 623 + + +state 549 + + 216 expr_without_variable: T_LIST '(' @39 assignment_list ')' . '=' expr + + '=' shift, and go to state 624 + + +state 550 + + 436 non_empty_array_pair_list: expr T_DOUBLE_ARROW '&' . w_variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + w_variable go to state 625 + variable go to state 462 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + + +state 551 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 432 non_empty_array_pair_list: expr T_DOUBLE_ARROW expr . + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 432 (non_empty_array_pair_list) + + +state 552 + + 435 non_empty_array_pair_list: non_empty_array_pair_list ',' '&' . w_variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + w_variable go to state 626 + variable go to state 462 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + + +state 553 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 430 non_empty_array_pair_list: non_empty_array_pair_list ',' expr . T_DOUBLE_ARROW expr + 431 | non_empty_array_pair_list ',' expr . + 434 | non_empty_array_pair_list ',' expr . T_DOUBLE_ARROW '&' w_variable + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + T_DOUBLE_ARROW shift, and go to state 627 + + $default reduce using rule 431 (non_empty_array_pair_list) + + +state 554 + + 449 encaps_var_offset: T_STRING . + + $default reduce using rule 449 (encaps_var_offset) + + +state 555 + + 451 encaps_var_offset: T_VARIABLE . + + $default reduce using rule 451 (encaps_var_offset) + + +state 556 + + 450 encaps_var_offset: T_NUM_STRING . + + $default reduce using rule 450 (encaps_var_offset) + + +state 557 + + 444 encaps_var: T_VARIABLE '[' @67 encaps_var_offset . ']' + + ']' shift, and go to state 628 + + +state 558 + + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 447 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr . ']' '}' + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ']' shift, and go to state 629 + + +state 559 + + 305 function_call: T_NAMESPACE T_NS_SEPARATOR namespace_name '(' @52 . function_call_parameter_list ')' + + T_REQUIRE_ONCE shift, and go to state 5 + T_REQUIRE shift, and go to state 6 + T_EVAL shift, and go to state 7 + T_INCLUDE_ONCE shift, and go to state 8 + T_INCLUDE shift, and go to state 9 + T_PRINT shift, and go to state 10 + '&' shift, and go to state 482 + '+' shift, and go to state 11 + '-' shift, and go to state 12 + '!' shift, and go to state 13 + '~' shift, and go to state 14 + '@' shift, and go to state 15 + T_UNSET_CAST shift, and go to state 16 + T_BOOL_CAST shift, and go to state 17 + T_OBJECT_CAST shift, and go to state 18 + T_ARRAY_CAST shift, and go to state 19 + T_STRING_CAST shift, and go to state 20 + T_DOUBLE_CAST shift, and go to state 21 + T_INT_CAST shift, and go to state 22 + T_DEC shift, and go to state 23 + T_INC shift, and go to state 24 + T_CLONE shift, and go to state 25 + T_NEW shift, and go to state 26 + T_EXIT shift, and go to state 27 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 32 + T_VARIABLE shift, and go to state 33 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 630 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 + + +state 560 + + 15 top_statement: T_NAMESPACE '{' @3 top_statement_list '}' . + + $default reduce using rule 15 (top_statement) -state 454 - 163 static_var_list: static_var_list ',' T_VARIABLE '=' . static_scalar +state 561 + + 3 top_statement_list: top_statement_list . @1 top_statement + 13 top_statement: T_NAMESPACE namespace_name '{' @2 top_statement_list . '}' + + '}' shift, and go to state 631 + + $default reduce using rule 2 (@1) + + @1 go to state 4 + + +state 562 + + 307 function_call: T_NS_SEPARATOR namespace_name '(' @53 function_call_parameter_list . ')' + + ')' shift, and go to state 632 + + +state 563 - '+' shift, and go to state 371 - '-' shift, and go to state 372 + 32 inner_statement: T_HALT_COMPILER '(' . ')' ';' + + ')' shift, and go to state 633 + + +state 564 + + 168 non_empty_function_call_parameter_list: '&' w_variable . + + $default reduce using rule 168 (non_empty_function_call_parameter_list) + + +state 565 + + 303 function_call: namespace_name '(' @51 function_call_parameter_list ')' . + + $default reduce using rule 303 (function_call) + + +state 566 + + 169 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' . expr_without_variable + 170 | non_empty_function_call_parameter_list ',' . variable + 171 | non_empty_function_call_parameter_list ',' . '&' w_variable + + T_REQUIRE_ONCE shift, and go to state 5 + T_REQUIRE shift, and go to state 6 + T_EVAL shift, and go to state 7 + T_INCLUDE_ONCE shift, and go to state 8 + T_INCLUDE shift, and go to state 9 + T_PRINT shift, and go to state 10 + '&' shift, and go to state 634 + '+' shift, and go to state 11 + '-' shift, and go to state 12 + '!' shift, and go to state 13 + '~' shift, and go to state 14 + '@' shift, and go to state 15 + T_UNSET_CAST shift, and go to state 16 + T_BOOL_CAST shift, and go to state 17 + T_OBJECT_CAST shift, and go to state 18 + T_ARRAY_CAST shift, and go to state 19 + T_STRING_CAST shift, and go to state 20 + T_DOUBLE_CAST shift, and go to state 21 + T_INT_CAST shift, and go to state 22 + T_DEC shift, and go to state 23 + T_INC shift, and go to state 24 + T_CLONE shift, and go to state 25 + T_NEW shift, and go to state 26 + T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 32 + T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 635 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 636 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 - common_scalar go to state 375 - static_scalar go to state 515 - static_class_constant go to state 377 +state 567 -state 455 + 24 constant_declaration: constant_declaration ',' T_STRING '=' static_scalar . - 74 unset_variables: unset_variables ',' unset_variable . + $default reduce using rule 24 (constant_declaration) - $default reduce using rule 74 (unset_variables) +state 568 -state 456 + 323 fully_qualified_class_name: T_NAMESPACE T_NS_SEPARATOR . namespace_name - 49 unticked_statement: T_UNSET '(' unset_variables ')' ';' . + T_STRING shift, and go to state 111 - $default reduce using rule 49 (unticked_statement) + namespace_name go to state 637 -state 457 +state 569 - 408 isset_variables: isset_variables ',' @62 . variable + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 324 fully_qualified_class_name: T_NS_SEPARATOR namespace_name . - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + T_NS_SEPARATOR shift, and go to state 213 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 516 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + $default reduce using rule 324 (fully_qualified_class_name) -state 458 +state 570 - 374 assignment_list_element: T_LIST '(' . @60 assignment_list ')' + 113 implements_list: T_IMPLEMENTS . interface_list - $default reduce using rule 373 (@60) + T_STRING shift, and go to state 111 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 - @60 go to state 517 + namespace_name go to state 490 + interface_list go to state 638 + fully_qualified_class_name go to state 573 -state 459 +state 571 - 370 assignment_list: assignment_list ',' . assignment_list_element + 101 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @30 implements_list . '{' class_statement_list '}' - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - T_LIST shift, and go to state 385 - '$' shift, and go to state 71 + '{' shift, and go to state 639 - $default reduce using rule 375 (assignment_list_element) - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 386 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - assignment_list_element go to state 518 +state 572 + 111 interface_extends_list: T_EXTENDS interface_list . + 115 interface_list: interface_list . ',' fully_qualified_class_name -state 460 + ',' shift, and go to state 640 - 202 expr_without_variable: T_LIST '(' @39 assignment_list ')' . '=' expr + $default reduce using rule 111 (interface_extends_list) - '=' shift, and go to state 519 +state 573 -state 461 + 114 interface_list: fully_qualified_class_name . - 384 non_empty_array_pair_list: expr T_DOUBLE_ARROW '&' . w_variable + $default reduce using rule 114 (interface_list) - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - function_call go to state 84 - fully_qualified_class_name go to state 120 - w_variable go to state 520 - variable go to state 390 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 +state 574 + 103 unticked_class_declaration_statement: interface_entry T_STRING @31 interface_extends_list '{' . class_statement_list '}' -state 462 + $default reduce using rule 182 (class_statement_list) - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 380 non_empty_array_pair_list: expr T_DOUBLE_ARROW expr . - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 380 (non_empty_array_pair_list) + class_statement_list go to state 641 -state 463 +state 575 - 383 non_empty_array_pair_list: non_empty_array_pair_list ',' '&' . w_variable + 99 unticked_function_declaration_statement: function is_reference T_STRING @29 '(' . parameter_list ')' '{' inner_statement_list '}' - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + T_STRING shift, and go to state 111 + T_ARRAY shift, and go to state 576 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 - function_call go to state 84 - fully_qualified_class_name go to state 120 - w_variable go to state 521 - variable go to state 390 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + ')' reduce using rule 152 (parameter_list) + $default reduce using rule 161 (optional_class_type) + namespace_name go to state 490 + parameter_list go to state 642 + non_empty_parameter_list go to state 578 + optional_class_type go to state 579 + fully_qualified_class_name go to state 580 -state 464 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 378 non_empty_array_pair_list: non_empty_array_pair_list ',' expr . T_DOUBLE_ARROW expr - 379 | non_empty_array_pair_list ',' expr . - 382 | non_empty_array_pair_list ',' expr . T_DOUBLE_ARROW '&' w_variable - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - T_DOUBLE_ARROW shift, and go to state 522 - - $default reduce using rule 379 (non_empty_array_pair_list) +state 576 + 163 optional_class_type: T_ARRAY . -state 465 + $default reduce using rule 163 (optional_class_type) - 391 encaps_var: T_VARIABLE '[' @61 . encaps_var_offset ']' - T_STRING shift, and go to state 523 - T_VARIABLE shift, and go to state 524 - T_NUM_STRING shift, and go to state 525 +state 577 - encaps_var_offset go to state 526 + 294 expr_without_variable: function is_reference '(' @50 parameter_list . ')' lexical_vars '{' inner_statement_list '}' + ')' shift, and go to state 643 -state 466 - 392 encaps_var: T_VARIABLE T_OBJECT_OPERATOR T_STRING . +state 578 + + 151 parameter_list: non_empty_parameter_list . + 157 non_empty_parameter_list: non_empty_parameter_list . ',' optional_class_type T_VARIABLE + 158 | non_empty_parameter_list . ',' optional_class_type '&' T_VARIABLE + 159 | non_empty_parameter_list . ',' optional_class_type '&' T_VARIABLE '=' static_scalar + 160 | non_empty_parameter_list . ',' optional_class_type T_VARIABLE '=' static_scalar + + ',' shift, and go to state 644 + + $default reduce using rule 151 (parameter_list) + + +state 579 + + 153 non_empty_parameter_list: optional_class_type . T_VARIABLE + 154 | optional_class_type . '&' T_VARIABLE + 155 | optional_class_type . '&' T_VARIABLE '=' static_scalar + 156 | optional_class_type . T_VARIABLE '=' static_scalar + + '&' shift, and go to state 645 + T_VARIABLE shift, and go to state 646 + - $default reduce using rule 392 (encaps_var) +state 580 + + 162 optional_class_type: fully_qualified_class_name . + + $default reduce using rule 162 (optional_class_type) + + +state 581 + + 309 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @54 . function_call_parameter_list ')' + + T_REQUIRE_ONCE shift, and go to state 5 + T_REQUIRE shift, and go to state 6 + T_EVAL shift, and go to state 7 + T_INCLUDE_ONCE shift, and go to state 8 + T_INCLUDE shift, and go to state 9 + T_PRINT shift, and go to state 10 + '&' shift, and go to state 482 + '+' shift, and go to state 11 + '-' shift, and go to state 12 + '!' shift, and go to state 13 + '~' shift, and go to state 14 + '@' shift, and go to state 15 + T_UNSET_CAST shift, and go to state 16 + T_BOOL_CAST shift, and go to state 17 + T_OBJECT_CAST shift, and go to state 18 + T_ARRAY_CAST shift, and go to state 19 + T_STRING_CAST shift, and go to state 20 + T_DOUBLE_CAST shift, and go to state 21 + T_INT_CAST shift, and go to state 22 + T_DEC shift, and go to state 23 + T_INC shift, and go to state 24 + T_CLONE shift, and go to state 25 + T_NEW shift, and go to state 26 + T_EXIT shift, and go to state 27 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_STRING_VARNAME shift, and go to state 32 + T_VARIABLE shift, and go to state 33 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 647 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 467 +state 582 - 394 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' . expr ']' '}' + 311 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @55 . function_call_parameter_list ')' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -14311,6 +17018,7 @@ state 467 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 + '&' shift, and go to state 482 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -14330,112 +17038,143 @@ state 467 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 527 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 468 - - 393 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES expr '}' . - - $default reduce using rule 393 (encaps_var) - - -state 469 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 648 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 - 395 encaps_var: T_CURLY_OPEN variable '}' . - $default reduce using rule 395 (encaps_var) - - -state 470 - - 15 inner_statement: T_HALT_COMPILER '(' . ')' ';' - - ')' shift, and go to state 528 - - -state 471 - - 98 implements_list: T_IMPLEMENTS . interface_list - - T_STRING shift, and go to state 406 - - interface_list go to state 529 - fully_qualified_class_name go to state 474 - - -state 472 - - 86 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @29 implements_list . '{' class_statement_list '}' +state 583 - '{' shift, and go to state 530 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 277 | expr '?' ':' @48 expr . + + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 277 (expr_without_variable) -state 473 +state 584 - 96 interface_extends_list: T_EXTENDS interface_list . - 100 interface_list: interface_list . ',' fully_qualified_class_name + 275 expr_without_variable: expr '?' @46 expr ':' . @47 expr - ',' shift, and go to state 531 + $default reduce using rule 274 (@47) - $default reduce using rule 96 (interface_extends_list) + @47 go to state 649 -state 474 +state 585 - 99 interface_list: fully_qualified_class_name . + 220 expr_without_variable: variable '=' '&' T_NEW class_name_reference . @40 ctor_arguments - $default reduce using rule 99 (interface_list) + $default reduce using rule 219 (@40) + @40 go to state 650 -state 475 - 88 unticked_class_declaration_statement: interface_entry T_STRING @30 interface_extends_list '{' . class_statement_list '}' +state 586 - $default reduce using rule 167 (class_statement_list) + 317 function_call: variable_without_objects '(' @58 function_call_parameter_list ')' . - class_statement_list go to state 532 + $default reduce using rule 317 (function_call) -state 476 +state 587 - 280 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @50 . function_call_parameter_list ')' + 313 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @56 . function_call_parameter_list ')' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -14443,7 +17182,7 @@ state 476 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 351 + '&' shift, and go to state 482 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -14463,52 +17202,61 @@ state 476 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 150 (function_call_parameter_list) - - function_call_parameter_list go to state 533 - non_empty_function_call_parameter_list go to state 353 - expr_without_variable go to state 354 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 151 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 355 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 651 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 477 +state 588 - 282 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @51 . function_call_parameter_list ')' + 315 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @57 . function_call_parameter_list ')' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -14516,7 +17264,7 @@ state 477 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 351 + '&' shift, and go to state 482 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -14536,154 +17284,139 @@ state 477 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 150 (function_call_parameter_list) - - function_call_parameter_list go to state 534 - non_empty_function_call_parameter_list go to state 353 - expr_without_variable go to state 354 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 151 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 355 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 478 - - 261 expr_without_variable: expr '?' @46 expr ':' . @47 expr + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 652 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 - $default reduce using rule 260 (@47) - @47 go to state 535 - - -state 479 - - 206 expr_without_variable: variable '=' '&' T_NEW class_name_reference . @40 ctor_arguments - - $default reduce using rule 205 (@40) - - @40 go to state 536 - - -state 480 - - 284 function_call: variable_without_objects '(' @52 function_call_parameter_list ')' . - - $default reduce using rule 284 (function_call) - - -state 481 +state 589 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 367 variable_name: '{' expr . '}' - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - '}' shift, and go to state 537 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 419 variable_name: '{' expr . '}' + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + '}' shift, and go to state 653 -state 482 +state 590 - 362 object_property: variable_without_objects @59 . + 414 object_property: variable_without_objects @65 . - $default reduce using rule 362 (object_property) + $default reduce using rule 414 (object_property) -state 483 +state 591 - 336 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @55 object_property @56 . method_or_not variable_properties + 386 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @61 object_property @62 . method_or_not variable_properties - '(' shift, and go to state 538 + '(' shift, and go to state 654 - $default reduce using rule 344 (method_or_not) + $default reduce using rule 394 (method_or_not) - method_or_not go to state 539 + method_or_not go to state 655 -state 484 +state 592 - 363 object_dim_list: object_dim_list '[' . dim_offset ']' + 415 object_dim_list: object_dim_list '[' . dim_offset ']' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -14710,51 +17443,60 @@ state 484 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 358 (dim_offset) - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 340 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - dim_offset go to state 540 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 410 (dim_offset) + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 407 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + dim_offset go to state 656 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 485 +state 593 - 364 object_dim_list: object_dim_list '{' . expr '}' + 416 object_dim_list: object_dim_list '{' . expr '}' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -14781,153 +17523,91 @@ state 485 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 541 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 486 - - 299 ctor_arguments: '(' function_call_parameter_list ')' . - - $default reduce using rule 299 (ctor_arguments) - - -state 487 - - 290 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @53 object_property @54 . dynamic_class_name_variable_properties - - $default reduce using rule 293 (dynamic_class_name_variable_properties) - - dynamic_class_name_variable_properties go to state 542 - - -state 488 - - 23 unticked_statement: T_IF '(' expr ')' ':' @5 . inner_statement_list @6 new_elseif_list new_else_single T_ENDIF ';' + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 657 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 - $default reduce using rule 11 (inner_statement_list) - inner_statement_list go to state 543 +state 594 + 341 ctor_arguments: '(' function_call_parameter_list ')' . -state 489 + $default reduce using rule 341 (ctor_arguments) - 20 unticked_statement: T_IF '(' expr ')' @3 statement . @4 elseif_list else_single - $default reduce using rule 19 (@4) +state 595 - @4 go to state 544 + 329 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @59 object_property @60 . dynamic_class_name_variable_properties + $default reduce using rule 332 (dynamic_class_name_variable_properties) -state 490 + dynamic_class_name_variable_properties go to state 658 - 156 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' '&' . w_variable - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 +state 596 - function_call go to state 84 - fully_qualified_class_name go to state 120 - w_variable go to state 545 - variable go to state 390 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + 41 unticked_statement: T_IF '(' expr ')' ':' @7 . inner_statement_list @8 new_elseif_list new_else_single T_ENDIF ';' + $default reduce using rule 28 (inner_statement_list) -state 491 + inner_statement_list go to state 659 - 154 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' expr_without_variable . - 330 expr: expr_without_variable . - ',' reduce using rule 154 (non_empty_function_call_parameter_list) - ')' reduce using rule 154 (non_empty_function_call_parameter_list) - $default reduce using rule 330 (expr) +state 597 + 38 unticked_statement: T_IF '(' expr ')' @5 statement . @6 elseif_list else_single -state 492 + $default reduce using rule 37 (@6) - 155 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' variable . - 203 expr_without_variable: variable . '=' expr - 204 | variable . '=' '&' variable - 206 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments - 210 | variable . T_PLUS_EQUAL expr - 211 | variable . T_MINUS_EQUAL expr - 212 | variable . T_MUL_EQUAL expr - 213 | variable . T_DIV_EQUAL expr - 214 | variable . T_CONCAT_EQUAL expr - 215 | variable . T_MOD_EQUAL expr - 216 | variable . T_AND_EQUAL expr - 217 | variable . T_OR_EQUAL expr - 218 | variable . T_XOR_EQUAL expr - 219 | variable . T_SL_EQUAL expr - 220 | variable . T_SR_EQUAL expr - 331 r_variable: variable . - 333 rw_variable: variable . - - '=' shift, and go to state 210 - T_SR_EQUAL shift, and go to state 211 - T_SL_EQUAL shift, and go to state 212 - T_XOR_EQUAL shift, and go to state 213 - T_OR_EQUAL shift, and go to state 214 - T_AND_EQUAL shift, and go to state 215 - T_MOD_EQUAL shift, and go to state 216 - T_CONCAT_EQUAL shift, and go to state 217 - T_DIV_EQUAL shift, and go to state 218 - T_MUL_EQUAL shift, and go to state 219 - T_MINUS_EQUAL shift, and go to state 220 - T_PLUS_EQUAL shift, and go to state 221 - - ',' reduce using rule 155 (non_empty_function_call_parameter_list) - T_DEC reduce using rule 333 (rw_variable) - T_INC reduce using rule 333 (rw_variable) - ')' reduce using rule 155 (non_empty_function_call_parameter_list) - $default reduce using rule 331 (r_variable) + @6 go to state 660 -state 493 +state 598 - 29 unticked_statement: T_DO @9 statement T_WHILE '(' @10 . expr ')' ';' + 47 unticked_statement: T_DO @11 statement T_WHILE '(' @12 . expr ')' ';' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -14954,48 +17634,57 @@ state 493 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 546 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 661 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 494 +state 599 - 26 unticked_statement: T_WHILE '(' @7 expr ')' @8 . while_statement + 44 unticked_statement: T_WHILE '(' @9 expr ')' @10 . while_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -15003,7 +17692,7 @@ state 494 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - ':' shift, and go to state 547 + ':' shift, and go to state 662 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -15038,345 +17727,361 @@ state 494 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - statement go to state 548 - unticked_statement go to state 76 - while_statement go to state 549 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 495 - - 33 unticked_statement: T_FOR '(' for_expr ';' @11 for_expr . ';' @12 for_expr ')' @13 for_statement - - ';' shift, and go to state 550 - + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + statement go to state 663 + unticked_statement go to state 84 + while_statement go to state 664 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 496 - - 199 non_empty_for_expr: non_empty_for_expr ',' @38 expr . - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 199 (non_empty_for_expr) +state 600 -state 497 + 51 unticked_statement: T_FOR '(' for_expr ';' @13 for_expr . ';' @14 for_expr ')' @15 for_statement - 55 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @17 variable . foreach_optional_arg ')' @18 foreach_statement + ';' shift, and go to state 665 - T_DOUBLE_ARROW shift, and go to state 551 - $default reduce using rule 101 (foreach_optional_arg) +state 601 - foreach_optional_arg go to state 552 + 213 non_empty_for_expr: non_empty_for_expr ',' @38 expr . + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 213 (non_empty_for_expr) -state 498 +state 602 - 104 foreach_variable: '&' . variable + 72 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @19 variable . foreach_optional_arg ')' @20 foreach_statement - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + T_DOUBLE_ARROW shift, and go to state 666 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 553 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 + $default reduce using rule 116 (foreach_optional_arg) + foreach_optional_arg go to state 667 -state 499 - 52 unticked_statement: T_FOREACH '(' variable T_AS @15 foreach_variable . foreach_optional_arg ')' @16 foreach_statement +state 603 - T_DOUBLE_ARROW shift, and go to state 551 + 119 foreach_variable: '&' . variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 668 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 - $default reduce using rule 101 (foreach_optional_arg) - foreach_optional_arg go to state 554 +state 604 + 69 unticked_statement: T_FOREACH '(' variable T_AS @17 foreach_variable . foreach_optional_arg ')' @18 foreach_statement -state 500 + T_DOUBLE_ARROW shift, and go to state 666 - 103 foreach_variable: variable . + $default reduce using rule 116 (foreach_optional_arg) - $default reduce using rule 103 (foreach_variable) + foreach_optional_arg go to state 669 -state 501 +state 605 - 111 declare_list: T_STRING '=' static_scalar . + 118 foreach_variable: variable . - $default reduce using rule 111 (declare_list) + $default reduce using rule 118 (foreach_variable) -state 502 +state 606 - 112 declare_list: declare_list ',' T_STRING . '=' static_scalar + 126 declare_list: T_STRING '=' static_scalar . - '=' shift, and go to state 555 + $default reduce using rule 126 (declare_list) -state 503 +state 607 - 110 declare_statement: ':' . inner_statement_list T_ENDDECLARE ';' + 127 declare_list: declare_list ',' T_STRING . '=' static_scalar - $default reduce using rule 11 (inner_statement_list) + '=' shift, and go to state 670 - inner_statement_list go to state 556 +state 608 -state 504 + 125 declare_statement: ':' . inner_statement_list T_ENDDECLARE ';' - 109 declare_statement: statement . + $default reduce using rule 28 (inner_statement_list) - $default reduce using rule 109 (declare_statement) + inner_statement_list go to state 671 -state 505 +state 609 - 57 unticked_statement: T_DECLARE @19 '(' declare_list ')' declare_statement . + 124 declare_statement: statement . - $default reduce using rule 57 (unticked_statement) + $default reduce using rule 124 (declare_statement) -state 506 +state 610 - 115 switch_case_list: ':' . case_list T_ENDSWITCH ';' - 116 | ':' . ';' case_list T_ENDSWITCH ';' + 74 unticked_statement: T_DECLARE @21 '(' declare_list ')' declare_statement . - ';' shift, and go to state 557 + $default reduce using rule 74 (unticked_statement) - $default reduce using rule 117 (case_list) - case_list go to state 558 +state 611 + 130 switch_case_list: ':' . case_list T_ENDSWITCH ';' + 131 | ':' . ';' case_list T_ENDSWITCH ';' -state 507 + ';' shift, and go to state 672 - 113 switch_case_list: '{' . case_list '}' - 114 | '{' . ';' case_list '}' + $default reduce using rule 132 (case_list) - ';' shift, and go to state 559 + case_list go to state 673 - $default reduce using rule 117 (case_list) - case_list go to state 560 +state 612 + 128 switch_case_list: '{' . case_list '}' + 129 | '{' . ';' case_list '}' -state 508 + ';' shift, and go to state 674 - 35 unticked_statement: T_SWITCH '(' expr ')' @14 switch_case_list . + $default reduce using rule 132 (case_list) - $default reduce using rule 35 (unticked_statement) + case_list go to state 675 -state 509 +state 613 - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference T_STRING @28 '(' . parameter_list ')' '{' inner_statement_list '}' + 53 unticked_statement: T_SWITCH '(' expr ')' @16 switch_case_list . - T_STRING shift, and go to state 561 - T_ARRAY shift, and go to state 562 + $default reduce using rule 53 (unticked_statement) - ')' reduce using rule 137 (parameter_list) - $default reduce using rule 146 (optional_class_type) - parameter_list go to state 563 - non_empty_parameter_list go to state 564 - optional_class_type go to state 565 +state 614 + 377 non_empty_static_array_pair_list: static_scalar . T_DOUBLE_ARROW static_scalar + 378 | static_scalar . -state 510 + T_DOUBLE_ARROW shift, and go to state 676 - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH . '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches + $default reduce using rule 378 (non_empty_static_array_pair_list) - '(' shift, and go to state 566 +state 615 -state 511 + 360 static_scalar: T_ARRAY '(' static_array_pair_list . ')' - 314 static_class_constant: T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING . + ')' shift, and go to state 677 - $default reduce using rule 314 (static_class_constant) +state 616 -state 512 + 372 static_array_pair_list: non_empty_static_array_pair_list . possible_comma + 375 non_empty_static_array_pair_list: non_empty_static_array_pair_list . ',' static_scalar T_DOUBLE_ARROW static_scalar + 376 | non_empty_static_array_pair_list . ',' static_scalar - 327 non_empty_static_array_pair_list: static_scalar . T_DOUBLE_ARROW static_scalar - 328 | static_scalar . + ',' shift, and go to state 678 - T_DOUBLE_ARROW shift, and go to state 567 + $default reduce using rule 373 (possible_comma) - $default reduce using rule 328 (non_empty_static_array_pair_list) + possible_comma go to state 679 -state 513 +state 617 - 312 static_scalar: T_ARRAY '(' static_array_pair_list . ')' + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 320 class_name: T_NAMESPACE T_NS_SEPARATOR namespace_name . + 356 static_scalar: T_NAMESPACE T_NS_SEPARATOR namespace_name . - ')' shift, and go to state 568 + T_NS_SEPARATOR shift, and go to state 213 + T_PAAMAYIM_NEKUDOTAYIM reduce using rule 320 (class_name) + $default reduce using rule 356 (static_scalar) -state 514 - 322 static_array_pair_list: non_empty_static_array_pair_list . possible_comma - 325 non_empty_static_array_pair_list: non_empty_static_array_pair_list . ',' static_scalar T_DOUBLE_ARROW static_scalar - 326 | non_empty_static_array_pair_list . ',' static_scalar +state 618 - ',' shift, and go to state 569 + 362 static_class_constant: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING . - $default reduce using rule 323 (possible_comma) + $default reduce using rule 362 (static_class_constant) - possible_comma go to state 570 +state 619 -state 515 + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH . '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches - 163 static_var_list: static_var_list ',' T_VARIABLE '=' static_scalar . + '(' shift, and go to state 680 - $default reduce using rule 163 (static_var_list) +state 620 -state 516 + 178 static_var_list: static_var_list ',' T_VARIABLE '=' static_scalar . - 408 isset_variables: isset_variables ',' @62 variable . + $default reduce using rule 178 (static_var_list) - $default reduce using rule 408 (isset_variables) +state 621 -state 517 + 461 isset_variables: isset_variables ',' @68 variable . - 374 assignment_list_element: T_LIST '(' @60 . assignment_list ')' + $default reduce using rule 461 (isset_variables) - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - T_LIST shift, and go to state 385 - '$' shift, and go to state 71 - $default reduce using rule 375 (assignment_list_element) +state 622 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 386 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - assignment_list go to state 571 - assignment_list_element go to state 388 + 426 assignment_list_element: T_LIST '(' @66 . assignment_list ')' + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_LIST shift, and go to state 457 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + $default reduce using rule 427 (assignment_list_element) + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + variable go to state 458 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + assignment_list go to state 681 + assignment_list_element go to state 460 -state 518 +state 623 - 370 assignment_list: assignment_list ',' assignment_list_element . + 422 assignment_list: assignment_list ',' assignment_list_element . - $default reduce using rule 370 (assignment_list) + $default reduce using rule 422 (assignment_list) -state 519 +state 624 - 202 expr_without_variable: T_LIST '(' @39 assignment_list ')' '=' . expr + 216 expr_without_variable: T_LIST '(' @39 assignment_list ')' '=' . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -15403,63 +18108,72 @@ state 519 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 572 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 682 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 520 +state 625 - 384 non_empty_array_pair_list: expr T_DOUBLE_ARROW '&' w_variable . + 436 non_empty_array_pair_list: expr T_DOUBLE_ARROW '&' w_variable . - $default reduce using rule 384 (non_empty_array_pair_list) + $default reduce using rule 436 (non_empty_array_pair_list) -state 521 +state 626 - 383 non_empty_array_pair_list: non_empty_array_pair_list ',' '&' w_variable . + 435 non_empty_array_pair_list: non_empty_array_pair_list ',' '&' w_variable . - $default reduce using rule 383 (non_empty_array_pair_list) + $default reduce using rule 435 (non_empty_array_pair_list) -state 522 +state 627 - 378 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW . expr - 382 | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW . '&' w_variable + 430 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW . expr + 434 | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW . '&' w_variable T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -15467,7 +18181,7 @@ state 522 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 573 + '&' shift, and go to state 683 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -15487,209 +18201,310 @@ state 522 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 574 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 684 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 523 +state 628 - 396 encaps_var_offset: T_STRING . + 444 encaps_var: T_VARIABLE '[' @67 encaps_var_offset ']' . - $default reduce using rule 396 (encaps_var_offset) + $default reduce using rule 444 (encaps_var) -state 524 +state 629 - 398 encaps_var_offset: T_VARIABLE . + 447 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' . '}' - $default reduce using rule 398 (encaps_var_offset) + '}' shift, and go to state 685 -state 525 +state 630 - 397 encaps_var_offset: T_NUM_STRING . + 305 function_call: T_NAMESPACE T_NS_SEPARATOR namespace_name '(' @52 function_call_parameter_list . ')' - $default reduce using rule 397 (encaps_var_offset) + ')' shift, and go to state 686 -state 526 +state 631 - 391 encaps_var: T_VARIABLE '[' @61 encaps_var_offset . ']' + 13 top_statement: T_NAMESPACE namespace_name '{' @2 top_statement_list '}' . - ']' shift, and go to state 575 + $default reduce using rule 13 (top_statement) -state 527 +state 632 - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 394 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr . ']' '}' - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ']' shift, and go to state 576 + 307 function_call: T_NS_SEPARATOR namespace_name '(' @53 function_call_parameter_list ')' . + $default reduce using rule 307 (function_call) -state 528 - 15 inner_statement: T_HALT_COMPILER '(' ')' . ';' +state 633 + + 32 inner_statement: T_HALT_COMPILER '(' ')' . ';' - ';' shift, and go to state 577 + ';' shift, and go to state 687 -state 529 +state 634 - 98 implements_list: T_IMPLEMENTS interface_list . - 100 interface_list: interface_list . ',' fully_qualified_class_name + 171 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' '&' . w_variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + w_variable go to state 688 + variable go to state 462 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 - ',' shift, and go to state 531 - $default reduce using rule 98 (implements_list) +state 635 + 169 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' expr_without_variable . + 380 expr: expr_without_variable . -state 530 + ',' reduce using rule 169 (non_empty_function_call_parameter_list) + ')' reduce using rule 169 (non_empty_function_call_parameter_list) + $default reduce using rule 380 (expr) - 86 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @29 implements_list '{' . class_statement_list '}' - $default reduce using rule 167 (class_statement_list) +state 636 - class_statement_list go to state 578 + 170 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' variable . + 217 expr_without_variable: variable . '=' expr + 218 | variable . '=' '&' variable + 220 | variable . '=' '&' T_NEW class_name_reference @40 ctor_arguments + 224 | variable . T_PLUS_EQUAL expr + 225 | variable . T_MINUS_EQUAL expr + 226 | variable . T_MUL_EQUAL expr + 227 | variable . T_DIV_EQUAL expr + 228 | variable . T_CONCAT_EQUAL expr + 229 | variable . T_MOD_EQUAL expr + 230 | variable . T_AND_EQUAL expr + 231 | variable . T_OR_EQUAL expr + 232 | variable . T_XOR_EQUAL expr + 233 | variable . T_SL_EQUAL expr + 234 | variable . T_SR_EQUAL expr + 381 r_variable: variable . + 383 rw_variable: variable . + + '=' shift, and go to state 251 + T_SR_EQUAL shift, and go to state 252 + T_SL_EQUAL shift, and go to state 253 + T_XOR_EQUAL shift, and go to state 254 + T_OR_EQUAL shift, and go to state 255 + T_AND_EQUAL shift, and go to state 256 + T_MOD_EQUAL shift, and go to state 257 + T_CONCAT_EQUAL shift, and go to state 258 + T_DIV_EQUAL shift, and go to state 259 + T_MUL_EQUAL shift, and go to state 260 + T_MINUS_EQUAL shift, and go to state 261 + T_PLUS_EQUAL shift, and go to state 262 + + ',' reduce using rule 170 (non_empty_function_call_parameter_list) + T_DEC reduce using rule 383 (rw_variable) + T_INC reduce using rule 383 (rw_variable) + ')' reduce using rule 170 (non_empty_function_call_parameter_list) + $default reduce using rule 381 (r_variable) -state 531 +state 637 - 100 interface_list: interface_list ',' . fully_qualified_class_name + 6 namespace_name: namespace_name . T_NS_SEPARATOR T_STRING + 323 fully_qualified_class_name: T_NAMESPACE T_NS_SEPARATOR namespace_name . - T_STRING shift, and go to state 406 + T_NS_SEPARATOR shift, and go to state 213 - fully_qualified_class_name go to state 579 + $default reduce using rule 323 (fully_qualified_class_name) -state 532 +state 638 + + 113 implements_list: T_IMPLEMENTS interface_list . + 115 interface_list: interface_list . ',' fully_qualified_class_name + + ',' shift, and go to state 640 + + $default reduce using rule 113 (implements_list) + + +state 639 + + 101 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @30 implements_list '{' . class_statement_list '}' + + $default reduce using rule 182 (class_statement_list) + + class_statement_list go to state 689 + + +state 640 + + 115 interface_list: interface_list ',' . fully_qualified_class_name + + T_STRING shift, and go to state 111 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 + + namespace_name go to state 490 + fully_qualified_class_name go to state 690 + - 88 unticked_class_declaration_statement: interface_entry T_STRING @30 interface_extends_list '{' class_statement_list . '}' - 166 class_statement_list: class_statement_list . class_statement +state 641 + + 103 unticked_class_declaration_statement: interface_entry T_STRING @31 interface_extends_list '{' class_statement_list . '}' + 181 class_statement_list: class_statement_list . class_statement + + T_CONST shift, and go to state 691 + T_PUBLIC shift, and go to state 692 + T_PROTECTED shift, and go to state 693 + T_PRIVATE shift, and go to state 694 + T_FINAL shift, and go to state 695 + T_ABSTRACT shift, and go to state 696 + T_STATIC shift, and go to state 697 + T_VAR shift, and go to state 698 + '}' shift, and go to state 699 + + $default reduce using rule 192 (method_modifiers) + + class_statement go to state 700 + variable_modifiers go to state 701 + method_modifiers go to state 702 + non_empty_member_modifiers go to state 703 + member_modifier go to state 704 + class_constant_declaration go to state 705 + + +state 642 + + 99 unticked_function_declaration_statement: function is_reference T_STRING @29 '(' parameter_list . ')' '{' inner_statement_list '}' + + ')' shift, and go to state 706 + + +state 643 + + 294 expr_without_variable: function is_reference '(' @50 parameter_list ')' . lexical_vars '{' inner_statement_list '}' + + T_USE shift, and go to state 707 + + $default reduce using rule 296 (lexical_vars) + + lexical_vars go to state 708 + + +state 644 + + 157 non_empty_parameter_list: non_empty_parameter_list ',' . optional_class_type T_VARIABLE + 158 | non_empty_parameter_list ',' . optional_class_type '&' T_VARIABLE + 159 | non_empty_parameter_list ',' . optional_class_type '&' T_VARIABLE '=' static_scalar + 160 | non_empty_parameter_list ',' . optional_class_type T_VARIABLE '=' static_scalar + + T_STRING shift, and go to state 111 + T_ARRAY shift, and go to state 576 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 + + $default reduce using rule 161 (optional_class_type) + + namespace_name go to state 490 + optional_class_type go to state 709 + fully_qualified_class_name go to state 580 + + +state 645 + + 154 non_empty_parameter_list: optional_class_type '&' . T_VARIABLE + 155 | optional_class_type '&' . T_VARIABLE '=' static_scalar + + T_VARIABLE shift, and go to state 710 + + +state 646 - T_CONST shift, and go to state 580 - T_PUBLIC shift, and go to state 581 - T_PROTECTED shift, and go to state 582 - T_PRIVATE shift, and go to state 583 - T_FINAL shift, and go to state 584 - T_ABSTRACT shift, and go to state 585 - T_STATIC shift, and go to state 586 - T_VAR shift, and go to state 587 - '}' shift, and go to state 588 + 153 non_empty_parameter_list: optional_class_type T_VARIABLE . + 156 | optional_class_type T_VARIABLE . '=' static_scalar - $default reduce using rule 178 (method_modifiers) + '=' shift, and go to state 711 - class_statement go to state 589 - variable_modifiers go to state 590 - method_modifiers go to state 591 - non_empty_member_modifiers go to state 592 - member_modifier go to state 593 - class_constant_declaration go to state 594 + $default reduce using rule 153 (non_empty_parameter_list) -state 533 +state 647 - 280 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @50 function_call_parameter_list . ')' + 309 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @54 function_call_parameter_list . ')' - ')' shift, and go to state 595 + ')' shift, and go to state 712 -state 534 +state 648 - 282 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @51 function_call_parameter_list . ')' + 311 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @55 function_call_parameter_list . ')' - ')' shift, and go to state 596 + ')' shift, and go to state 713 -state 535 +state 649 - 261 expr_without_variable: expr '?' @46 expr ':' @47 . expr + 275 expr_without_variable: expr '?' @46 expr ':' @47 . expr T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -15716,914 +18531,1019 @@ state 535 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 597 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 714 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 536 +state 650 - 206 expr_without_variable: variable '=' '&' T_NEW class_name_reference @40 . ctor_arguments + 220 expr_without_variable: variable '=' '&' T_NEW class_name_reference @40 . ctor_arguments - '(' shift, and go to state 346 + '(' shift, and go to state 416 - $default reduce using rule 298 (ctor_arguments) + $default reduce using rule 340 (ctor_arguments) - ctor_arguments go to state 598 + ctor_arguments go to state 715 -state 537 +state 651 - 367 variable_name: '{' expr '}' . + 313 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @56 function_call_parameter_list . ')' - $default reduce using rule 367 (variable_name) + ')' shift, and go to state 716 -state 538 +state 652 + + 315 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @57 function_call_parameter_list . ')' - 343 method_or_not: '(' . @58 function_call_parameter_list ')' + ')' shift, and go to state 717 - $default reduce using rule 342 (@58) - @58 go to state 599 +state 653 + 419 variable_name: '{' expr '}' . -state 539 + $default reduce using rule 419 (variable_name) - 336 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @55 object_property @56 method_or_not . variable_properties - $default reduce using rule 339 (variable_properties) +state 654 - variable_properties go to state 600 + 393 method_or_not: '(' . @64 function_call_parameter_list ')' + $default reduce using rule 392 (@64) -state 540 + @64 go to state 718 - 363 object_dim_list: object_dim_list '[' dim_offset . ']' - ']' shift, and go to state 601 +state 655 + 386 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @61 object_property @62 method_or_not . variable_properties -state 541 + $default reduce using rule 389 (variable_properties) - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 364 object_dim_list: object_dim_list '{' expr . '}' - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - '}' shift, and go to state 602 + variable_properties go to state 719 -state 542 +state 656 - 290 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @53 object_property @54 dynamic_class_name_variable_properties . - 292 dynamic_class_name_variable_properties: dynamic_class_name_variable_properties . dynamic_class_name_variable_property + 415 object_dim_list: object_dim_list '[' dim_offset . ']' - T_OBJECT_OPERATOR shift, and go to state 603 + ']' shift, and go to state 720 - $default reduce using rule 290 (dynamic_class_name_reference) - dynamic_class_name_variable_property go to state 604 +state 657 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 416 object_dim_list: object_dim_list '{' expr . '}' + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + '}' shift, and go to state 721 -state 543 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 23 unticked_statement: T_IF '(' expr ')' ':' @5 inner_statement_list . @6 new_elseif_list new_else_single T_ENDIF ';' +state 658 - T_ELSEIF reduce using rule 22 (@6) - T_ELSE reduce using rule 22 (@6) - T_ENDIF reduce using rule 22 (@6) - $default reduce using rule 9 (@2) + 329 dynamic_class_name_reference: base_variable T_OBJECT_OPERATOR @59 object_property @60 dynamic_class_name_variable_properties . + 331 dynamic_class_name_variable_properties: dynamic_class_name_variable_properties . dynamic_class_name_variable_property - @2 go to state 288 - @6 go to state 605 + T_OBJECT_OPERATOR shift, and go to state 722 + $default reduce using rule 329 (dynamic_class_name_reference) -state 544 + dynamic_class_name_variable_property go to state 723 - 20 unticked_statement: T_IF '(' expr ')' @3 statement @4 . elseif_list else_single - $default reduce using rule 126 (elseif_list) +state 659 - elseif_list go to state 606 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 41 unticked_statement: T_IF '(' expr ')' ':' @7 inner_statement_list . @8 new_elseif_list new_else_single T_ENDIF ';' + T_ELSEIF reduce using rule 40 (@8) + T_ELSE reduce using rule 40 (@8) + T_ENDIF reduce using rule 40 (@8) + $default reduce using rule 26 (@4) -state 545 + @4 go to state 347 + @8 go to state 724 - 156 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' '&' w_variable . - $default reduce using rule 156 (non_empty_function_call_parameter_list) +state 660 + 38 unticked_statement: T_IF '(' expr ')' @5 statement @6 . elseif_list else_single -state 546 + $default reduce using rule 141 (elseif_list) - 29 unticked_statement: T_DO @9 statement T_WHILE '(' @10 expr . ')' ';' - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ')' shift, and go to state 607 + elseif_list go to state 725 -state 547 +state 661 - 125 while_statement: ':' . inner_statement_list T_ENDWHILE ';' + 47 unticked_statement: T_DO @11 statement T_WHILE '(' @12 expr . ')' ';' + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ')' shift, and go to state 726 - $default reduce using rule 11 (inner_statement_list) - inner_statement_list go to state 608 +state 662 + 140 while_statement: ':' . inner_statement_list T_ENDWHILE ';' -state 548 + $default reduce using rule 28 (inner_statement_list) - 124 while_statement: statement . + inner_statement_list go to state 727 - $default reduce using rule 124 (while_statement) +state 663 -state 549 + 139 while_statement: statement . - 26 unticked_statement: T_WHILE '(' @7 expr ')' @8 while_statement . + $default reduce using rule 139 (while_statement) - $default reduce using rule 26 (unticked_statement) +state 664 -state 550 + 44 unticked_statement: T_WHILE '(' @9 expr ')' @10 while_statement . - 33 unticked_statement: T_FOR '(' for_expr ';' @11 for_expr ';' . @12 for_expr ')' @13 for_statement + $default reduce using rule 44 (unticked_statement) - $default reduce using rule 31 (@12) - @12 go to state 609 +state 665 + 51 unticked_statement: T_FOR '(' for_expr ';' @13 for_expr ';' . @14 for_expr ')' @15 for_statement -state 551 + $default reduce using rule 49 (@14) - 102 foreach_optional_arg: T_DOUBLE_ARROW . foreach_variable + @14 go to state 728 - '&' shift, and go to state 498 - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 - foreach_variable go to state 610 - function_call go to state 84 - fully_qualified_class_name go to state 120 - variable go to state 500 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 +state 666 + 117 foreach_optional_arg: T_DOUBLE_ARROW . foreach_variable + + '&' shift, and go to state 603 + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + foreach_variable go to state 729 + function_call go to state 93 + class_name go to state 136 + variable go to state 605 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 -state 552 - 55 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @17 variable foreach_optional_arg . ')' @18 foreach_statement +state 667 - ')' shift, and go to state 611 + 72 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @19 variable foreach_optional_arg . ')' @20 foreach_statement + ')' shift, and go to state 730 -state 553 - 104 foreach_variable: '&' variable . +state 668 - $default reduce using rule 104 (foreach_variable) + 119 foreach_variable: '&' variable . + $default reduce using rule 119 (foreach_variable) -state 554 - 52 unticked_statement: T_FOREACH '(' variable T_AS @15 foreach_variable foreach_optional_arg . ')' @16 foreach_statement +state 669 - ')' shift, and go to state 612 + 69 unticked_statement: T_FOREACH '(' variable T_AS @17 foreach_variable foreach_optional_arg . ')' @18 foreach_statement + ')' shift, and go to state 731 -state 555 - 112 declare_list: declare_list ',' T_STRING '=' . static_scalar +state 670 + + 127 declare_list: declare_list ',' T_STRING '=' . static_scalar - '+' shift, and go to state 371 - '-' shift, and go to state 372 + '+' shift, and go to state 432 + '-' shift, and go to state 433 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 + T_STRING shift, and go to state 111 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 732 + static_class_constant go to state 442 - common_scalar go to state 375 - static_scalar go to state 613 - static_class_constant go to state 377 +state 671 -state 556 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 125 declare_statement: ':' inner_statement_list . T_ENDDECLARE ';' - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 110 declare_statement: ':' inner_statement_list . T_ENDDECLARE ';' + T_ENDDECLARE shift, and go to state 733 - T_ENDDECLARE shift, and go to state 614 + $default reduce using rule 26 (@4) - $default reduce using rule 9 (@2) + @4 go to state 347 - @2 go to state 288 +state 672 -state 557 + 131 switch_case_list: ':' ';' . case_list T_ENDSWITCH ';' - 116 switch_case_list: ':' ';' . case_list T_ENDSWITCH ';' + $default reduce using rule 132 (case_list) - $default reduce using rule 117 (case_list) + case_list go to state 734 - case_list go to state 615 +state 673 -state 558 + 130 switch_case_list: ':' case_list . T_ENDSWITCH ';' + 134 case_list: case_list . T_CASE expr case_separator @32 inner_statement_list + 136 | case_list . T_DEFAULT case_separator @33 inner_statement_list - 115 switch_case_list: ':' case_list . T_ENDSWITCH ';' - 119 case_list: case_list . T_CASE expr case_separator @31 inner_statement_list - 121 | case_list . T_DEFAULT case_separator @32 inner_statement_list + T_ENDSWITCH shift, and go to state 735 + T_CASE shift, and go to state 736 + T_DEFAULT shift, and go to state 737 - T_ENDSWITCH shift, and go to state 616 - T_CASE shift, and go to state 617 - T_DEFAULT shift, and go to state 618 +state 674 -state 559 + 129 switch_case_list: '{' ';' . case_list '}' - 114 switch_case_list: '{' ';' . case_list '}' + $default reduce using rule 132 (case_list) - $default reduce using rule 117 (case_list) + case_list go to state 738 - case_list go to state 619 +state 675 -state 560 + 128 switch_case_list: '{' case_list . '}' + 134 case_list: case_list . T_CASE expr case_separator @32 inner_statement_list + 136 | case_list . T_DEFAULT case_separator @33 inner_statement_list - 113 switch_case_list: '{' case_list . '}' - 119 case_list: case_list . T_CASE expr case_separator @31 inner_statement_list - 121 | case_list . T_DEFAULT case_separator @32 inner_statement_list + T_CASE shift, and go to state 736 + T_DEFAULT shift, and go to state 737 + '}' shift, and go to state 739 - T_CASE shift, and go to state 617 - T_DEFAULT shift, and go to state 618 - '}' shift, and go to state 620 +state 676 -state 561 + 377 non_empty_static_array_pair_list: static_scalar T_DOUBLE_ARROW . static_scalar - 147 optional_class_type: T_STRING . + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 740 + static_class_constant go to state 442 - $default reduce using rule 147 (optional_class_type) +state 677 -state 562 + 360 static_scalar: T_ARRAY '(' static_array_pair_list ')' . - 148 optional_class_type: T_ARRAY . + $default reduce using rule 360 (static_scalar) - $default reduce using rule 148 (optional_class_type) +state 678 -state 563 + 374 possible_comma: ',' . + 375 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' . static_scalar T_DOUBLE_ARROW static_scalar + 376 | non_empty_static_array_pair_list ',' . static_scalar - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference T_STRING @28 '(' parameter_list . ')' '{' inner_statement_list '}' + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + $default reduce using rule 374 (possible_comma) + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 741 + static_class_constant go to state 442 - ')' shift, and go to state 621 +state 679 -state 564 + 372 static_array_pair_list: non_empty_static_array_pair_list possible_comma . - 136 parameter_list: non_empty_parameter_list . - 142 non_empty_parameter_list: non_empty_parameter_list . ',' optional_class_type T_VARIABLE - 143 | non_empty_parameter_list . ',' optional_class_type '&' T_VARIABLE - 144 | non_empty_parameter_list . ',' optional_class_type '&' T_VARIABLE '=' static_scalar - 145 | non_empty_parameter_list . ',' optional_class_type T_VARIABLE '=' static_scalar + $default reduce using rule 372 (static_array_pair_list) - ',' shift, and go to state 622 - $default reduce using rule 136 (parameter_list) +state 680 + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' . @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches -state 565 + $default reduce using rule 77 (@23) - 138 non_empty_parameter_list: optional_class_type . T_VARIABLE - 139 | optional_class_type . '&' T_VARIABLE - 140 | optional_class_type . '&' T_VARIABLE '=' static_scalar - 141 | optional_class_type . T_VARIABLE '=' static_scalar + @23 go to state 742 - '&' shift, and go to state 623 - T_VARIABLE shift, and go to state 624 +state 681 -state 566 + 422 assignment_list: assignment_list . ',' assignment_list_element + 426 assignment_list_element: T_LIST '(' @66 assignment_list . ')' - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' . @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches + ',' shift, and go to state 548 + ')' shift, and go to state 743 - $default reduce using rule 60 (@21) - @21 go to state 625 +state 682 + 216 expr_without_variable: T_LIST '(' @39 assignment_list ')' '=' expr . + 240 | expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 -state 567 + $default reduce using rule 216 (expr_without_variable) - 327 non_empty_static_array_pair_list: static_scalar T_DOUBLE_ARROW . static_scalar - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 +state 683 - common_scalar go to state 375 - static_scalar go to state 626 - static_class_constant go to state 377 + 434 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' . w_variable + + T_STRING shift, and go to state 111 + T_VARIABLE shift, and go to state 33 + T_STATIC shift, and go to state 112 + T_NAMESPACE shift, and go to state 133 + T_NS_SEPARATOR shift, and go to state 134 + '$' shift, and go to state 77 + + namespace_name go to state 135 + function_call go to state 93 + class_name go to state 136 + w_variable go to state 744 + variable go to state 462 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 139 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 -state 568 +state 684 - 312 static_scalar: T_ARRAY '(' static_array_pair_list ')' . + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + 430 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr . + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 430 (non_empty_array_pair_list) - $default reduce using rule 312 (static_scalar) +state 685 -state 569 + 447 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' . - 324 possible_comma: ',' . - 325 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' . static_scalar T_DOUBLE_ARROW static_scalar - 326 | non_empty_static_array_pair_list ',' . static_scalar + $default reduce using rule 447 (encaps_var) - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - $default reduce using rule 324 (possible_comma) +state 686 - common_scalar go to state 375 - static_scalar go to state 627 - static_class_constant go to state 377 + 305 function_call: T_NAMESPACE T_NS_SEPARATOR namespace_name '(' @52 function_call_parameter_list ')' . + $default reduce using rule 305 (function_call) -state 570 - 322 static_array_pair_list: non_empty_static_array_pair_list possible_comma . +state 687 - $default reduce using rule 322 (static_array_pair_list) + 32 inner_statement: T_HALT_COMPILER '(' ')' ';' . + $default reduce using rule 32 (inner_statement) -state 571 - 370 assignment_list: assignment_list . ',' assignment_list_element - 374 assignment_list_element: T_LIST '(' @60 assignment_list . ')' +state 688 - ',' shift, and go to state 459 - ')' shift, and go to state 628 + 171 non_empty_function_call_parameter_list: non_empty_function_call_parameter_list ',' '&' w_variable . + $default reduce using rule 171 (non_empty_function_call_parameter_list) -state 572 - 202 expr_without_variable: T_LIST '(' @39 assignment_list ')' '=' expr . - 226 | expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 202 (expr_without_variable) +state 689 + 101 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @30 implements_list '{' class_statement_list . '}' + 181 class_statement_list: class_statement_list . class_statement -state 573 + T_CONST shift, and go to state 691 + T_PUBLIC shift, and go to state 692 + T_PROTECTED shift, and go to state 693 + T_PRIVATE shift, and go to state 694 + T_FINAL shift, and go to state 695 + T_ABSTRACT shift, and go to state 696 + T_STATIC shift, and go to state 697 + T_VAR shift, and go to state 698 + '}' shift, and go to state 745 - 382 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' . w_variable + $default reduce using rule 192 (method_modifiers) - T_STRING shift, and go to state 119 - T_VARIABLE shift, and go to state 33 - '$' shift, and go to state 71 + class_statement go to state 700 + variable_modifiers go to state 701 + method_modifiers go to state 702 + non_empty_member_modifiers go to state 703 + member_modifier go to state 704 + class_constant_declaration go to state 705 - function_call go to state 84 - fully_qualified_class_name go to state 120 - w_variable go to state 629 - variable go to state 390 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 +state 690 -state 574 + 115 interface_list: interface_list ',' fully_qualified_class_name . - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 378 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr . - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - - $default reduce using rule 378 (non_empty_array_pair_list) + $default reduce using rule 115 (interface_list) -state 575 +state 691 - 391 encaps_var: T_VARIABLE '[' @61 encaps_var_offset ']' . + 207 class_constant_declaration: T_CONST . T_STRING '=' static_scalar - $default reduce using rule 391 (encaps_var) + T_STRING shift, and go to state 746 -state 576 +state 692 - 394 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' . '}' + 196 member_modifier: T_PUBLIC . - '}' shift, and go to state 630 + $default reduce using rule 196 (member_modifier) -state 577 +state 693 - 15 inner_statement: T_HALT_COMPILER '(' ')' ';' . + 197 member_modifier: T_PROTECTED . - $default reduce using rule 15 (inner_statement) + $default reduce using rule 197 (member_modifier) -state 578 +state 694 + + 198 member_modifier: T_PRIVATE . - 86 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @29 implements_list '{' class_statement_list . '}' - 166 class_statement_list: class_statement_list . class_statement + $default reduce using rule 198 (member_modifier) - T_CONST shift, and go to state 580 - T_PUBLIC shift, and go to state 581 - T_PROTECTED shift, and go to state 582 - T_PRIVATE shift, and go to state 583 - T_FINAL shift, and go to state 584 - T_ABSTRACT shift, and go to state 585 - T_STATIC shift, and go to state 586 - T_VAR shift, and go to state 587 - '}' shift, and go to state 631 - $default reduce using rule 178 (method_modifiers) +state 695 - class_statement go to state 589 - variable_modifiers go to state 590 - method_modifiers go to state 591 - non_empty_member_modifiers go to state 592 - member_modifier go to state 593 - class_constant_declaration go to state 594 + 201 member_modifier: T_FINAL . + $default reduce using rule 201 (member_modifier) -state 579 - 100 interface_list: interface_list ',' fully_qualified_class_name . +state 696 - $default reduce using rule 100 (interface_list) + 200 member_modifier: T_ABSTRACT . + $default reduce using rule 200 (member_modifier) -state 580 - 193 class_constant_declaration: T_CONST . T_STRING '=' static_scalar +state 697 - T_STRING shift, and go to state 632 + 199 member_modifier: T_STATIC . + $default reduce using rule 199 (member_modifier) -state 581 - 182 member_modifier: T_PUBLIC . +state 698 - $default reduce using rule 182 (member_modifier) + 191 variable_modifiers: T_VAR . + $default reduce using rule 191 (variable_modifiers) -state 582 - 183 member_modifier: T_PROTECTED . +state 699 - $default reduce using rule 183 (member_modifier) + 103 unticked_class_declaration_statement: interface_entry T_STRING @31 interface_extends_list '{' class_statement_list '}' . + $default reduce using rule 103 (unticked_class_declaration_statement) -state 583 - 184 member_modifier: T_PRIVATE . +state 700 - $default reduce using rule 184 (member_modifier) + 181 class_statement_list: class_statement_list class_statement . + $default reduce using rule 181 (class_statement_list) -state 584 - 187 member_modifier: T_FINAL . +state 701 - $default reduce using rule 187 (member_modifier) + 184 class_statement: variable_modifiers . @36 class_variable_declaration ';' + $default reduce using rule 183 (@36) -state 585 + @36 go to state 747 - 186 member_modifier: T_ABSTRACT . - $default reduce using rule 186 (member_modifier) +state 702 + 187 class_statement: method_modifiers . function is_reference T_STRING @37 '(' parameter_list ')' method_body -state 586 + T_FUNCTION shift, and go to state 46 - 185 member_modifier: T_STATIC . + function go to state 748 - $default reduce using rule 185 (member_modifier) +state 703 -state 587 + 190 variable_modifiers: non_empty_member_modifiers . + 193 method_modifiers: non_empty_member_modifiers . + 195 non_empty_member_modifiers: non_empty_member_modifiers . member_modifier - 177 variable_modifiers: T_VAR . + T_PUBLIC shift, and go to state 692 + T_PROTECTED shift, and go to state 693 + T_PRIVATE shift, and go to state 694 + T_FINAL shift, and go to state 695 + T_ABSTRACT shift, and go to state 696 + T_STATIC shift, and go to state 697 - $default reduce using rule 177 (variable_modifiers) + T_FUNCTION reduce using rule 193 (method_modifiers) + $default reduce using rule 190 (variable_modifiers) + member_modifier go to state 749 -state 588 - 88 unticked_class_declaration_statement: interface_entry T_STRING @30 interface_extends_list '{' class_statement_list '}' . +state 704 - $default reduce using rule 88 (unticked_class_declaration_statement) + 194 non_empty_member_modifiers: member_modifier . + $default reduce using rule 194 (non_empty_member_modifiers) -state 589 - 166 class_statement_list: class_statement_list class_statement . +state 705 - $default reduce using rule 166 (class_statement_list) + 185 class_statement: class_constant_declaration . ';' + 206 class_constant_declaration: class_constant_declaration . ',' T_STRING '=' static_scalar + ',' shift, and go to state 750 + ';' shift, and go to state 751 -state 590 - 169 class_statement: variable_modifiers . @35 class_variable_declaration ';' +state 706 - $default reduce using rule 168 (@35) + 99 unticked_function_declaration_statement: function is_reference T_STRING @29 '(' parameter_list ')' . '{' inner_statement_list '}' - @35 go to state 633 + '{' shift, and go to state 752 -state 591 +state 707 - 173 class_statement: method_modifiers . T_FUNCTION @36 is_reference T_STRING @37 '(' parameter_list ')' method_body + 297 lexical_vars: T_USE . '(' lexical_var_list ')' - T_FUNCTION shift, and go to state 634 + '(' shift, and go to state 753 -state 592 +state 708 - 176 variable_modifiers: non_empty_member_modifiers . - 179 method_modifiers: non_empty_member_modifiers . - 181 non_empty_member_modifiers: non_empty_member_modifiers . member_modifier + 294 expr_without_variable: function is_reference '(' @50 parameter_list ')' lexical_vars . '{' inner_statement_list '}' - T_PUBLIC shift, and go to state 581 - T_PROTECTED shift, and go to state 582 - T_PRIVATE shift, and go to state 583 - T_FINAL shift, and go to state 584 - T_ABSTRACT shift, and go to state 585 - T_STATIC shift, and go to state 586 + '{' shift, and go to state 754 - T_FUNCTION reduce using rule 179 (method_modifiers) - $default reduce using rule 176 (variable_modifiers) - member_modifier go to state 635 +state 709 + 157 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type . T_VARIABLE + 158 | non_empty_parameter_list ',' optional_class_type . '&' T_VARIABLE + 159 | non_empty_parameter_list ',' optional_class_type . '&' T_VARIABLE '=' static_scalar + 160 | non_empty_parameter_list ',' optional_class_type . T_VARIABLE '=' static_scalar -state 593 + '&' shift, and go to state 755 + T_VARIABLE shift, and go to state 756 - 180 non_empty_member_modifiers: member_modifier . - $default reduce using rule 180 (non_empty_member_modifiers) +state 710 + 154 non_empty_parameter_list: optional_class_type '&' T_VARIABLE . + 155 | optional_class_type '&' T_VARIABLE . '=' static_scalar -state 594 + '=' shift, and go to state 757 - 170 class_statement: class_constant_declaration . ';' - 192 class_constant_declaration: class_constant_declaration . ',' T_STRING '=' static_scalar + $default reduce using rule 154 (non_empty_parameter_list) - ',' shift, and go to state 636 - ';' shift, and go to state 637 +state 711 -state 595 + 156 non_empty_parameter_list: optional_class_type T_VARIABLE '=' . static_scalar - 280 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @50 function_call_parameter_list ')' . + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 758 + static_class_constant go to state 442 - $default reduce using rule 280 (function_call) +state 712 -state 596 + 309 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @54 function_call_parameter_list ')' . - 282 function_call: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @51 function_call_parameter_list ')' . + $default reduce using rule 309 (function_call) - $default reduce using rule 282 (function_call) +state 713 -state 597 + 311 function_call: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @55 function_call_parameter_list ')' . - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - 261 | expr '?' @46 expr ':' @47 expr . - - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 + $default reduce using rule 311 (function_call) - $default reduce using rule 261 (expr_without_variable) +state 714 -state 598 + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 275 | expr '?' @46 expr ':' @47 expr . + 277 | expr . '?' ':' @48 expr + + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + + $default reduce using rule 275 (expr_without_variable) - 206 expr_without_variable: variable '=' '&' T_NEW class_name_reference @40 ctor_arguments . - $default reduce using rule 206 (expr_without_variable) +state 715 + 220 expr_without_variable: variable '=' '&' T_NEW class_name_reference @40 ctor_arguments . + + $default reduce using rule 220 (expr_without_variable) + + +state 716 + + 313 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' @56 function_call_parameter_list ')' . + + $default reduce using rule 313 (function_call) + + +state 717 + + 315 function_call: variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' @57 function_call_parameter_list ')' . + + $default reduce using rule 315 (function_call) -state 599 - 343 method_or_not: '(' @58 . function_call_parameter_list ')' +state 718 + + 393 method_or_not: '(' @64 . function_call_parameter_list ')' T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -16631,7 +19551,7 @@ state 599 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - '&' shift, and go to state 351 + '&' shift, and go to state 482 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -16651,146 +19571,155 @@ state 599 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 150 (function_call_parameter_list) - - function_call_parameter_list go to state 638 - non_empty_function_call_parameter_list go to state 353 - expr_without_variable go to state 354 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 151 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 355 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 165 (function_call_parameter_list) + + namespace_name go to state 80 + function_call_parameter_list go to state 759 + non_empty_function_call_parameter_list go to state 484 + expr_without_variable go to state 485 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 172 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 486 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 600 +state 719 - 336 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @55 object_property @56 method_or_not variable_properties . - 338 variable_properties: variable_properties . variable_property + 386 variable: base_variable_with_function_calls T_OBJECT_OPERATOR @61 object_property @62 method_or_not variable_properties . + 388 variable_properties: variable_properties . variable_property - T_OBJECT_OPERATOR shift, and go to state 639 + T_OBJECT_OPERATOR shift, and go to state 760 - $default reduce using rule 336 (variable) + $default reduce using rule 386 (variable) - variable_property go to state 640 + variable_property go to state 761 -state 601 +state 720 - 363 object_dim_list: object_dim_list '[' dim_offset ']' . + 415 object_dim_list: object_dim_list '[' dim_offset ']' . - $default reduce using rule 363 (object_dim_list) + $default reduce using rule 415 (object_dim_list) -state 602 +state 721 - 364 object_dim_list: object_dim_list '{' expr '}' . + 416 object_dim_list: object_dim_list '{' expr '}' . - $default reduce using rule 364 (object_dim_list) + $default reduce using rule 416 (object_dim_list) -state 603 +state 722 - 294 dynamic_class_name_variable_property: T_OBJECT_OPERATOR . object_property + 333 dynamic_class_name_variable_property: T_OBJECT_OPERATOR . object_property - T_STRING shift, and go to state 422 + T_STRING shift, and go to state 511 T_VARIABLE shift, and go to state 33 - '{' shift, and go to state 423 - '$' shift, and go to state 71 + '{' shift, and go to state 512 + '$' shift, and go to state 77 - variable_without_objects go to state 424 - reference_variable go to state 297 - compound_variable go to state 97 - object_property go to state 641 - object_dim_list go to state 426 - variable_name go to state 427 - simple_indirect_reference go to state 298 + variable_without_objects go to state 513 + reference_variable go to state 361 + compound_variable go to state 107 + object_property go to state 762 + object_dim_list go to state 515 + variable_name go to state 516 + simple_indirect_reference go to state 362 -state 604 +state 723 - 292 dynamic_class_name_variable_properties: dynamic_class_name_variable_properties dynamic_class_name_variable_property . + 331 dynamic_class_name_variable_properties: dynamic_class_name_variable_properties dynamic_class_name_variable_property . - $default reduce using rule 292 (dynamic_class_name_variable_properties) + $default reduce using rule 331 (dynamic_class_name_variable_properties) -state 605 +state 724 - 23 unticked_statement: T_IF '(' expr ')' ':' @5 inner_statement_list @6 . new_elseif_list new_else_single T_ENDIF ';' + 41 unticked_statement: T_IF '(' expr ')' ':' @7 inner_statement_list @8 . new_elseif_list new_else_single T_ENDIF ';' - $default reduce using rule 129 (new_elseif_list) + $default reduce using rule 144 (new_elseif_list) - new_elseif_list go to state 642 + new_elseif_list go to state 763 -state 606 +state 725 - 20 unticked_statement: T_IF '(' expr ')' @3 statement @4 elseif_list . else_single - 128 elseif_list: elseif_list . T_ELSEIF '(' expr ')' @33 statement + 38 unticked_statement: T_IF '(' expr ')' @5 statement @6 elseif_list . else_single + 143 elseif_list: elseif_list . T_ELSEIF '(' expr ')' @34 statement - T_ELSEIF shift, and go to state 643 - T_ELSE shift, and go to state 644 + T_ELSEIF shift, and go to state 764 + T_ELSE shift, and go to state 765 - T_ELSEIF [reduce using rule 132 (else_single)] - T_ELSE [reduce using rule 132 (else_single)] - $default reduce using rule 132 (else_single) + T_ELSEIF [reduce using rule 147 (else_single)] + T_ELSE [reduce using rule 147 (else_single)] + $default reduce using rule 147 (else_single) - else_single go to state 645 + else_single go to state 766 -state 607 +state 726 - 29 unticked_statement: T_DO @9 statement T_WHILE '(' @10 expr ')' . ';' + 47 unticked_statement: T_DO @11 statement T_WHILE '(' @12 expr ')' . ';' - ';' shift, and go to state 646 + ';' shift, and go to state 767 -state 608 +state 727 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 125 while_statement: ':' inner_statement_list . T_ENDWHILE ';' + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 140 while_statement: ':' inner_statement_list . T_ENDWHILE ';' - T_ENDWHILE shift, and go to state 647 + T_ENDWHILE shift, and go to state 768 - $default reduce using rule 9 (@2) + $default reduce using rule 26 (@4) - @2 go to state 288 + @4 go to state 347 -state 609 +state 728 - 33 unticked_statement: T_FOR '(' for_expr ';' @11 for_expr ';' @12 . for_expr ')' @13 for_statement + 51 unticked_statement: T_FOR '(' for_expr ';' @13 for_expr ';' @14 . for_expr ')' @15 for_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -16817,109 +19746,118 @@ state 609 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - $default reduce using rule 196 (for_expr) - - for_expr go to state 648 - non_empty_for_expr go to state 244 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 245 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + $default reduce using rule 210 (for_expr) + + namespace_name go to state 80 + for_expr go to state 769 + non_empty_for_expr go to state 292 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 293 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 610 +state 729 - 102 foreach_optional_arg: T_DOUBLE_ARROW foreach_variable . + 117 foreach_optional_arg: T_DOUBLE_ARROW foreach_variable . - $default reduce using rule 102 (foreach_optional_arg) + $default reduce using rule 117 (foreach_optional_arg) -state 611 +state 730 - 55 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @17 variable foreach_optional_arg ')' . @18 foreach_statement + 72 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @19 variable foreach_optional_arg ')' . @20 foreach_statement - $default reduce using rule 54 (@18) + $default reduce using rule 71 (@20) - @18 go to state 649 + @20 go to state 770 -state 612 +state 731 - 52 unticked_statement: T_FOREACH '(' variable T_AS @15 foreach_variable foreach_optional_arg ')' . @16 foreach_statement + 69 unticked_statement: T_FOREACH '(' variable T_AS @17 foreach_variable foreach_optional_arg ')' . @18 foreach_statement - $default reduce using rule 51 (@16) + $default reduce using rule 68 (@18) - @16 go to state 650 + @18 go to state 771 -state 613 +state 732 - 112 declare_list: declare_list ',' T_STRING '=' static_scalar . + 127 declare_list: declare_list ',' T_STRING '=' static_scalar . - $default reduce using rule 112 (declare_list) + $default reduce using rule 127 (declare_list) -state 614 +state 733 - 110 declare_statement: ':' inner_statement_list T_ENDDECLARE . ';' + 125 declare_statement: ':' inner_statement_list T_ENDDECLARE . ';' - ';' shift, and go to state 651 + ';' shift, and go to state 772 -state 615 +state 734 - 116 switch_case_list: ':' ';' case_list . T_ENDSWITCH ';' - 119 case_list: case_list . T_CASE expr case_separator @31 inner_statement_list - 121 | case_list . T_DEFAULT case_separator @32 inner_statement_list + 131 switch_case_list: ':' ';' case_list . T_ENDSWITCH ';' + 134 case_list: case_list . T_CASE expr case_separator @32 inner_statement_list + 136 | case_list . T_DEFAULT case_separator @33 inner_statement_list - T_ENDSWITCH shift, and go to state 652 - T_CASE shift, and go to state 617 - T_DEFAULT shift, and go to state 618 + T_ENDSWITCH shift, and go to state 773 + T_CASE shift, and go to state 736 + T_DEFAULT shift, and go to state 737 -state 616 +state 735 - 115 switch_case_list: ':' case_list T_ENDSWITCH . ';' + 130 switch_case_list: ':' case_list T_ENDSWITCH . ';' - ';' shift, and go to state 653 + ';' shift, and go to state 774 -state 617 +state 736 - 119 case_list: case_list T_CASE . expr case_separator @31 inner_statement_list + 134 case_list: case_list T_CASE . expr case_separator @32 inner_statement_list T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -16946,275 +19884,325 @@ state 617 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 654 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 775 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 618 +state 737 - 121 case_list: case_list T_DEFAULT . case_separator @32 inner_statement_list + 136 case_list: case_list T_DEFAULT . case_separator @33 inner_statement_list - ':' shift, and go to state 655 - ';' shift, and go to state 656 + ':' shift, and go to state 776 + ';' shift, and go to state 777 - case_separator go to state 657 + case_separator go to state 778 -state 619 +state 738 - 114 switch_case_list: '{' ';' case_list . '}' - 119 case_list: case_list . T_CASE expr case_separator @31 inner_statement_list - 121 | case_list . T_DEFAULT case_separator @32 inner_statement_list + 129 switch_case_list: '{' ';' case_list . '}' + 134 case_list: case_list . T_CASE expr case_separator @32 inner_statement_list + 136 | case_list . T_DEFAULT case_separator @33 inner_statement_list - T_CASE shift, and go to state 617 - T_DEFAULT shift, and go to state 618 - '}' shift, and go to state 658 + T_CASE shift, and go to state 736 + T_DEFAULT shift, and go to state 737 + '}' shift, and go to state 779 -state 620 +state 739 - 113 switch_case_list: '{' case_list '}' . + 128 switch_case_list: '{' case_list '}' . - $default reduce using rule 113 (switch_case_list) + $default reduce using rule 128 (switch_case_list) -state 621 +state 740 - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference T_STRING @28 '(' parameter_list ')' . '{' inner_statement_list '}' + 377 non_empty_static_array_pair_list: static_scalar T_DOUBLE_ARROW static_scalar . - '{' shift, and go to state 659 + $default reduce using rule 377 (non_empty_static_array_pair_list) -state 622 +state 741 + + 375 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' static_scalar . T_DOUBLE_ARROW static_scalar + 376 | non_empty_static_array_pair_list ',' static_scalar . - 142 non_empty_parameter_list: non_empty_parameter_list ',' . optional_class_type T_VARIABLE - 143 | non_empty_parameter_list ',' . optional_class_type '&' T_VARIABLE - 144 | non_empty_parameter_list ',' . optional_class_type '&' T_VARIABLE '=' static_scalar - 145 | non_empty_parameter_list ',' . optional_class_type T_VARIABLE '=' static_scalar + T_DOUBLE_ARROW shift, and go to state 780 - T_STRING shift, and go to state 561 - T_ARRAY shift, and go to state 562 + $default reduce using rule 376 (non_empty_static_array_pair_list) - $default reduce using rule 146 (optional_class_type) - optional_class_type go to state 660 +state 742 + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 . fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches -state 623 + T_STRING shift, and go to state 111 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 - 139 non_empty_parameter_list: optional_class_type '&' . T_VARIABLE - 140 | optional_class_type '&' . T_VARIABLE '=' static_scalar + namespace_name go to state 490 + fully_qualified_class_name go to state 781 - T_VARIABLE shift, and go to state 661 +state 743 -state 624 + 426 assignment_list_element: T_LIST '(' @66 assignment_list ')' . - 138 non_empty_parameter_list: optional_class_type T_VARIABLE . - 141 | optional_class_type T_VARIABLE . '=' static_scalar + $default reduce using rule 426 (assignment_list_element) - '=' shift, and go to state 662 - $default reduce using rule 138 (non_empty_parameter_list) +state 744 + 434 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable . -state 625 + $default reduce using rule 434 (non_empty_array_pair_list) - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 . fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches - T_STRING shift, and go to state 406 +state 745 - fully_qualified_class_name go to state 663 + 101 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @30 implements_list '{' class_statement_list '}' . + $default reduce using rule 101 (unticked_class_declaration_statement) -state 626 - 327 non_empty_static_array_pair_list: static_scalar T_DOUBLE_ARROW static_scalar . +state 746 - $default reduce using rule 327 (non_empty_static_array_pair_list) + 207 class_constant_declaration: T_CONST T_STRING . '=' static_scalar + '=' shift, and go to state 782 -state 627 - 325 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' static_scalar . T_DOUBLE_ARROW static_scalar - 326 | non_empty_static_array_pair_list ',' static_scalar . +state 747 - T_DOUBLE_ARROW shift, and go to state 664 + 184 class_statement: variable_modifiers @36 . class_variable_declaration ';' - $default reduce using rule 326 (non_empty_static_array_pair_list) + T_VARIABLE shift, and go to state 783 + class_variable_declaration go to state 784 -state 628 - 374 assignment_list_element: T_LIST '(' @60 assignment_list ')' . +state 748 - $default reduce using rule 374 (assignment_list_element) + 187 class_statement: method_modifiers function . is_reference T_STRING @37 '(' parameter_list ')' method_body + '&' shift, and go to state 219 -state 629 + $default reduce using rule 96 (is_reference) - 382 non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable . + is_reference go to state 785 - $default reduce using rule 382 (non_empty_array_pair_list) +state 749 -state 630 + 195 non_empty_member_modifiers: non_empty_member_modifiers member_modifier . + + $default reduce using rule 195 (non_empty_member_modifiers) + + +state 750 - 394 encaps_var: T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' . + 206 class_constant_declaration: class_constant_declaration ',' . T_STRING '=' static_scalar - $default reduce using rule 394 (encaps_var) + T_STRING shift, and go to state 786 + + +state 751 + + 185 class_statement: class_constant_declaration ';' . + + $default reduce using rule 185 (class_statement) + + +state 752 + 99 unticked_function_declaration_statement: function is_reference T_STRING @29 '(' parameter_list ')' '{' . inner_statement_list '}' -state 631 + $default reduce using rule 28 (inner_statement_list) - 86 unticked_class_declaration_statement: class_entry_type T_STRING extends_from @29 implements_list '{' class_statement_list '}' . + inner_statement_list go to state 787 - $default reduce using rule 86 (unticked_class_declaration_statement) +state 753 -state 632 + 297 lexical_vars: T_USE '(' . lexical_var_list ')' - 193 class_constant_declaration: T_CONST T_STRING . '=' static_scalar + '&' shift, and go to state 788 + T_VARIABLE shift, and go to state 789 - '=' shift, and go to state 665 + lexical_var_list go to state 790 -state 633 +state 754 - 169 class_statement: variable_modifiers @35 . class_variable_declaration ';' + 294 expr_without_variable: function is_reference '(' @50 parameter_list ')' lexical_vars '{' . inner_statement_list '}' - T_VARIABLE shift, and go to state 666 + $default reduce using rule 28 (inner_statement_list) - class_variable_declaration go to state 667 + inner_statement_list go to state 791 -state 634 +state 755 - 173 class_statement: method_modifiers T_FUNCTION . @36 is_reference T_STRING @37 '(' parameter_list ')' method_body + 158 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type '&' . T_VARIABLE + 159 | non_empty_parameter_list ',' optional_class_type '&' . T_VARIABLE '=' static_scalar - $default reduce using rule 171 (@36) + T_VARIABLE shift, and go to state 792 - @36 go to state 668 +state 756 -state 635 + 157 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type T_VARIABLE . + 160 | non_empty_parameter_list ',' optional_class_type T_VARIABLE . '=' static_scalar - 181 non_empty_member_modifiers: non_empty_member_modifiers member_modifier . + '=' shift, and go to state 793 - $default reduce using rule 181 (non_empty_member_modifiers) + $default reduce using rule 157 (non_empty_parameter_list) -state 636 +state 757 - 192 class_constant_declaration: class_constant_declaration ',' . T_STRING '=' static_scalar + 155 non_empty_parameter_list: optional_class_type '&' T_VARIABLE '=' . static_scalar - T_STRING shift, and go to state 669 + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 794 + static_class_constant go to state 442 -state 637 +state 758 - 170 class_statement: class_constant_declaration ';' . + 156 non_empty_parameter_list: optional_class_type T_VARIABLE '=' static_scalar . - $default reduce using rule 170 (class_statement) + $default reduce using rule 156 (non_empty_parameter_list) -state 638 +state 759 - 343 method_or_not: '(' @58 function_call_parameter_list . ')' + 393 method_or_not: '(' @64 function_call_parameter_list . ')' - ')' shift, and go to state 670 + ')' shift, and go to state 795 -state 639 +state 760 - 341 variable_property: T_OBJECT_OPERATOR . object_property @57 method_or_not + 391 variable_property: T_OBJECT_OPERATOR . object_property @63 method_or_not - T_STRING shift, and go to state 422 + T_STRING shift, and go to state 511 T_VARIABLE shift, and go to state 33 - '{' shift, and go to state 423 - '$' shift, and go to state 71 + '{' shift, and go to state 512 + '$' shift, and go to state 77 - variable_without_objects go to state 424 - reference_variable go to state 297 - compound_variable go to state 97 - object_property go to state 671 - object_dim_list go to state 426 - variable_name go to state 427 - simple_indirect_reference go to state 298 + variable_without_objects go to state 513 + reference_variable go to state 361 + compound_variable go to state 107 + object_property go to state 796 + object_dim_list go to state 515 + variable_name go to state 516 + simple_indirect_reference go to state 362 -state 640 +state 761 - 338 variable_properties: variable_properties variable_property . + 388 variable_properties: variable_properties variable_property . - $default reduce using rule 338 (variable_properties) + $default reduce using rule 388 (variable_properties) -state 641 +state 762 - 294 dynamic_class_name_variable_property: T_OBJECT_OPERATOR object_property . + 333 dynamic_class_name_variable_property: T_OBJECT_OPERATOR object_property . - $default reduce using rule 294 (dynamic_class_name_variable_property) + $default reduce using rule 333 (dynamic_class_name_variable_property) -state 642 +state 763 - 23 unticked_statement: T_IF '(' expr ')' ':' @5 inner_statement_list @6 new_elseif_list . new_else_single T_ENDIF ';' - 131 new_elseif_list: new_elseif_list . T_ELSEIF '(' expr ')' ':' @34 inner_statement_list + 41 unticked_statement: T_IF '(' expr ')' ':' @7 inner_statement_list @8 new_elseif_list . new_else_single T_ENDIF ';' + 146 new_elseif_list: new_elseif_list . T_ELSEIF '(' expr ')' ':' @35 inner_statement_list - T_ELSEIF shift, and go to state 672 - T_ELSE shift, and go to state 673 + T_ELSEIF shift, and go to state 797 + T_ELSE shift, and go to state 798 - $default reduce using rule 134 (new_else_single) + $default reduce using rule 149 (new_else_single) - new_else_single go to state 674 + new_else_single go to state 799 -state 643 +state 764 - 128 elseif_list: elseif_list T_ELSEIF . '(' expr ')' @33 statement + 143 elseif_list: elseif_list T_ELSEIF . '(' expr ')' @34 statement - '(' shift, and go to state 675 + '(' shift, and go to state 800 -state 644 +state 765 - 133 else_single: T_ELSE . statement + 148 else_single: T_ELSE . statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -17256,83 +20244,91 @@ state 644 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - statement go to state 676 - unticked_statement go to state 76 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + statement go to state 801 + unticked_statement go to state 84 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 645 +state 766 - 20 unticked_statement: T_IF '(' expr ')' @3 statement @4 elseif_list else_single . + 38 unticked_statement: T_IF '(' expr ')' @5 statement @6 elseif_list else_single . - $default reduce using rule 20 (unticked_statement) + $default reduce using rule 38 (unticked_statement) -state 646 +state 767 - 29 unticked_statement: T_DO @9 statement T_WHILE '(' @10 expr ')' ';' . + 47 unticked_statement: T_DO @11 statement T_WHILE '(' @12 expr ')' ';' . - $default reduce using rule 29 (unticked_statement) + $default reduce using rule 47 (unticked_statement) -state 647 +state 768 - 125 while_statement: ':' inner_statement_list T_ENDWHILE . ';' + 140 while_statement: ':' inner_statement_list T_ENDWHILE . ';' - ';' shift, and go to state 677 + ';' shift, and go to state 802 -state 648 +state 769 - 33 unticked_statement: T_FOR '(' for_expr ';' @11 for_expr ';' @12 for_expr . ')' @13 for_statement + 51 unticked_statement: T_FOR '(' for_expr ';' @13 for_expr ';' @14 for_expr . ')' @15 for_statement - ')' shift, and go to state 678 + ')' shift, and go to state 803 -state 649 +state 770 - 55 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @17 variable foreach_optional_arg ')' @18 . foreach_statement + 72 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @19 variable foreach_optional_arg ')' @20 . foreach_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -17340,7 +20336,7 @@ state 649 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - ':' shift, and go to state 679 + ':' shift, and go to state 804 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -17375,56 +20371,64 @@ state 649 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - statement go to state 680 - unticked_statement go to state 76 - foreach_statement go to state 681 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 650 - - 52 unticked_statement: T_FOREACH '(' variable T_AS @15 foreach_variable foreach_optional_arg ')' @16 . foreach_statement + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + statement go to state 805 + unticked_statement go to state 84 + foreach_statement go to state 806 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 + + +state 771 + + 69 unticked_statement: T_FOREACH '(' variable T_AS @17 foreach_variable foreach_optional_arg ')' @18 . foreach_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -17432,7 +20436,7 @@ state 650 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - ':' shift, and go to state 679 + ':' shift, and go to state 804 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -17467,349 +20471,413 @@ state 650 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - statement go to state 680 - unticked_statement go to state 76 - foreach_statement go to state 682 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + statement go to state 805 + unticked_statement go to state 84 + foreach_statement go to state 807 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 + + +state 772 + + 125 declare_statement: ':' inner_statement_list T_ENDDECLARE ';' . + + $default reduce using rule 125 (declare_statement) + + +state 773 + + 131 switch_case_list: ':' ';' case_list T_ENDSWITCH . ';' + + ';' shift, and go to state 808 + + +state 774 + + 130 switch_case_list: ':' case_list T_ENDSWITCH ';' . + + $default reduce using rule 130 (switch_case_list) + + +state 775 + + 134 case_list: case_list T_CASE expr . case_separator @32 inner_statement_list + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + ':' shift, and go to state 776 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ';' shift, and go to state 777 + case_separator go to state 809 -state 651 - 110 declare_statement: ':' inner_statement_list T_ENDDECLARE ';' . +state 776 - $default reduce using rule 110 (declare_statement) + 137 case_separator: ':' . + $default reduce using rule 137 (case_separator) -state 652 - 116 switch_case_list: ':' ';' case_list T_ENDSWITCH . ';' +state 777 - ';' shift, and go to state 683 + 138 case_separator: ';' . + $default reduce using rule 138 (case_separator) -state 653 - 115 switch_case_list: ':' case_list T_ENDSWITCH ';' . +state 778 - $default reduce using rule 115 (switch_case_list) + 136 case_list: case_list T_DEFAULT case_separator . @33 inner_statement_list + $default reduce using rule 135 (@33) -state 654 + @33 go to state 810 - 119 case_list: case_list T_CASE expr . case_separator @31 inner_statement_list - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - ':' shift, and go to state 655 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ';' shift, and go to state 656 - - case_separator go to state 684 +state 779 -state 655 + 129 switch_case_list: '{' ';' case_list '}' . - 122 case_separator: ':' . + $default reduce using rule 129 (switch_case_list) - $default reduce using rule 122 (case_separator) +state 780 -state 656 + 375 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW . static_scalar - 123 case_separator: ';' . + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 - $default reduce using rule 123 (case_separator) + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 811 + static_class_constant go to state 442 -state 657 +state 781 - 121 case_list: case_list T_DEFAULT case_separator . @32 inner_statement_list + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name . @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches - $default reduce using rule 120 (@32) + $default reduce using rule 78 (@24) - @32 go to state 685 + @24 go to state 812 -state 658 +state 782 - 114 switch_case_list: '{' ';' case_list '}' . + 207 class_constant_declaration: T_CONST T_STRING '=' . static_scalar - $default reduce using rule 114 (switch_case_list) + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 813 + static_class_constant go to state 442 -state 659 - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference T_STRING @28 '(' parameter_list ')' '{' . inner_statement_list '}' +state 783 - $default reduce using rule 11 (inner_statement_list) + 204 class_variable_declaration: T_VARIABLE . + 205 | T_VARIABLE . '=' static_scalar - inner_statement_list go to state 686 + '=' shift, and go to state 814 + $default reduce using rule 204 (class_variable_declaration) -state 660 - 142 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type . T_VARIABLE - 143 | non_empty_parameter_list ',' optional_class_type . '&' T_VARIABLE - 144 | non_empty_parameter_list ',' optional_class_type . '&' T_VARIABLE '=' static_scalar - 145 | non_empty_parameter_list ',' optional_class_type . T_VARIABLE '=' static_scalar +state 784 - '&' shift, and go to state 687 - T_VARIABLE shift, and go to state 688 + 184 class_statement: variable_modifiers @36 class_variable_declaration . ';' + 202 class_variable_declaration: class_variable_declaration . ',' T_VARIABLE + 203 | class_variable_declaration . ',' T_VARIABLE '=' static_scalar + ',' shift, and go to state 815 + ';' shift, and go to state 816 -state 661 - 139 non_empty_parameter_list: optional_class_type '&' T_VARIABLE . - 140 | optional_class_type '&' T_VARIABLE . '=' static_scalar +state 785 - '=' shift, and go to state 689 + 187 class_statement: method_modifiers function is_reference . T_STRING @37 '(' parameter_list ')' method_body - $default reduce using rule 139 (non_empty_parameter_list) + T_STRING shift, and go to state 817 -state 662 +state 786 - 141 non_empty_parameter_list: optional_class_type T_VARIABLE '=' . static_scalar + 206 class_constant_declaration: class_constant_declaration ',' T_STRING . '=' static_scalar - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + '=' shift, and go to state 818 - common_scalar go to state 375 - static_scalar go to state 690 - static_class_constant go to state 377 +state 787 -state 663 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 99 unticked_function_declaration_statement: function is_reference T_STRING @29 '(' parameter_list ')' '{' inner_statement_list . '}' - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name . @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches + '}' shift, and go to state 819 - $default reduce using rule 61 (@22) + $default reduce using rule 26 (@4) - @22 go to state 691 + @4 go to state 347 -state 664 +state 788 - 325 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW . static_scalar + 301 lexical_var_list: '&' . T_VARIABLE - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + T_VARIABLE shift, and go to state 820 - common_scalar go to state 375 - static_scalar go to state 692 - static_class_constant go to state 377 +state 789 -state 665 + 300 lexical_var_list: T_VARIABLE . - 193 class_constant_declaration: T_CONST T_STRING '=' . static_scalar + $default reduce using rule 300 (lexical_var_list) - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - common_scalar go to state 375 - static_scalar go to state 693 - static_class_constant go to state 377 +state 790 + 297 lexical_vars: T_USE '(' lexical_var_list . ')' + 298 lexical_var_list: lexical_var_list . ',' T_VARIABLE + 299 | lexical_var_list . ',' '&' T_VARIABLE -state 666 + ',' shift, and go to state 821 + ')' shift, and go to state 822 - 190 class_variable_declaration: T_VARIABLE . - 191 | T_VARIABLE . '=' static_scalar - '=' shift, and go to state 694 +state 791 - $default reduce using rule 190 (class_variable_declaration) + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 294 expr_without_variable: function is_reference '(' @50 parameter_list ')' lexical_vars '{' inner_statement_list . '}' + '}' shift, and go to state 823 -state 667 + $default reduce using rule 26 (@4) - 169 class_statement: variable_modifiers @35 class_variable_declaration . ';' - 188 class_variable_declaration: class_variable_declaration . ',' T_VARIABLE - 189 | class_variable_declaration . ',' T_VARIABLE '=' static_scalar + @4 go to state 347 - ',' shift, and go to state 695 - ';' shift, and go to state 696 +state 792 -state 668 + 158 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE . + 159 | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE . '=' static_scalar - 173 class_statement: method_modifiers T_FUNCTION @36 . is_reference T_STRING @37 '(' parameter_list ')' method_body + '=' shift, and go to state 824 - '&' shift, and go to state 252 + $default reduce using rule 158 (non_empty_parameter_list) - $default reduce using rule 80 (is_reference) - is_reference go to state 697 +state 793 + 160 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' . static_scalar -state 669 + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 - 192 class_constant_declaration: class_constant_declaration ',' T_STRING . '=' static_scalar + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 825 + static_class_constant go to state 442 - '=' shift, and go to state 698 +state 794 -state 670 + 155 non_empty_parameter_list: optional_class_type '&' T_VARIABLE '=' static_scalar . - 343 method_or_not: '(' @58 function_call_parameter_list ')' . + $default reduce using rule 155 (non_empty_parameter_list) - $default reduce using rule 343 (method_or_not) +state 795 -state 671 + 393 method_or_not: '(' @64 function_call_parameter_list ')' . - 341 variable_property: T_OBJECT_OPERATOR object_property . @57 method_or_not + $default reduce using rule 393 (method_or_not) - $default reduce using rule 340 (@57) - @57 go to state 699 +state 796 + 391 variable_property: T_OBJECT_OPERATOR object_property . @63 method_or_not -state 672 + $default reduce using rule 390 (@63) - 131 new_elseif_list: new_elseif_list T_ELSEIF . '(' expr ')' ':' @34 inner_statement_list + @63 go to state 826 - '(' shift, and go to state 700 +state 797 -state 673 + 146 new_elseif_list: new_elseif_list T_ELSEIF . '(' expr ')' ':' @35 inner_statement_list - 135 new_else_single: T_ELSE . ':' inner_statement_list + '(' shift, and go to state 827 - ':' shift, and go to state 701 +state 798 -state 674 + 150 new_else_single: T_ELSE . ':' inner_statement_list - 23 unticked_statement: T_IF '(' expr ')' ':' @5 inner_statement_list @6 new_elseif_list new_else_single . T_ENDIF ';' + ':' shift, and go to state 828 - T_ENDIF shift, and go to state 702 +state 799 -state 675 + 41 unticked_statement: T_IF '(' expr ')' ':' @7 inner_statement_list @8 new_elseif_list new_else_single . T_ENDIF ';' + + T_ENDIF shift, and go to state 829 + + +state 800 - 128 elseif_list: elseif_list T_ELSEIF '(' . expr ')' @33 statement + 143 elseif_list: elseif_list T_ELSEIF '(' . expr ')' @34 statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -17836,283 +20904,325 @@ state 675 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 703 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 676 + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 830 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 + + +state 801 + + 148 else_single: T_ELSE statement . + + $default reduce using rule 148 (else_single) + + +state 802 + + 140 while_statement: ':' inner_statement_list T_ENDWHILE ';' . + + $default reduce using rule 140 (while_statement) + + +state 803 + + 51 unticked_statement: T_FOR '(' for_expr ';' @13 for_expr ';' @14 for_expr ')' . @15 for_statement - 133 else_single: T_ELSE statement . - - $default reduce using rule 133 (else_single) - - -state 677 + $default reduce using rule 50 (@15) - 125 while_statement: ':' inner_statement_list T_ENDWHILE ';' . + @15 go to state 831 - $default reduce using rule 125 (while_statement) +state 804 -state 678 + 123 foreach_statement: ':' . inner_statement_list T_ENDFOREACH ';' - 33 unticked_statement: T_FOR '(' for_expr ';' @11 for_expr ';' @12 for_expr ')' . @13 for_statement + $default reduce using rule 28 (inner_statement_list) - $default reduce using rule 32 (@13) + inner_statement_list go to state 832 - @13 go to state 704 +state 805 -state 679 + 122 foreach_statement: statement . - 108 foreach_statement: ':' . inner_statement_list T_ENDFOREACH ';' + $default reduce using rule 122 (foreach_statement) - $default reduce using rule 11 (inner_statement_list) - inner_statement_list go to state 705 +state 806 + 72 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @19 variable foreach_optional_arg ')' @20 foreach_statement . -state 680 + $default reduce using rule 72 (unticked_statement) - 107 foreach_statement: statement . - $default reduce using rule 107 (foreach_statement) +state 807 + 69 unticked_statement: T_FOREACH '(' variable T_AS @17 foreach_variable foreach_optional_arg ')' @18 foreach_statement . -state 681 + $default reduce using rule 69 (unticked_statement) - 55 unticked_statement: T_FOREACH '(' expr_without_variable T_AS @17 variable foreach_optional_arg ')' @18 foreach_statement . - $default reduce using rule 55 (unticked_statement) +state 808 + 131 switch_case_list: ':' ';' case_list T_ENDSWITCH ';' . -state 682 + $default reduce using rule 131 (switch_case_list) - 52 unticked_statement: T_FOREACH '(' variable T_AS @15 foreach_variable foreach_optional_arg ')' @16 foreach_statement . - $default reduce using rule 52 (unticked_statement) +state 809 + 134 case_list: case_list T_CASE expr case_separator . @32 inner_statement_list -state 683 + $default reduce using rule 133 (@32) - 116 switch_case_list: ':' ';' case_list T_ENDSWITCH ';' . + @32 go to state 833 - $default reduce using rule 116 (switch_case_list) +state 810 -state 684 + 136 case_list: case_list T_DEFAULT case_separator @33 . inner_statement_list - 119 case_list: case_list T_CASE expr case_separator . @31 inner_statement_list + $default reduce using rule 28 (inner_statement_list) - $default reduce using rule 118 (@31) + inner_statement_list go to state 834 - @31 go to state 706 +state 811 -state 685 + 375 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar . - 121 case_list: case_list T_DEFAULT case_separator @32 . inner_statement_list + $default reduce using rule 375 (non_empty_static_array_pair_list) - $default reduce using rule 11 (inner_statement_list) - inner_statement_list go to state 707 +state 812 + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 . T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches -state 686 + T_VARIABLE shift, and go to state 835 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference T_STRING @28 '(' parameter_list ')' '{' inner_statement_list . '}' - '}' shift, and go to state 708 +state 813 - $default reduce using rule 9 (@2) + 207 class_constant_declaration: T_CONST T_STRING '=' static_scalar . - @2 go to state 288 + $default reduce using rule 207 (class_constant_declaration) -state 687 +state 814 - 143 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type '&' . T_VARIABLE - 144 | non_empty_parameter_list ',' optional_class_type '&' . T_VARIABLE '=' static_scalar + 205 class_variable_declaration: T_VARIABLE '=' . static_scalar - T_VARIABLE shift, and go to state 709 + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 836 + static_class_constant go to state 442 -state 688 - 142 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type T_VARIABLE . - 145 | non_empty_parameter_list ',' optional_class_type T_VARIABLE . '=' static_scalar +state 815 - '=' shift, and go to state 710 + 202 class_variable_declaration: class_variable_declaration ',' . T_VARIABLE + 203 | class_variable_declaration ',' . T_VARIABLE '=' static_scalar - $default reduce using rule 142 (non_empty_parameter_list) + T_VARIABLE shift, and go to state 837 -state 689 +state 816 - 140 non_empty_parameter_list: optional_class_type '&' T_VARIABLE '=' . static_scalar + 184 class_statement: variable_modifiers @36 class_variable_declaration ';' . - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + $default reduce using rule 184 (class_statement) - common_scalar go to state 375 - static_scalar go to state 711 - static_class_constant go to state 377 +state 817 -state 690 + 187 class_statement: method_modifiers function is_reference T_STRING . @37 '(' parameter_list ')' method_body - 141 non_empty_parameter_list: optional_class_type T_VARIABLE '=' static_scalar . + $default reduce using rule 186 (@37) - $default reduce using rule 141 (non_empty_parameter_list) + @37 go to state 838 -state 691 +state 818 - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 . T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches + 206 class_constant_declaration: class_constant_declaration ',' T_STRING '=' . static_scalar - T_VARIABLE shift, and go to state 712 + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 839 + static_class_constant go to state 442 -state 692 - 325 non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar . +state 819 - $default reduce using rule 325 (non_empty_static_array_pair_list) + 99 unticked_function_declaration_statement: function is_reference T_STRING @29 '(' parameter_list ')' '{' inner_statement_list '}' . + $default reduce using rule 99 (unticked_function_declaration_statement) -state 693 - 193 class_constant_declaration: T_CONST T_STRING '=' static_scalar . +state 820 - $default reduce using rule 193 (class_constant_declaration) + 301 lexical_var_list: '&' T_VARIABLE . + $default reduce using rule 301 (lexical_var_list) -state 694 - 191 class_variable_declaration: T_VARIABLE '=' . static_scalar +state 821 - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + 298 lexical_var_list: lexical_var_list ',' . T_VARIABLE + 299 | lexical_var_list ',' . '&' T_VARIABLE - common_scalar go to state 375 - static_scalar go to state 713 - static_class_constant go to state 377 + '&' shift, and go to state 840 + T_VARIABLE shift, and go to state 841 -state 695 +state 822 - 188 class_variable_declaration: class_variable_declaration ',' . T_VARIABLE - 189 | class_variable_declaration ',' . T_VARIABLE '=' static_scalar + 297 lexical_vars: T_USE '(' lexical_var_list ')' . - T_VARIABLE shift, and go to state 714 + $default reduce using rule 297 (lexical_vars) -state 696 +state 823 - 169 class_statement: variable_modifiers @35 class_variable_declaration ';' . + 294 expr_without_variable: function is_reference '(' @50 parameter_list ')' lexical_vars '{' inner_statement_list '}' . - $default reduce using rule 169 (class_statement) + $default reduce using rule 294 (expr_without_variable) -state 697 +state 824 - 173 class_statement: method_modifiers T_FUNCTION @36 is_reference . T_STRING @37 '(' parameter_list ')' method_body + 159 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' . static_scalar - T_STRING shift, and go to state 715 + '+' shift, and go to state 432 + '-' shift, and go to state 433 + T_LNUMBER shift, and go to state 29 + T_DNUMBER shift, and go to state 30 + T_STRING shift, and go to state 111 + T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 842 + static_class_constant go to state 442 -state 698 - 192 class_constant_declaration: class_constant_declaration ',' T_STRING '=' . static_scalar +state 825 - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + 160 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar . - common_scalar go to state 375 - static_scalar go to state 716 - static_class_constant go to state 377 + $default reduce using rule 160 (non_empty_parameter_list) -state 699 +state 826 - 341 variable_property: T_OBJECT_OPERATOR object_property @57 . method_or_not + 391 variable_property: T_OBJECT_OPERATOR object_property @63 . method_or_not - '(' shift, and go to state 538 + '(' shift, and go to state 654 - $default reduce using rule 344 (method_or_not) + $default reduce using rule 394 (method_or_not) - method_or_not go to state 717 + method_or_not go to state 843 -state 700 +state 827 - 131 new_elseif_list: new_elseif_list T_ELSEIF '(' . expr ')' ':' @34 inner_statement_list + 146 new_elseif_list: new_elseif_list T_ELSEIF '(' . expr ')' ':' @35 inner_statement_list T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -18139,123 +21249,133 @@ state 700 T_EXIT shift, and go to state 27 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 31 + T_STRING shift, and go to state 111 T_STRING_VARNAME shift, and go to state 32 T_VARIABLE shift, and go to state 33 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 718 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - - -state 701 - - 135 new_else_single: T_ELSE ':' . inner_statement_list - - $default reduce using rule 11 (inner_statement_list) - - inner_statement_list go to state 719 - - -state 702 - - 23 unticked_statement: T_IF '(' expr ')' ':' @5 inner_statement_list @6 new_elseif_list new_else_single T_ENDIF . ';' - - ';' shift, and go to state 720 - - -state 703 - - 128 elseif_list: elseif_list T_ELSEIF '(' expr . ')' @33 statement - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ')' shift, and go to state 721 - - -state 704 - - 33 unticked_statement: T_FOR '(' for_expr ';' @11 for_expr ';' @12 for_expr ')' @13 . for_statement + T_FUNCTION shift, and go to state 46 + T_STATIC shift, and go to state 112 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + + namespace_name go to state 80 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 844 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 + + +state 828 + + 150 new_else_single: T_ELSE ':' . inner_statement_list + + $default reduce using rule 28 (inner_statement_list) + + inner_statement_list go to state 845 + + +state 829 + + 41 unticked_statement: T_IF '(' expr ')' ':' @7 inner_statement_list @8 new_elseif_list new_else_single T_ENDIF . ';' + + ';' shift, and go to state 846 + + +state 830 + + 143 elseif_list: elseif_list T_ELSEIF '(' expr . ')' @34 statement + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr + + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ')' shift, and go to state 847 + + +state 831 + + 51 unticked_statement: T_FOR '(' for_expr ';' @13 for_expr ';' @14 for_expr ')' @15 . for_statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -18263,7 +21383,7 @@ state 704 T_INCLUDE_ONCE shift, and go to state 8 T_INCLUDE shift, and go to state 9 T_PRINT shift, and go to state 10 - ':' shift, and go to state 722 + ':' shift, and go to state 848 '+' shift, and go to state 11 '-' shift, and go to state 12 '!' shift, and go to state 13 @@ -18298,388 +21418,368 @@ state 704 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - statement go to state 723 - unticked_statement go to state 76 - for_statement go to state 724 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 + namespace_name go to state 80 + statement go to state 849 + unticked_statement go to state 84 + for_statement go to state 850 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 -state 705 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 108 foreach_statement: ':' inner_statement_list . T_ENDFOREACH ';' +state 832 - T_ENDFOREACH shift, and go to state 725 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 123 foreach_statement: ':' inner_statement_list . T_ENDFOREACH ';' - $default reduce using rule 9 (@2) + T_ENDFOREACH shift, and go to state 851 - @2 go to state 288 + $default reduce using rule 26 (@4) + @4 go to state 347 -state 706 - 119 case_list: case_list T_CASE expr case_separator @31 . inner_statement_list +state 833 - $default reduce using rule 11 (inner_statement_list) + 134 case_list: case_list T_CASE expr case_separator @32 . inner_statement_list - inner_statement_list go to state 726 + $default reduce using rule 28 (inner_statement_list) + inner_statement_list go to state 852 -state 707 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 121 case_list: case_list T_DEFAULT case_separator @32 inner_statement_list . +state 834 - T_ENDSWITCH reduce using rule 121 (case_list) - T_CASE reduce using rule 121 (case_list) - T_DEFAULT reduce using rule 121 (case_list) - '}' reduce using rule 121 (case_list) - $default reduce using rule 9 (@2) + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 136 case_list: case_list T_DEFAULT case_separator @33 inner_statement_list . - @2 go to state 288 + T_ENDSWITCH reduce using rule 136 (case_list) + T_CASE reduce using rule 136 (case_list) + T_DEFAULT reduce using rule 136 (case_list) + '}' reduce using rule 136 (case_list) + $default reduce using rule 26 (@4) + @4 go to state 347 -state 708 - 84 unticked_function_declaration_statement: T_FUNCTION @27 is_reference T_STRING @28 '(' parameter_list ')' '{' inner_statement_list '}' . +state 835 - $default reduce using rule 84 (unticked_function_declaration_statement) + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE . ')' @25 '{' inner_statement_list '}' @26 additional_catches + ')' shift, and go to state 853 -state 709 - 143 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE . - 144 | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE . '=' static_scalar +state 836 - '=' shift, and go to state 727 + 205 class_variable_declaration: T_VARIABLE '=' static_scalar . - $default reduce using rule 143 (non_empty_parameter_list) + $default reduce using rule 205 (class_variable_declaration) -state 710 +state 837 - 145 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' . static_scalar + 202 class_variable_declaration: class_variable_declaration ',' T_VARIABLE . + 203 | class_variable_declaration ',' T_VARIABLE . '=' static_scalar - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + '=' shift, and go to state 854 - common_scalar go to state 375 - static_scalar go to state 728 - static_class_constant go to state 377 + $default reduce using rule 202 (class_variable_declaration) -state 711 +state 838 - 140 non_empty_parameter_list: optional_class_type '&' T_VARIABLE '=' static_scalar . + 187 class_statement: method_modifiers function is_reference T_STRING @37 . '(' parameter_list ')' method_body - $default reduce using rule 140 (non_empty_parameter_list) + '(' shift, and go to state 855 -state 712 +state 839 - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE . ')' @23 '{' inner_statement_list '}' @24 additional_catches + 206 class_constant_declaration: class_constant_declaration ',' T_STRING '=' static_scalar . - ')' shift, and go to state 729 + $default reduce using rule 206 (class_constant_declaration) -state 713 +state 840 - 191 class_variable_declaration: T_VARIABLE '=' static_scalar . + 299 lexical_var_list: lexical_var_list ',' '&' . T_VARIABLE - $default reduce using rule 191 (class_variable_declaration) + T_VARIABLE shift, and go to state 856 -state 714 +state 841 - 188 class_variable_declaration: class_variable_declaration ',' T_VARIABLE . - 189 | class_variable_declaration ',' T_VARIABLE . '=' static_scalar + 298 lexical_var_list: lexical_var_list ',' T_VARIABLE . - '=' shift, and go to state 730 + $default reduce using rule 298 (lexical_var_list) - $default reduce using rule 188 (class_variable_declaration) +state 842 -state 715 + 159 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar . - 173 class_statement: method_modifiers T_FUNCTION @36 is_reference T_STRING . @37 '(' parameter_list ')' method_body + $default reduce using rule 159 (non_empty_parameter_list) - $default reduce using rule 172 (@37) - @37 go to state 731 +state 843 + 391 variable_property: T_OBJECT_OPERATOR object_property @63 method_or_not . -state 716 + $default reduce using rule 391 (variable_property) - 192 class_constant_declaration: class_constant_declaration ',' T_STRING '=' static_scalar . - $default reduce using rule 192 (class_constant_declaration) +state 844 + 146 new_elseif_list: new_elseif_list T_ELSEIF '(' expr . ')' ':' @35 inner_statement_list + 240 expr_without_variable: expr . T_BOOLEAN_OR @42 expr + 242 | expr . T_BOOLEAN_AND @43 expr + 244 | expr . T_LOGICAL_OR @44 expr + 246 | expr . T_LOGICAL_AND @45 expr + 247 | expr . T_LOGICAL_XOR expr + 248 | expr . '|' expr + 249 | expr . '&' expr + 250 | expr . '^' expr + 251 | expr . '.' expr + 252 | expr . '+' expr + 253 | expr . '-' expr + 254 | expr . '*' expr + 255 | expr . '/' expr + 256 | expr . '%' expr + 257 | expr . T_SL expr + 258 | expr . T_SR expr + 263 | expr . T_IS_IDENTICAL expr + 264 | expr . T_IS_NOT_IDENTICAL expr + 265 | expr . T_IS_EQUAL expr + 266 | expr . T_IS_NOT_EQUAL expr + 267 | expr . '<' expr + 268 | expr . T_IS_SMALLER_OR_EQUAL expr + 269 | expr . '>' expr + 270 | expr . T_IS_GREATER_OR_EQUAL expr + 271 | expr . T_INSTANCEOF class_name_reference + 275 | expr . '?' @46 expr ':' @47 expr + 277 | expr . '?' ':' @48 expr -state 717 + T_LOGICAL_OR shift, and go to state 222 + T_LOGICAL_XOR shift, and go to state 223 + T_LOGICAL_AND shift, and go to state 224 + '?' shift, and go to state 225 + T_BOOLEAN_OR shift, and go to state 226 + T_BOOLEAN_AND shift, and go to state 227 + '|' shift, and go to state 228 + '^' shift, and go to state 229 + '&' shift, and go to state 230 + T_IS_NOT_IDENTICAL shift, and go to state 231 + T_IS_IDENTICAL shift, and go to state 232 + T_IS_NOT_EQUAL shift, and go to state 233 + T_IS_EQUAL shift, and go to state 234 + '<' shift, and go to state 235 + '>' shift, and go to state 236 + T_IS_GREATER_OR_EQUAL shift, and go to state 237 + T_IS_SMALLER_OR_EQUAL shift, and go to state 238 + T_SR shift, and go to state 239 + T_SL shift, and go to state 240 + '+' shift, and go to state 241 + '-' shift, and go to state 242 + '.' shift, and go to state 243 + '*' shift, and go to state 244 + '/' shift, and go to state 245 + '%' shift, and go to state 246 + T_INSTANCEOF shift, and go to state 247 + ')' shift, and go to state 857 - 341 variable_property: T_OBJECT_OPERATOR object_property @57 method_or_not . - $default reduce using rule 341 (variable_property) +state 845 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 150 new_else_single: T_ELSE ':' inner_statement_list . -state 718 + T_ENDIF reduce using rule 150 (new_else_single) + $default reduce using rule 26 (@4) - 131 new_elseif_list: new_elseif_list T_ELSEIF '(' expr . ')' ':' @34 inner_statement_list - 226 expr_without_variable: expr . T_BOOLEAN_OR @42 expr - 228 | expr . T_BOOLEAN_AND @43 expr - 230 | expr . T_LOGICAL_OR @44 expr - 232 | expr . T_LOGICAL_AND @45 expr - 233 | expr . T_LOGICAL_XOR expr - 234 | expr . '|' expr - 235 | expr . '&' expr - 236 | expr . '^' expr - 237 | expr . '.' expr - 238 | expr . '+' expr - 239 | expr . '-' expr - 240 | expr . '*' expr - 241 | expr . '/' expr - 242 | expr . '%' expr - 243 | expr . T_SL expr - 244 | expr . T_SR expr - 249 | expr . T_IS_IDENTICAL expr - 250 | expr . T_IS_NOT_IDENTICAL expr - 251 | expr . T_IS_EQUAL expr - 252 | expr . T_IS_NOT_EQUAL expr - 253 | expr . '<' expr - 254 | expr . T_IS_SMALLER_OR_EQUAL expr - 255 | expr . '>' expr - 256 | expr . T_IS_GREATER_OR_EQUAL expr - 257 | expr . T_INSTANCEOF class_name_reference - 261 | expr . '?' @46 expr ':' @47 expr - - T_LOGICAL_OR shift, and go to state 181 - T_LOGICAL_XOR shift, and go to state 182 - T_LOGICAL_AND shift, and go to state 183 - '?' shift, and go to state 184 - T_BOOLEAN_OR shift, and go to state 185 - T_BOOLEAN_AND shift, and go to state 186 - '|' shift, and go to state 187 - '^' shift, and go to state 188 - '&' shift, and go to state 189 - T_IS_NOT_IDENTICAL shift, and go to state 190 - T_IS_IDENTICAL shift, and go to state 191 - T_IS_NOT_EQUAL shift, and go to state 192 - T_IS_EQUAL shift, and go to state 193 - '<' shift, and go to state 194 - '>' shift, and go to state 195 - T_IS_GREATER_OR_EQUAL shift, and go to state 196 - T_IS_SMALLER_OR_EQUAL shift, and go to state 197 - T_SR shift, and go to state 198 - T_SL shift, and go to state 199 - '+' shift, and go to state 200 - '-' shift, and go to state 201 - '.' shift, and go to state 202 - '*' shift, and go to state 203 - '/' shift, and go to state 204 - '%' shift, and go to state 205 - T_INSTANCEOF shift, and go to state 206 - ')' shift, and go to state 732 + @4 go to state 347 -state 719 +state 846 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 135 new_else_single: T_ELSE ':' inner_statement_list . + 41 unticked_statement: T_IF '(' expr ')' ':' @7 inner_statement_list @8 new_elseif_list new_else_single T_ENDIF ';' . - T_ENDIF reduce using rule 135 (new_else_single) - $default reduce using rule 9 (@2) + $default reduce using rule 41 (unticked_statement) - @2 go to state 288 +state 847 -state 720 + 143 elseif_list: elseif_list T_ELSEIF '(' expr ')' . @34 statement - 23 unticked_statement: T_IF '(' expr ')' ':' @5 inner_statement_list @6 new_elseif_list new_else_single T_ENDIF ';' . + $default reduce using rule 142 (@34) - $default reduce using rule 23 (unticked_statement) + @34 go to state 858 -state 721 +state 848 - 128 elseif_list: elseif_list T_ELSEIF '(' expr ')' . @33 statement + 121 for_statement: ':' . inner_statement_list T_ENDFOR ';' - $default reduce using rule 127 (@33) + $default reduce using rule 28 (inner_statement_list) - @33 go to state 733 + inner_statement_list go to state 859 -state 722 +state 849 - 106 for_statement: ':' . inner_statement_list T_ENDFOR ';' + 120 for_statement: statement . - $default reduce using rule 11 (inner_statement_list) + $default reduce using rule 120 (for_statement) - inner_statement_list go to state 734 +state 850 -state 723 + 51 unticked_statement: T_FOR '(' for_expr ';' @13 for_expr ';' @14 for_expr ')' @15 for_statement . - 105 for_statement: statement . + $default reduce using rule 51 (unticked_statement) - $default reduce using rule 105 (for_statement) +state 851 -state 724 + 123 foreach_statement: ':' inner_statement_list T_ENDFOREACH . ';' - 33 unticked_statement: T_FOR '(' for_expr ';' @11 for_expr ';' @12 for_expr ')' @13 for_statement . + ';' shift, and go to state 860 - $default reduce using rule 33 (unticked_statement) +state 852 -state 725 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 134 case_list: case_list T_CASE expr case_separator @32 inner_statement_list . - 108 foreach_statement: ':' inner_statement_list T_ENDFOREACH . ';' + T_ENDSWITCH reduce using rule 134 (case_list) + T_CASE reduce using rule 134 (case_list) + T_DEFAULT reduce using rule 134 (case_list) + '}' reduce using rule 134 (case_list) + $default reduce using rule 26 (@4) - ';' shift, and go to state 735 + @4 go to state 347 -state 726 +state 853 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 119 case_list: case_list T_CASE expr case_separator @31 inner_statement_list . + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' . @25 '{' inner_statement_list '}' @26 additional_catches - T_ENDSWITCH reduce using rule 119 (case_list) - T_CASE reduce using rule 119 (case_list) - T_DEFAULT reduce using rule 119 (case_list) - '}' reduce using rule 119 (case_list) - $default reduce using rule 9 (@2) + $default reduce using rule 79 (@25) - @2 go to state 288 + @25 go to state 861 -state 727 +state 854 - 144 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' . static_scalar + 203 class_variable_declaration: class_variable_declaration ',' T_VARIABLE '=' . static_scalar - '+' shift, and go to state 371 - '-' shift, and go to state 372 + '+' shift, and go to state 432 + '-' shift, and go to state 433 T_LNUMBER shift, and go to state 29 T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 + T_STRING shift, and go to state 111 T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - - common_scalar go to state 375 - static_scalar go to state 736 - static_class_constant go to state 377 - + T_STATIC shift, and go to state 112 + T_ARRAY shift, and go to state 434 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 435 + T_NAMESPACE shift, and go to state 436 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 437 -state 728 - - 145 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar . - - $default reduce using rule 145 (non_empty_parameter_list) - - -state 729 - - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' . @23 '{' inner_statement_list '}' @24 additional_catches - - $default reduce using rule 62 (@23) + namespace_name go to state 438 + class_name go to state 439 + common_scalar go to state 440 + static_scalar go to state 862 + static_class_constant go to state 442 - @23 go to state 737 +state 855 -state 730 + 187 class_statement: method_modifiers function is_reference T_STRING @37 '(' . parameter_list ')' method_body - 189 class_variable_declaration: class_variable_declaration ',' T_VARIABLE '=' . static_scalar + T_STRING shift, and go to state 111 + T_ARRAY shift, and go to state 576 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 - '+' shift, and go to state 371 - '-' shift, and go to state 372 - T_LNUMBER shift, and go to state 29 - T_DNUMBER shift, and go to state 30 - T_STRING shift, and go to state 373 - T_CONSTANT_ENCAPSED_STRING shift, and go to state 35 - T_ARRAY shift, and go to state 374 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 + ')' reduce using rule 152 (parameter_list) + $default reduce using rule 161 (optional_class_type) - common_scalar go to state 375 - static_scalar go to state 738 - static_class_constant go to state 377 + namespace_name go to state 490 + parameter_list go to state 863 + non_empty_parameter_list go to state 578 + optional_class_type go to state 579 + fully_qualified_class_name go to state 580 -state 731 +state 856 - 173 class_statement: method_modifiers T_FUNCTION @36 is_reference T_STRING @37 . '(' parameter_list ')' method_body + 299 lexical_var_list: lexical_var_list ',' '&' T_VARIABLE . - '(' shift, and go to state 739 + $default reduce using rule 299 (lexical_var_list) -state 732 +state 857 - 131 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' . ':' @34 inner_statement_list + 146 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' . ':' @35 inner_statement_list - ':' shift, and go to state 740 + ':' shift, and go to state 864 -state 733 +state 858 - 128 elseif_list: elseif_list T_ELSEIF '(' expr ')' @33 . statement + 143 elseif_list: elseif_list T_ELSEIF '(' expr ')' @34 . statement T_REQUIRE_ONCE shift, and go to state 5 T_REQUIRE shift, and go to state 6 @@ -18721,372 +21821,361 @@ state 733 T_SWITCH shift, and go to state 42 T_BREAK shift, and go to state 43 T_CONTINUE shift, and go to state 44 - T_RETURN shift, and go to state 46 - T_TRY shift, and go to state 47 - T_THROW shift, and go to state 48 - T_USE shift, and go to state 49 - T_GLOBAL shift, and go to state 50 - T_STATIC shift, and go to state 53 - T_UNSET shift, and go to state 54 - T_ISSET shift, and go to state 55 - T_EMPTY shift, and go to state 56 - T_LIST shift, and go to state 60 - T_ARRAY shift, and go to state 61 - T_CLASS_C shift, and go to state 62 - T_METHOD_C shift, and go to state 63 - T_FUNC_C shift, and go to state 64 - T_LINE shift, and go to state 65 - T_FILE shift, and go to state 66 - T_START_HEREDOC shift, and go to state 67 - '(' shift, and go to state 68 - ';' shift, and go to state 69 - '{' shift, and go to state 70 - '$' shift, and go to state 71 - '`' shift, and go to state 72 - '"' shift, and go to state 73 - - statement go to state 741 - unticked_statement go to state 76 - expr_without_variable go to state 83 - function_call go to state 84 - fully_qualified_class_name go to state 85 - common_scalar go to state 86 - scalar go to state 87 - expr go to state 88 - r_variable go to state 89 - rw_variable go to state 90 - variable go to state 91 - variable_without_objects go to state 92 - static_member go to state 93 - base_variable_with_function_calls go to state 94 - base_variable go to state 95 - reference_variable go to state 96 - compound_variable go to state 97 - simple_indirect_reference go to state 98 - internal_functions_in_yacc go to state 99 - class_constant go to state 100 - + T_GOTO shift, and go to state 45 + T_FUNCTION shift, and go to state 46 + T_RETURN shift, and go to state 48 + T_TRY shift, and go to state 49 + T_THROW shift, and go to state 50 + T_GLOBAL shift, and go to state 52 + T_STATIC shift, and go to state 55 + T_UNSET shift, and go to state 56 + T_ISSET shift, and go to state 57 + T_EMPTY shift, and go to state 58 + T_LIST shift, and go to state 62 + T_ARRAY shift, and go to state 63 + T_CLASS_C shift, and go to state 64 + T_METHOD_C shift, and go to state 65 + T_FUNC_C shift, and go to state 66 + T_LINE shift, and go to state 67 + T_FILE shift, and go to state 68 + T_START_HEREDOC shift, and go to state 69 + T_NAMESPACE shift, and go to state 113 + T_NS_C shift, and go to state 71 + T_DIR shift, and go to state 72 + T_NS_SEPARATOR shift, and go to state 73 + '(' shift, and go to state 74 + ';' shift, and go to state 75 + '{' shift, and go to state 76 + '$' shift, and go to state 77 + '`' shift, and go to state 78 + '"' shift, and go to state 79 -state 734 - - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 106 for_statement: ':' inner_statement_list . T_ENDFOR ';' - - T_ENDFOR shift, and go to state 742 - - $default reduce using rule 9 (@2) - - @2 go to state 288 - - -state 735 + namespace_name go to state 80 + statement go to state 865 + unticked_statement go to state 84 + expr_without_variable go to state 91 + function go to state 114 + function_call go to state 93 + class_name go to state 94 + common_scalar go to state 95 + scalar go to state 96 + expr go to state 97 + r_variable go to state 98 + rw_variable go to state 99 + variable go to state 100 + variable_without_objects go to state 101 + static_member go to state 102 + variable_class_name go to state 103 + base_variable_with_function_calls go to state 104 + base_variable go to state 105 + reference_variable go to state 106 + compound_variable go to state 107 + simple_indirect_reference go to state 108 + internal_functions_in_yacc go to state 109 + class_constant go to state 110 - 108 foreach_statement: ':' inner_statement_list T_ENDFOREACH ';' . - $default reduce using rule 108 (foreach_statement) +state 859 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 121 for_statement: ':' inner_statement_list . T_ENDFOR ';' -state 736 - - 144 non_empty_parameter_list: non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar . + T_ENDFOR shift, and go to state 866 - $default reduce using rule 144 (non_empty_parameter_list) + $default reduce using rule 26 (@4) + @4 go to state 347 -state 737 - - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 . '{' inner_statement_list '}' @24 additional_catches - '{' shift, and go to state 743 +state 860 + 123 foreach_statement: ':' inner_statement_list T_ENDFOREACH ';' . -state 738 + $default reduce using rule 123 (foreach_statement) - 189 class_variable_declaration: class_variable_declaration ',' T_VARIABLE '=' static_scalar . - $default reduce using rule 189 (class_variable_declaration) +state 861 + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 . '{' inner_statement_list '}' @26 additional_catches -state 739 + '{' shift, and go to state 867 - 173 class_statement: method_modifiers T_FUNCTION @36 is_reference T_STRING @37 '(' . parameter_list ')' method_body - T_STRING shift, and go to state 561 - T_ARRAY shift, and go to state 562 +state 862 - ')' reduce using rule 137 (parameter_list) - $default reduce using rule 146 (optional_class_type) + 203 class_variable_declaration: class_variable_declaration ',' T_VARIABLE '=' static_scalar . - parameter_list go to state 744 - non_empty_parameter_list go to state 564 - optional_class_type go to state 565 + $default reduce using rule 203 (class_variable_declaration) -state 740 +state 863 - 131 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' ':' . @34 inner_statement_list + 187 class_statement: method_modifiers function is_reference T_STRING @37 '(' parameter_list . ')' method_body - $default reduce using rule 130 (@34) + ')' shift, and go to state 868 - @34 go to state 745 +state 864 -state 741 + 146 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' ':' . @35 inner_statement_list - 128 elseif_list: elseif_list T_ELSEIF '(' expr ')' @33 statement . + $default reduce using rule 145 (@35) - $default reduce using rule 128 (elseif_list) + @35 go to state 869 -state 742 +state 865 - 106 for_statement: ':' inner_statement_list T_ENDFOR . ';' + 143 elseif_list: elseif_list T_ELSEIF '(' expr ')' @34 statement . - ';' shift, and go to state 746 + $default reduce using rule 143 (elseif_list) -state 743 +state 866 - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' . inner_statement_list '}' @24 additional_catches + 121 for_statement: ':' inner_statement_list T_ENDFOR . ';' - $default reduce using rule 11 (inner_statement_list) + ';' shift, and go to state 870 - inner_statement_list go to state 747 +state 867 -state 744 + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' . inner_statement_list '}' @26 additional_catches - 173 class_statement: method_modifiers T_FUNCTION @36 is_reference T_STRING @37 '(' parameter_list . ')' method_body + $default reduce using rule 28 (inner_statement_list) - ')' shift, and go to state 748 + inner_statement_list go to state 871 -state 745 +state 868 - 131 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' ':' @34 . inner_statement_list + 187 class_statement: method_modifiers function is_reference T_STRING @37 '(' parameter_list ')' . method_body - $default reduce using rule 11 (inner_statement_list) + ';' shift, and go to state 872 + '{' shift, and go to state 873 - inner_statement_list go to state 749 + method_body go to state 874 -state 746 +state 869 - 106 for_statement: ':' inner_statement_list T_ENDFOR ';' . + 146 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' ':' @35 . inner_statement_list - $default reduce using rule 106 (for_statement) + $default reduce using rule 28 (inner_statement_list) + inner_statement_list go to state 875 -state 747 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list . '}' @24 additional_catches +state 870 - '}' shift, and go to state 750 + 121 for_statement: ':' inner_statement_list T_ENDFOR ';' . - $default reduce using rule 9 (@2) + $default reduce using rule 121 (for_statement) - @2 go to state 288 +state 871 -state 748 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list . '}' @26 additional_catches - 173 class_statement: method_modifiers T_FUNCTION @36 is_reference T_STRING @37 '(' parameter_list ')' . method_body + '}' shift, and go to state 876 - ';' shift, and go to state 751 - '{' shift, and go to state 752 + $default reduce using rule 26 (@4) - method_body go to state 753 + @4 go to state 347 -state 749 +state 872 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 131 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' ':' @34 inner_statement_list . + 188 method_body: ';' . - T_ELSEIF reduce using rule 131 (new_elseif_list) - T_ELSE reduce using rule 131 (new_elseif_list) - T_ENDIF reduce using rule 131 (new_elseif_list) - $default reduce using rule 9 (@2) + $default reduce using rule 188 (method_body) - @2 go to state 288 +state 873 -state 750 + 189 method_body: '{' . inner_statement_list '}' - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' . @24 additional_catches + $default reduce using rule 28 (inner_statement_list) - $default reduce using rule 63 (@24) + inner_statement_list go to state 877 - @24 go to state 754 +state 874 -state 751 + 187 class_statement: method_modifiers function is_reference T_STRING @37 '(' parameter_list ')' method_body . - 174 method_body: ';' . + $default reduce using rule 187 (class_statement) - $default reduce using rule 174 (method_body) +state 875 -state 752 + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 146 new_elseif_list: new_elseif_list T_ELSEIF '(' expr ')' ':' @35 inner_statement_list . - 175 method_body: '{' . inner_statement_list '}' + T_ELSEIF reduce using rule 146 (new_elseif_list) + T_ELSE reduce using rule 146 (new_elseif_list) + T_ENDIF reduce using rule 146 (new_elseif_list) + $default reduce using rule 26 (@4) - $default reduce using rule 11 (inner_statement_list) + @4 go to state 347 - inner_statement_list go to state 755 +state 876 -state 753 + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' . @26 additional_catches - 173 class_statement: method_modifiers T_FUNCTION @36 is_reference T_STRING @37 '(' parameter_list ')' method_body . + $default reduce using rule 80 (@26) - $default reduce using rule 173 (class_statement) + @26 go to state 878 -state 754 +state 877 - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 . additional_catches + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 189 method_body: '{' inner_statement_list . '}' - T_CATCH shift, and go to state 756 + '}' shift, and go to state 879 - $default reduce using rule 67 (additional_catches) + $default reduce using rule 26 (@4) - additional_catches go to state 757 - non_empty_additional_catches go to state 758 - additional_catch go to state 759 + @4 go to state 347 -state 755 +state 878 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 175 method_body: '{' inner_statement_list . '}' + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 . additional_catches - '}' shift, and go to state 760 + T_CATCH shift, and go to state 880 - $default reduce using rule 9 (@2) + $default reduce using rule 85 (additional_catches) - @2 go to state 288 + additional_catches go to state 881 + non_empty_additional_catches go to state 882 + additional_catch go to state 883 -state 756 +state 879 - 72 additional_catch: T_CATCH . '(' fully_qualified_class_name @25 T_VARIABLE ')' @26 '{' inner_statement_list '}' + 189 method_body: '{' inner_statement_list '}' . - '(' shift, and go to state 761 + $default reduce using rule 189 (method_body) -state 757 +state 880 - 64 unticked_statement: T_TRY @20 '{' inner_statement_list '}' T_CATCH '(' @21 fully_qualified_class_name @22 T_VARIABLE ')' @23 '{' inner_statement_list '}' @24 additional_catches . + 90 additional_catch: T_CATCH . '(' fully_qualified_class_name @27 T_VARIABLE ')' @28 '{' inner_statement_list '}' - $default reduce using rule 64 (unticked_statement) + '(' shift, and go to state 884 -state 758 +state 881 - 66 additional_catches: non_empty_additional_catches . - 69 non_empty_additional_catches: non_empty_additional_catches . additional_catch + 81 unticked_statement: T_TRY @22 '{' inner_statement_list '}' T_CATCH '(' @23 fully_qualified_class_name @24 T_VARIABLE ')' @25 '{' inner_statement_list '}' @26 additional_catches . - T_CATCH shift, and go to state 756 + $default reduce using rule 81 (unticked_statement) - $default reduce using rule 66 (additional_catches) - additional_catch go to state 762 +state 882 + 84 additional_catches: non_empty_additional_catches . + 87 non_empty_additional_catches: non_empty_additional_catches . additional_catch -state 759 + T_CATCH shift, and go to state 880 - 68 non_empty_additional_catches: additional_catch . + $default reduce using rule 84 (additional_catches) - $default reduce using rule 68 (non_empty_additional_catches) + additional_catch go to state 885 -state 760 +state 883 - 175 method_body: '{' inner_statement_list '}' . + 86 non_empty_additional_catches: additional_catch . - $default reduce using rule 175 (method_body) + $default reduce using rule 86 (non_empty_additional_catches) -state 761 +state 884 - 72 additional_catch: T_CATCH '(' . fully_qualified_class_name @25 T_VARIABLE ')' @26 '{' inner_statement_list '}' + 90 additional_catch: T_CATCH '(' . fully_qualified_class_name @27 T_VARIABLE ')' @28 '{' inner_statement_list '}' - T_STRING shift, and go to state 406 + T_STRING shift, and go to state 111 + T_NAMESPACE shift, and go to state 488 + T_NS_SEPARATOR shift, and go to state 489 - fully_qualified_class_name go to state 763 + namespace_name go to state 490 + fully_qualified_class_name go to state 886 -state 762 +state 885 - 69 non_empty_additional_catches: non_empty_additional_catches additional_catch . + 87 non_empty_additional_catches: non_empty_additional_catches additional_catch . - $default reduce using rule 69 (non_empty_additional_catches) + $default reduce using rule 87 (non_empty_additional_catches) -state 763 +state 886 - 72 additional_catch: T_CATCH '(' fully_qualified_class_name . @25 T_VARIABLE ')' @26 '{' inner_statement_list '}' + 90 additional_catch: T_CATCH '(' fully_qualified_class_name . @27 T_VARIABLE ')' @28 '{' inner_statement_list '}' - $default reduce using rule 70 (@25) + $default reduce using rule 88 (@27) - @25 go to state 764 + @27 go to state 887 -state 764 +state 887 - 72 additional_catch: T_CATCH '(' fully_qualified_class_name @25 . T_VARIABLE ')' @26 '{' inner_statement_list '}' + 90 additional_catch: T_CATCH '(' fully_qualified_class_name @27 . T_VARIABLE ')' @28 '{' inner_statement_list '}' - T_VARIABLE shift, and go to state 765 + T_VARIABLE shift, and go to state 888 -state 765 +state 888 - 72 additional_catch: T_CATCH '(' fully_qualified_class_name @25 T_VARIABLE . ')' @26 '{' inner_statement_list '}' + 90 additional_catch: T_CATCH '(' fully_qualified_class_name @27 T_VARIABLE . ')' @28 '{' inner_statement_list '}' - ')' shift, and go to state 766 + ')' shift, and go to state 889 -state 766 +state 889 - 72 additional_catch: T_CATCH '(' fully_qualified_class_name @25 T_VARIABLE ')' . @26 '{' inner_statement_list '}' + 90 additional_catch: T_CATCH '(' fully_qualified_class_name @27 T_VARIABLE ')' . @28 '{' inner_statement_list '}' - $default reduce using rule 71 (@26) + $default reduce using rule 89 (@28) - @26 go to state 767 + @28 go to state 890 -state 767 +state 890 - 72 additional_catch: T_CATCH '(' fully_qualified_class_name @25 T_VARIABLE ')' @26 . '{' inner_statement_list '}' + 90 additional_catch: T_CATCH '(' fully_qualified_class_name @27 T_VARIABLE ')' @28 . '{' inner_statement_list '}' - '{' shift, and go to state 768 + '{' shift, and go to state 891 -state 768 +state 891 - 72 additional_catch: T_CATCH '(' fully_qualified_class_name @25 T_VARIABLE ')' @26 '{' . inner_statement_list '}' + 90 additional_catch: T_CATCH '(' fully_qualified_class_name @27 T_VARIABLE ')' @28 '{' . inner_statement_list '}' - $default reduce using rule 11 (inner_statement_list) + $default reduce using rule 28 (inner_statement_list) - inner_statement_list go to state 769 + inner_statement_list go to state 892 -state 769 +state 892 - 10 inner_statement_list: inner_statement_list . @2 inner_statement - 72 additional_catch: T_CATCH '(' fully_qualified_class_name @25 T_VARIABLE ')' @26 '{' inner_statement_list . '}' + 27 inner_statement_list: inner_statement_list . @4 inner_statement + 90 additional_catch: T_CATCH '(' fully_qualified_class_name @27 T_VARIABLE ')' @28 '{' inner_statement_list . '}' - '}' shift, and go to state 770 + '}' shift, and go to state 893 - $default reduce using rule 9 (@2) + $default reduce using rule 26 (@4) - @2 go to state 288 + @4 go to state 347 -state 770 +state 893 - 72 additional_catch: T_CATCH '(' fully_qualified_class_name @25 T_VARIABLE ')' @26 '{' inner_statement_list '}' . + 90 additional_catch: T_CATCH '(' fully_qualified_class_name @27 T_VARIABLE ')' @28 '{' inner_statement_list '}' . - $default reduce using rule 72 (additional_catch) + $default reduce using rule 90 (additional_catch) diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index f2c6d90c6..619264feb 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -3,7 +3,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -18,12 +18,12 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_parser.y,v 1.160.2.4.2.11 2008/07/24 11:47:12 dmitry Exp $ */ +/* $Id: zend_language_parser.y,v 1.160.2.4.2.8.2.34 2009/01/26 22:54:20 cseiler Exp $ */ /* * LALR shift/reduce conflicts and how they are resolved: * - * - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift. + * - 2 shift/reduce conflicts due to the dangling elseif/else ambiguity. Solved by shift. * */ @@ -105,6 +105,7 @@ %token T_DEFAULT %token T_BREAK %token T_CONTINUE +%token T_GOTO %token T_FUNCTION %token T_CONST %token T_RETURN @@ -143,11 +144,15 @@ %token T_DOLLAR_OPEN_CURLY_BRACES %token T_CURLY_OPEN %token T_PAAMAYIM_NEKUDOTAYIM +%token T_NAMESPACE +%token T_NS_C +%token T_DIR +%token T_NS_SEPARATOR %% /* Rules */ start: - top_statement_list + top_statement_list { zend_do_end_compilation(TSRMLS_C); } ; top_statement_list: @@ -155,14 +160,41 @@ top_statement_list: | /* empty */ ; +namespace_name: + T_STRING { $$ = $1; } + | namespace_name T_NS_SEPARATOR T_STRING { zend_do_build_namespace_name(&$$, &$1, &$3 TSRMLS_CC); } +; top_statement: - statement - | function_declaration_statement { zend_do_early_binding(TSRMLS_C); } - | class_declaration_statement { zend_do_early_binding(TSRMLS_C); } - | T_HALT_COMPILER '(' ')' ';' { zend_do_halt_compiler_register(TSRMLS_C); YYACCEPT; } + statement { zend_verify_namespace(TSRMLS_C); } + | function_declaration_statement { zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); } + | class_declaration_statement { zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); } + | T_HALT_COMPILER '(' ')' ';' { zend_do_halt_compiler_register(TSRMLS_C); YYACCEPT; } + | T_NAMESPACE namespace_name ';' { zend_do_begin_namespace(&$2, 0 TSRMLS_CC); } + | T_NAMESPACE namespace_name '{' { zend_do_begin_namespace(&$2, 1 TSRMLS_CC); } + top_statement_list '}' { zend_do_end_namespace(TSRMLS_C); } + | T_NAMESPACE '{' { zend_do_begin_namespace(NULL, 1 TSRMLS_CC); } + top_statement_list '}' { zend_do_end_namespace(TSRMLS_C); } + | T_USE use_declarations ';' { zend_verify_namespace(TSRMLS_C); } + | constant_declaration ';' { zend_verify_namespace(TSRMLS_C); } ; +use_declarations: + use_declarations ',' use_declaration + | use_declaration +; + +use_declaration: + namespace_name { zend_do_use(&$1, NULL, 0 TSRMLS_CC); } + | namespace_name T_AS T_STRING { zend_do_use(&$1, &$3, 0 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL, 1 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4, 1 TSRMLS_CC); } +; + +constant_declaration: + constant_declaration ',' T_STRING '=' static_scalar { zend_do_declare_constant(&$3, &$5 TSRMLS_CC); } + | T_CONST T_STRING '=' static_scalar { zend_do_declare_constant(&$2, &$4 TSRMLS_CC); } +; inner_statement_list: inner_statement_list { zend_do_extended_info(TSRMLS_C); } inner_statement { HANDLE_INTERACTIVE(); } @@ -180,6 +212,7 @@ inner_statement: statement: unticked_statement { zend_do_ticks(TSRMLS_C); } + | T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); } ; unticked_statement: @@ -210,7 +243,6 @@ unticked_statement: | T_ECHO echo_expr_list ';' | T_INLINE_HTML { zend_do_echo(&$1 TSRMLS_CC); } | expr ';' { zend_do_free(&$1 TSRMLS_CC); } - | T_USE use_filename ';' { zend_error(E_COMPILE_ERROR,"use: Not yet supported. Please use include_once() or require_once()"); zval_dtor(&$2.u.constant); } | T_UNSET '(' unset_variables ')' ';' | T_FOREACH '(' variable T_AS { zend_do_foreach_begin(&$1, &$2, &$3, &$4, 1 TSRMLS_CC); } @@ -225,10 +257,11 @@ unticked_statement: | T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}' T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); } fully_qualified_class_name { zend_do_first_catch(&$7 TSRMLS_CC); } - T_VARIABLE ')' { zend_do_begin_catch(&$1, &$9, &$11, 1 TSRMLS_CC); } + T_VARIABLE ')' { zend_do_begin_catch(&$1, &$9, &$11, &$7 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } additional_catches { zend_do_mark_last_catch(&$7, &$18 TSRMLS_CC); } | T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); } + | T_GOTO T_STRING ';' { zend_do_goto(&$2 TSRMLS_CC); } ; @@ -244,7 +277,7 @@ non_empty_additional_catches: additional_catch: - T_CATCH '(' fully_qualified_class_name { $$.u.opline_num = get_next_op_number(CG(active_op_array)); } T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$5, 0 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } + T_CATCH '(' fully_qualified_class_name { $$.u.opline_num = get_next_op_number(CG(active_op_array)); } T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$5, NULL TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } ; @@ -254,15 +287,9 @@ unset_variables: ; unset_variable: - variable { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1 TSRMLS_CC); } -; - -use_filename: - T_CONSTANT_ENCAPSED_STRING { $$ = $1; } - | '(' T_CONSTANT_ENCAPSED_STRING ')' { $$ = $2; } + variable { zend_do_end_variable_parse(&$1, BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1 TSRMLS_CC); } ; - function_declaration_statement: unticked_function_declaration_statement { zend_do_ticks(TSRMLS_C); } ; @@ -279,7 +306,7 @@ is_reference: unticked_function_declaration_statement: - T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $3.op_type, NULL TSRMLS_CC); } + function is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$3, 0, $2.op_type, NULL TSRMLS_CC); } '(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); } ; @@ -307,7 +334,7 @@ class_entry_type: extends_from: /* empty */ { $$.op_type = IS_UNUSED; } - | T_EXTENDS fully_qualified_class_name { $$ = $2; } + | T_EXTENDS fully_qualified_class_name { zend_do_fetch_class(&$$, &$2 TSRMLS_CC); } ; interface_entry: @@ -435,9 +462,9 @@ non_empty_parameter_list: optional_class_type: - /* empty */ { $$.op_type = IS_UNUSED; } - | T_STRING { $$ = $1; } - | T_ARRAY { $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_NULL;} + /* empty */ { $$.op_type = IS_UNUSED; } + | fully_qualified_class_name { $$ = $1; } + | T_ARRAY { $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_NULL;} ; @@ -487,8 +514,8 @@ class_statement_list: class_statement: variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';' | class_constant_declaration ';' - | method_modifiers T_FUNCTION { $2.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$5, 1, $4.op_type, &$1 TSRMLS_CC); } '(' - parameter_list ')' method_body { zend_do_abstract_method(&$5, &$1, &$10 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } + | method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); } '(' + parameter_list ')' method_body { zend_do_abstract_method(&$4, &$1, &$9 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } ; @@ -552,21 +579,21 @@ non_empty_for_expr: expr_without_variable: T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); } | variable '=' expr { zend_check_writable_variable(&$1); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); } - | variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); } - | variable '=' '&' T_NEW class_name_reference { zend_error(E_STRICT, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $3.u.EA.type = ZEND_PARSED_NEW; zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); } + | variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$4, BP_VAR_W, 1 TSRMLS_CC); zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); } + | variable '=' '&' T_NEW class_name_reference { zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); $3.u.EA.type = ZEND_PARSED_NEW; zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); } | T_NEW class_name_reference { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} | T_CLONE expr { zend_do_clone(&$$, &$2 TSRMLS_CC); } - | variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_MINUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_MUL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_DIV_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_CONCAT_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_MOD_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_AND_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_OR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_XOR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_SL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_SR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_MINUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_MUL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_DIV_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_CONCAT_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_MOD_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_AND_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_OR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_XOR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_SL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_SR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); } | rw_variable T_INC { zend_do_post_incdec(&$$, &$1, ZEND_POST_INC TSRMLS_CC); } | T_INC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_INC TSRMLS_CC); } | rw_variable T_DEC { zend_do_post_incdec(&$$, &$1, ZEND_POST_DEC TSRMLS_CC); } @@ -587,8 +614,8 @@ expr_without_variable: | expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); } | expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); } | expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); } - | '+' expr %prec T_INC { Z_LVAL($1.u.constant)=0; Z_TYPE($1.u.constant)=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } - | '-' expr %prec T_INC { Z_LVAL($1.u.constant)=0; Z_TYPE($1.u.constant)=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } + | '+' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } } + | '-' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } } | '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); } | '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); } | expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); } @@ -604,6 +631,8 @@ expr_without_variable: | expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); } expr ':' { zend_do_qm_true(&$4, &$2, &$5 TSRMLS_CC); } expr { zend_do_qm_false(&$$, &$7, &$2, &$5 TSRMLS_CC); } + | expr '?' ':' { zend_do_jmp_set(&$1, &$2, &$3 TSRMLS_CC); } + expr { zend_do_jmp_set_else(&$$, &$5, &$2, &$3 TSRMLS_CC); } | internal_functions_in_yacc { $$ = $1; } | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); } | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); } @@ -616,32 +645,73 @@ expr_without_variable: | '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; } | scalar { $$ = $1; } | T_ARRAY '(' array_pair_list ')' { $$ = $3; } - | '`' encaps_list '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } + | '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } + | function is_reference '(' { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type TSRMLS_CC); } + parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } +; + +function: + T_FUNCTION { $$.u.opline_num = CG(zend_lineno); } +; + +lexical_vars: + /* empty */ + | T_USE '(' lexical_var_list ')' +; + +lexical_var_list: + lexical_var_list ',' T_VARIABLE { zend_do_fetch_lexical_variable(&$3, 0 TSRMLS_CC); } + | lexical_var_list ',' '&' T_VARIABLE { zend_do_fetch_lexical_variable(&$4, 1 TSRMLS_CC); } + | T_VARIABLE { zend_do_fetch_lexical_variable(&$1, 0 TSRMLS_CC); } + | '&' T_VARIABLE { zend_do_fetch_lexical_variable(&$2, 1 TSRMLS_CC); } ; function_call: - T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); } + namespace_name '(' { $2.u.opline_num = zend_do_begin_function_call(&$1, 1 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } - | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + | T_NAMESPACE T_NS_SEPARATOR namespace_name '(' { $1.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$1.u.constant); zend_do_build_namespace_name(&$1, &$1, &$3 TSRMLS_CC); $4.u.opline_num = zend_do_begin_function_call(&$1, 0 TSRMLS_CC); } + function_call_parameter_list + ')' { zend_do_end_function_call(&$1, &$$, &$6, 0, $4.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } + | T_NS_SEPARATOR namespace_name '(' { $3.u.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); } + function_call_parameter_list + ')' { zend_do_end_function_call(&$2, &$$, &$5, 0, $3.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } + | class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { $4.u.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + function_call_parameter_list + ')' { zend_do_end_function_call($4.u.opline_num?NULL:&$3, &$$, &$6, $4.u.opline_num, $4.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + function_call_parameter_list + ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); } + | variable_without_objects '(' { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1, 0 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} ; +class_name: + T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1, 1);} + | namespace_name { $$ = $1; } + | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; } +; + fully_qualified_class_name: - T_STRING { zend_do_fetch_class(&$$, &$1 TSRMLS_CC); } + namespace_name { $$ = $1; } + | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; } ; + + class_name_reference: - T_STRING { zend_do_fetch_class(&$$, &$1 TSRMLS_CC); } - | dynamic_class_name_reference { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_fetch_class(&$$, &$1 TSRMLS_CC); } + class_name { zend_do_fetch_class(&$$, &$1 TSRMLS_CC); } + | dynamic_class_name_reference { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_fetch_class(&$$, &$1 TSRMLS_CC); } ; @@ -669,6 +739,12 @@ exit_expr: | '(' expr ')' { $$ = $2; } ; +backticks_expr: + /* empty */ { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; } + | T_ENCAPSED_AND_WHITESPACE { $$ = $1; } + | encaps_list { $$ = $1; } +; + ctor_arguments: /* empty */ { Z_LVAL($$.u.constant)=0; } @@ -682,29 +758,37 @@ common_scalar: | T_CONSTANT_ENCAPSED_STRING { $$ = $1; } | T_LINE { $$ = $1; } | T_FILE { $$ = $1; } + | T_DIR { $$ = $1; } | T_CLASS_C { $$ = $1; } | T_METHOD_C { $$ = $1; } | T_FUNC_C { $$ = $1; } + | T_NS_C { $$ = $1; } + | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; } + | T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; } ; static_scalar: /* compile-time evaluated scalars */ common_scalar { $$ = $1; } - | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT TSRMLS_CC); } - | '+' static_scalar { $$ = $2; } - | '-' static_scalar { zval minus_one; Z_TYPE(minus_one) = IS_LONG; Z_LVAL(minus_one) = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; } + | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1 TSRMLS_CC); } + | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_CT, 0 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); } + | '+' static_scalar { ZVAL_LONG(&$1.u.constant, 0); add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } + | '-' static_scalar { ZVAL_LONG(&$1.u.constant, 0); sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } | static_class_constant { $$ = $1; } ; static_class_constant: - T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT TSRMLS_CC); } + class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT, 0 TSRMLS_CC); } ; scalar: - T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT TSRMLS_CC); } - | T_STRING_VARNAME { $$ = $1; } - | class_constant { $$ = $1; } + T_STRING_VARNAME { $$ = $1; } + | class_constant { $$ = $1; } + | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); } + | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } | common_scalar { $$ = $1; } | '"' encaps_list '"' { $$ = $2; } | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; } @@ -735,18 +819,18 @@ expr: r_variable: - variable { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; } + variable { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); $$ = $1; } ; w_variable: - variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $$ = $1; - zend_check_writable_variable(&$1); } + variable { zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); $$ = $1; + zend_check_writable_variable(&$1); } ; rw_variable: - variable { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); $$ = $1; - zend_check_writable_variable(&$1); } + variable { zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); $$ = $1; + zend_check_writable_variable(&$1); } ; variable: @@ -780,9 +864,14 @@ variable_without_objects: ; static_member: - fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); } + class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); } + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); } + ; +variable_class_name: + reference_variable { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); $$=$1;; } +; base_variable_with_function_calls: base_variable { $$ = $1; } @@ -816,7 +905,7 @@ dim_offset: object_property: object_dim_list { $$ = $1; } - | variable_without_objects { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); } { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);} + | variable_without_objects { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); } { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);} ; object_dim_list: @@ -865,10 +954,10 @@ non_empty_array_pair_list: ; encaps_list: - encaps_list encaps_var { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$1, &$2 TSRMLS_CC); } + encaps_list encaps_var { zend_do_end_variable_parse(&$2, BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$1, &$2 TSRMLS_CC); } | encaps_list T_ENCAPSED_AND_WHITESPACE { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); } - | /* empty */ { zend_do_init_string(&$$ TSRMLS_CC); } - + | encaps_var { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, NULL, &$1 TSRMLS_CC); } + | T_ENCAPSED_AND_WHITESPACE encaps_var { zend_do_add_string(&$$, NULL, &$1 TSRMLS_CC); zend_do_end_variable_parse(&$2, BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$$, &$2 TSRMLS_CC); } ; @@ -906,7 +995,8 @@ isset_variables: ; class_constant: - fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT TSRMLS_CC); } + class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); } + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); } ; %% diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 2e935da55..56fc21be6 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,3022 +1,9 @@ -#define yy_create_buffer zend_create_buffer -#define yy_delete_buffer zend_delete_buffer -#define yy_scan_buffer zend_scan_buffer -#define yy_scan_string zend_scan_string -#define yy_scan_bytes zend_scan_bytes -#define yy_flex_debug zend_flex_debug -#define yy_init_buffer zend_init_buffer -#define yy_flush_buffer zend_flush_buffer -#define yy_load_buffer_state zend_load_buffer_state -#define yy_switch_to_buffer zend_switch_to_buffer -#define yyin zendin -#define yyleng zendleng -#define yylex zendlex -#define yyout zendout -#define yyrestart zendrestart -#define yytext zendtext - -/* A Lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /repository/ZendEngine2/Attic/flex.skl,v 1.31 2003/08/11 05:24:41 fujimoto Exp $ - * vim:ft=lex: - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#if HAVE_UNISTD_H -#include -#endif - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -#undef YY_USE_PROTOS -#define YY_USE_PROTOS - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( SCNG(yy_in) TSRMLS_CC ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; - - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr TSRMLS_CC ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - struct _zend_file_handle *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -#define yy_current_buffer SCNG(current_buffer) -#define yy_hold_char SCNG(_yy_hold_char) - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ - -#if 0 -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -#endif - -/* Points to current character in buffer. */ -#define yy_c_buf_p SCNG(c_buf_p) -#define yy_init SCNG(init) -#define yy_start SCNG(start) - -#ifdef ZTS -#define TSRMLS_D void ***tsrm_ls -#define TSRMLS_DC , TSRMLS_D -#define TSRMLS_C tsrm_ls -#define TSRMLS_CC , TSRMLS_C -#else -#define TSRMLS_D -#define TSRMLS_DC -#define TSRMLS_C -#define TSRMLS_CC -#endif - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -/* static int yy_did_buffer_switch_on_eof; */ -#define yy_did_buffer_switch_on_eof SCNG(_yy_did_buffer_switch_on_eof) - -void yyrestart YY_PROTO(( struct _zend_file_handle *input_file TSRMLS_DC )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer TSRMLS_DC )); -void yy_load_buffer_state YY_PROTO(( TSRMLS_D )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( struct _zend_file_handle *file, int size TSRMLS_DC )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer TSRMLS_CC ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size TSRMLS_DC )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str TSRMLS_DC )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len TSRMLS_DC )); - - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - - -#define yywrap() 1 -#define YY_SKIP_YYWRAP -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext -#undef yyleng -#define yyleng SCNG(yy_leng) -#undef yytext -#define yytext SCNG(yy_text) -#undef yytext_ptr -#define yytext_ptr SCNG(yy_text) -#undef yyin -#define yyin SCNG(yy_in) -#undef yyout -#define yyout SCNG(yy_out) -#undef yy_last_accepting_state -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#undef yy_last_accepting_cpos -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#undef yy_more_flag -#define yy_more_flag SCNG(_yy_more_flag) -#undef yy_more_len -#define yy_more_len SCNG(_yy_more_len) - - -static yy_state_type yy_get_previous_state YY_PROTO(( TSRMLS_D )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state TSRMLS_DC )); -static int yy_get_next_buffer YY_PROTO(( TSRMLS_D )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -#undef TSRMLS_D -#undef TSRMLS_DC -#undef TSRMLS_C -#undef TSRMLS_CC - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yytext_ptr -= yy_more_len; \ - yyleng = (int) (yy_cp - yytext_ptr); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#undef yyleng -#undef yytext -#undef yytext_ptr -#undef yyin -#undef yyout -#undef yy_last_accepting_state -#undef yy_last_accepting_cpos -#undef yy_more_flag -#undef yy_more_len - - -#define YY_NUM_RULES 159 -#define YY_END_OF_BUFFER 160 -static yyconst short int yy_accept[1493] = - { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 154, 154, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 160, 114, 114, 158, - 126, 98, 142, 127, 98, 98, 98, 158, 98, 98, - 98, 98, 98, 98, 98, 104, 104, 98, 98, 98, - 98, 98, 98, 125, 144, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 99, 98, 101, 150, 156, - 159, 159, 159, 152, 159, 159, 157, 159, 154, 154, - 154, 159, 159, 154, 159, 145, 145, 148, 39, 39, - - 38, 103, 102, 124, 123, 123, 106, 106, 122, 134, - 137, 137, 129, 129, 129, 128, 128, 128, 114, 0, - 114, 117, 115, 114, 126, 77, 0, 140, 0, 0, - 0, 119, 85, 139, 92, 88, 0, 141, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, - 72, 80, 73, 81, 36, 108, 84, 133, 127, 83, - 108, 104, 0, 0, 40, 0, 96, 78, 77, 76, - 69, 79, 97, 138, 90, 125, 125, 125, 125, 125, - 23, 142, 0, 0, 125, 125, 125, 125, 125, 125, - 15, 125, 125, 125, 125, 125, 125, 125, 125, 125, - - 125, 9, 125, 125, 125, 125, 125, 93, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 89, 91, 150, 0, 0, 0, 150, 151, 151, 0, - 119, 100, 149, 151, 152, 0, 0, 0, 152, 153, - 0, 153, 153, 154, 154, 154, 0, 0, 154, 0, - 154, 0, 0, 154, 0, 154, 154, 155, 0, 0, - 154, 154, 0, 154, 0, 155, 146, 0, 0, 37, - 38, 102, 107, 0, 106, 134, 136, 135, 129, 129, - 130, 131, 114, 0, 116, 0, 0, 75, 0, 0, - 119, 139, 139, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 108, 0, 108, 105, 0, 0, - 86, 74, 87, 138, 138, 125, 125, 125, 125, 125, - 125, 94, 125, 0, 125, 125, 125, 125, 125, 125, - 125, 125, 2, 125, 125, 125, 125, 125, 125, 125, - 125, 16, 125, 125, 125, 125, 125, 125, 125, 125, - 41, 125, 125, 125, 125, 125, 125, 125, 125, 6, - 125, 57, 43, 125, 95, 151, 0, 119, 121, 151, - 153, 153, 154, 155, 0, 154, 147, 0, 154, 154, - 0, 0, 155, 155, 155, 0, 155, 155, 107, 114, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 132, 0, 0, 0, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 26, 125, 125, 125, - 125, 125, 125, 125, 30, 12, 125, 125, 125, 125, - 125, 125, 52, 1, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 70, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 0, 155, 154, 155, - 0, 154, 155, 155, 155, 155, 114, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, - 0, 0, 0, 143, 143, 0, 125, 125, 125, 125, - 125, 125, 125, 71, 28, 7, 32, 42, 4, 125, - - 125, 125, 125, 60, 125, 125, 11, 125, 125, 125, - 64, 125, 125, 125, 125, 125, 125, 125, 59, 31, - 125, 125, 125, 125, 125, 125, 125, 8, 68, 13, - 120, 155, 155, 114, 0, 118, 118, 0, 0, 0, - 0, 50, 0, 0, 0, 0, 0, 45, 0, 0, - 0, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 10, 125, 17, 125, 125, 125, 125, 125, 58, - 125, 125, 125, 125, 125, 125, 67, 125, 5, 62, - 24, 114, 0, 0, 0, 48, 0, 0, 0, 0, - 0, 0, 51, 0, 125, 125, 125, 125, 125, 125, - - 125, 125, 20, 27, 125, 125, 125, 125, 34, 18, - 125, 125, 53, 125, 125, 65, 125, 55, 114, 0, - 0, 0, 47, 0, 0, 0, 49, 0, 46, 0, - 125, 113, 125, 125, 112, 125, 63, 29, 125, 125, - 125, 14, 3, 125, 125, 125, 125, 125, 125, 114, - 0, 0, 0, 109, 125, 125, 125, 125, 125, 25, - 125, 125, 125, 33, 66, 125, 114, 0, 0, 125, - 125, 111, 21, 19, 35, 125, 22, 125, 114, 0, - 0, 125, 125, 125, 125, 114, 0, 0, 110, 125, - 54, 56, 114, 0, 0, 125, 114, 0, 0, 125, - - 114, 0, 0, 61, 114, 0, 0, 114, 0, 0, - 0, 114, 0, 0, 0, 0, 0, 114, 0, 0, - 0, 0, 114, 0, 0, 0, 0, 114, 0, 0, - 0, 0, 115, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 114, 0, 114, 0, 114, 0, 114, 0, 114, - 0, 0 - - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 22, 23, 24, - 25, 26, 27, 16, 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, - 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, 16, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59 - } ; - -static yyconst int yy_meta[63] = - { 0, - 1, 2, 3, 3, 1, 4, 1, 1, 1, 1, - 1, 1, 1, 5, 1, 1, 6, 1, 1, 7, - 7, 1, 8, 9, 1, 1, 1, 6, 1, 1, - 1, 10, 11, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, - 1, 1 - } ; - -static yyconst short int yy_base[1922] = - { 0, - 8941, 8940, 0, 0, 57, 58, 59, 60, 120, 0, - 182, 0, 0, 0, 244, 0, 306, 0, 368, 0, - 8949, 8948, 8947, 8946, 68, 70, 8959, 8934, 422, 8966, - 78, 8932, 426, 8966, 0, 44, 65, 72, 485, 8966, - 8931, 83, 59, 79, 88, 415, 419, 8933, 86, 89, - 416, 8928, 8928, 8920, 8966, 409, 439, 414, 416, 434, - 423, 8906, 0, 436, 8908, 8911, 8897, 52, 8909, 390, - 425, 400, 8912, 8904, 8896, 8966, 442, 8966, 465, 8966, - 539, 8937, 596, 470, 656, 8909, 8966, 595, 718, 780, - 8938, 842, 897, 957, 1012, 8966, 481, 8966, 8966, 8914, - - 0, 8966, 0, 8966, 8966, 0, 448, 472, 8966, 0, - 8920, 8919, 505, 8966, 8934, 8910, 8966, 8909, 8910, 486, - 8909, 8907, 472, 8895, 498, 8905, 1015, 8966, 600, 0, - 1016, 0, 8966, 503, 8966, 8966, 80, 8966, 0, 0, - 8878, 469, 8880, 8882, 8879, 8890, 8886, 8870, 8875, 8966, - 8966, 8966, 8966, 8966, 8966, 589, 8966, 8907, 8966, 8966, - 592, 596, 616, 886, 8966, 8868, 491, 8966, 8966, 8894, - 8966, 8966, 8893, 525, 8966, 0, 599, 8865, 8879, 8864, - 0, 1019, 594, 8890, 8875, 482, 464, 8865, 487, 8873, - 0, 8869, 8857, 8859, 8870, 8872, 565, 8858, 8853, 8856, - - 8854, 0, 8852, 590, 8848, 8847, 8842, 0, 573, 8862, - 569, 8862, 8853, 8843, 8835, 8840, 8853, 8839, 8847, 8837, - 8966, 8966, 1018, 1022, 8881, 1023, 1024, 8966, 1027, 1053, - 622, 8966, 8966, 1057, 1106, 1026, 8853, 1107, 1108, 1028, - 1137, 8966, 1110, 0, 0, 8882, 1035, 0, 0, 1190, - 0, 1116, 1243, 1303, 1192, 0, 0, 1118, 1363, 1124, - 0, 1193, 0, 0, 1194, 1195, 8966, 905, 643, 8966, - 0, 0, 628, 1121, 631, 0, 8966, 8966, 1201, 8966, - 8966, 8966, 8860, 1190, 8966, 8842, 8831, 8966, 1200, 1392, - 0, 8966, 8878, 8829, 8832, 8830, 8823, 8828, 8822, 8831, - - 8839, 8821, 8819, 908, 1029, 633, 893, 1210, 8834, 8867, - 8966, 8966, 8966, 8966, 8865, 8822, 578, 8832, 8823, 8826, - 8810, 0, 8828, 8837, 8826, 8821, 8822, 8805, 8809, 863, - 8810, 8820, 0, 8805, 8814, 8798, 1092, 8805, 8796, 8810, - 8813, 8808, 8809, 8809, 8798, 8797, 8788, 8802, 8801, 8785, - 0, 872, 8784, 8791, 8781, 8780, 8780, 8779, 8783, 0, - 8792, 0, 0, 8784, 0, 1052, 8802, 1045, 8966, 1203, - 1117, 1204, 0, 1212, 1450, 0, 8966, 1232, 0, 1491, - 914, 1365, 1205, 1367, 1452, 0, 1210, 1543, 1437, 8803, - 1543, 8777, 8783, 8790, 8789, 8777, 8786, 8786, 1551, 8781, - - 8773, 8775, 8778, 1066, 8764, 8812, 1148, 8779, 8767, 8764, - 8765, 8762, 8755, 8756, 8748, 8761, 0, 8763, 8751, 8764, - 8748, 8758, 8765, 8744, 0, 8755, 8738, 8757, 8746, 8754, - 8736, 8750, 0, 0, 8743, 8744, 8754, 8734, 8752, 8747, - 8730, 8749, 8731, 8728, 0, 8727, 8745, 8740, 8735, 8734, - 8724, 8732, 8737, 8716, 8718, 8732, 0, 1551, 0, 1553, - 1601, 0, 1565, 1550, 1573, 1554, 8745, 1566, 1159, 8719, - 8709, 8715, 1558, 8720, 8711, 1064, 8966, 8723, 8726, 1069, - 8714, 8707, 8717, 8966, 8755, 1161, 8705, 8718, 8719, 8701, - 8715, 8711, 8717, 0, 0, 0, 0, 0, 0, 8703, - - 8698, 8703, 8708, 0, 8710, 8694, 0, 8702, 8701, 8705, - 0, 8705, 8698, 8694, 8692, 8700, 8689, 8696, 0, 0, - 8681, 8697, 8696, 8680, 8683, 8693, 8687, 0, 0, 0, - 8966, 1583, 1603, 8703, 1653, 8966, 8723, 8672, 1136, 8666, - 1254, 8966, 8689, 8684, 8683, 8667, 1255, 8966, 8679, 1256, - 8669, 8665, 8684, 8662, 8682, 8681, 8664, 8675, 8656, 8671, - 8655, 0, 8662, 8668, 8652, 8659, 8651, 8661, 8653, 0, - 8662, 8661, 8662, 8663, 8658, 8642, 0, 8656, 0, 0, - 0, 8669, 1655, 1374, 1260, 8966, 1370, 8645, 8640, 1372, - 1377, 1378, 8966, 8637, 8657, 8656, 8645, 8650, 8653, 8647, - - 8630, 8644, 0, 0, 8647, 8646, 8643, 8640, 0, 0, - 8630, 8629, 8643, 8636, 8637, 0, 8634, 8639, 8646, 1657, - 1475, 1379, 8966, 1380, 1457, 1467, 8966, 1511, 8966, 1595, - 8637, 0, 8620, 8619, 0, 8634, 0, 0, 8614, 8628, - 8622, 0, 0, 3868, 3872, 3870, 3879, 3879, 3841, 3854, - 1659, 3843, 1667, 0, 3829, 3829, 3842, 3835, 3831, 0, - 3805, 3799, 3796, 0, 0, 3777, 3799, 1663, 3772, 3776, - 3758, 0, 0, 0, 0, 3768, 0, 3727, 3733, 1664, - 3716, 3721, 3710, 3711, 3708, 3721, 1665, 3690, 0, 3696, - 0, 0, 3698, 1676, 3683, 3678, 3663, 1686, 3553, 3541, - - 3567, 1695, 3552, 0, 3565, 1697, 1695, 3563, 1699, 1727, - 1730, 3562, 1716, 1742, 3536, 3534, 3541, 3557, 1730, 3539, - 3538, 3528, 3552, 1746, 3526, 3524, 1757, 3548, 1747, 3565, - 3559, 1760, 8966, 3544, 1757, 3540, 1763, 3538, 1768, 3534, - 1769, 3530, 1776, 3528, 1780, 3523, 1792, 3519, 1799, 3502, - 1803, 3501, 1809, 3484, 1813, 3480, 1815, 3478, 1822, 3475, - 1826, 3473, 1832, 3457, 1836, 3456, 1845, 3452, 1849, 3438, - 1853, 3434, 1855, 3433, 1859, 3429, 1866, 3411, 1872, 3406, - 1876, 3390, 1882, 3388, 1886, 3385, 1893, 3383, 1895, 3367, - 1899, 3362, 1903, 3344, 1905, 3343, 1912, 3339, 1916, 3338, - - 1922, 3335, 1926, 3321, 1932, 3317, 1939, 3316, 1943, 3300, - 1945, 3298, 1949, 3293, 1953, 3289, 1962, 3272, 1966, 3271, - 1972, 3254, 1976, 3250, 1983, 3248, 1985, 3245, 1989, 3243, - 1993, 3227, 1995, 3226, 1999, 3222, 2006, 3208, 2012, 3204, - 2016, 3203, 2022, 3199, 2029, 3181, 2033, 3176, 2035, 3160, - 2039, 3158, 2043, 3155, 2045, 3153, 2052, 3137, 2056, 3132, - 2062, 3114, 2066, 3113, 2075, 3109, 2079, 3108, 2083, 3105, - 2085, 3091, 2089, 3087, 2096, 3086, 2102, 3070, 2106, 3068, - 2112, 3063, 2116, 3059, 2123, 3042, 2125, 3041, 2129, 3024, - 2133, 3020, 2135, 3018, 2142, 3015, 2146, 3013, 2152, 2997, - - 2156, 2996, 2162, 2992, 2169, 2978, 2173, 2974, 2175, 2973, - 2179, 2969, 2183, 2951, 2192, 2946, 2196, 2930, 2202, 2928, - 2206, 2925, 2213, 2923, 2215, 2907, 2219, 2902, 2223, 2884, - 2225, 2883, 2229, 2879, 2236, 2878, 2242, 2875, 2246, 2861, - 2252, 2857, 2259, 2856, 2263, 2840, 2265, 2838, 2269, 2833, - 2273, 2829, 2275, 2812, 2282, 2811, 2286, 2794, 2292, 2790, - 2296, 2788, 2305, 2785, 2309, 2783, 2313, 2767, 2315, 2766, - 2319, 2762, 2326, 2748, 2332, 2744, 2336, 2743, 2342, 2739, - 2346, 2721, 2353, 2716, 2355, 2700, 2359, 2698, 2363, 2695, - 2365, 2693, 2372, 2677, 2376, 2672, 2382, 2654, 2386, 2653, - - 2392, 2649, 2399, 2648, 2403, 2645, 2405, 2631, 2409, 2627, - 2413, 2626, 2422, 54, 2426, 92, 2432, 414, 2436, 427, - 2443, 472, 2445, 494, 2449, 587, 2453, 617, 2455, 906, - 2459, 1013, 2466, 1016, 2472, 1018, 2476, 1022, 2482, 1030, - 2489, 1050, 2493, 1056, 2495, 1099, 2499, 1106, 2503, 1109, - 2505, 1130, 2512, 1183, 2516, 1201, 2522, 1202, 2526, 1214, - 2535, 1219, 2539, 1235, 2543, 1242, 2545, 1247, 2549, 1250, - 2556, 1252, 2562, 1360, 2566, 1362, 2572, 1363, 2576, 1364, - 2583, 1365, 2585, 1437, 2589, 1438, 2593, 1439, 2595, 1440, - 2602, 1441, 2606, 1442, 2612, 1443, 2616, 1444, 2622, 1459, - - 2629, 1491, 2633, 1492, 2635, 1493, 2639, 1494, 2643, 1495, - 2652, 1497, 2656, 1498, 2662, 1539, 2666, 1541, 2673, 1542, - 2675, 1550, 2679, 1554, 2683, 1560, 2685, 1561, 2689, 1564, - 2696, 1568, 2702, 1576, 2706, 1577, 2712, 1584, 2719, 1585, - 2723, 1589, 2725, 1591, 2729, 1592, 2733, 1593, 2735, 1595, - 2742, 1596, 2746, 1598, 2752, 1599, 2756, 1600, 2765, 1602, - 2769, 1603, 2773, 1604, 2775, 1605, 2779, 1606, 2786, 1607, - 2792, 1610, 2796, 1641, 2802, 1643, 2806, 1651, 2813, 1652, - 2815, 1654, 2819, 1670, 2823, 1672, 2825, 1677, 2832, 1678, - 2836, 1688, 2842, 1690, 2846, 1694, 2852, 1703, 2859, 1711, - - 2863, 1713, 2865, 1718, 2869, 1726, 2873, 1734, 2882, 1741, - 2886, 1743, 2892, 1745, 2896, 1751, 2903, 1752, 2905, 1756, - 2909, 1764, 2913, 1770, 2915, 1773, 2919, 1778, 2926, 1781, - 2932, 1782, 2936, 1786, 2942, 1787, 2949, 1789, 2953, 1790, - 2955, 1793, 2959, 1801, 2963, 1805, 2965, 1810, 2972, 1814, - 2976, 1819, 2982, 1823, 2986, 1824, 2995, 1828, 2999, 1833, - 3003, 1842, 3005, 1846, 3009, 1847, 3016, 1863, 3022, 1865, - 3026, 1868, 3032, 1870, 3036, 1874, 3043, 1891, 3045, 1892, - 3049, 1909, 3053, 1913, 3055, 1918, 3062, 1920, 3066, 1936, - 3072, 1937, 3076, 1941, 3082, 1955, 3089, 1958, 3093, 1959, - - 3095, 1963, 3099, 1964, 3103, 1982, 3112, 1987, 3116, 2003, - 3122, 2005, 3126, 2008, 3133, 2010, 3135, 2026, 3139, 2031, - 3143, 2049, 3145, 2053, 3149, 2054, 3156, 2058, 3162, 2072, - 3166, 2076, 3172, 2077, 3179, 2093, 3183, 2095, 3185, 2098, - 3189, 2100, 3193, 2104, 3195, 2121, 3202, 2122, 3206, 2139, - 3212, 2143, 3216, 2148, 3225, 2150, 3229, 2166, 3233, 2167, - 3235, 2171, 3239, 2185, 3246, 2188, 3252, 2189, 3256, 2193, - 3262, 2194, 3266, 2212, 3273, 2217, 3275, 2233, 3279, 2235, - 3283, 2238, 3285, 2240, 3292, 2256, 3296, 2261, 3302, 2279, - 3306, 2283, 3312, 2284, 3319, 2288, 3323, 2302, 3325, 2306, - - 3329, 2307, 3333, 2323, 3342, 2325, 3346, 2328, 3352, 2330, - 3356, 2334, 3363, 2351, 3365, 2352, 3369, 2369, 3373, 2373, - 3375, 2378, 3379, 2380, 3386, 2396, 3392, 2397, 3396, 2401, - 3402, 2415, 3409, 2418, 3413, 2419, 3415, 2423, 3419, 2424, - 3423, 2442, 3425, 2447, 3432, 2463, 3436, 2465, 3442, 2468, - 3446, 2470, 3455, 2486, 3459, 2491, 3463, 2509, 3465, 2513, - 3469, 2514, 3476, 2518, 3482, 2532, 3486, 2536, 3492, 2537, - 3496, 2553, 3503, 2555, 3505, 2558, 3509, 2560, 3513, 2564, - 3515, 2581, 3522, 2582, 3526, 2599, 3532, 2603, 3536, 8966, - 3542, 8966, 3594, 3606, 3618, 3630, 3642, 3654, 3666, 3678, - - 3690, 2622, 3702, 3708, 3718, 3730, 3740, 3744, 3748, 3758, - 3770, 3782, 3794, 3799, 3809, 3815, 3825, 3836, 3847, 3858, - 3869, 3879, 3890, 3902, 3912, 2624, 3922, 3934, 3946, 3958, - 3970, 3982, 3994, 4006, 4018, 4030, 4042, 4054, 4066, 4078, - 4090, 4102, 4114, 4126, 4138, 4150, 4162, 4174, 4186, 4198, - 4210, 4222, 4234, 4246, 4258, 4270, 4282, 4294, 4306, 4318, - 4330, 4342, 4354, 4366, 4378, 4390, 4402, 4414, 4426, 4438, - 4450, 4462, 4474, 4486, 4498, 4510, 4522, 4534, 4546, 4558, - 4570, 4582, 4594, 4606, 4618, 4630, 4642, 4654, 4666, 4678, - 4690, 4702, 4714, 4726, 4738, 4750, 4762, 4774, 4786, 4798, - - 4810, 4822, 4834, 4846, 4858, 4870, 4882, 4894, 4906, 4918, - 4930, 4942, 4954, 4966, 4978, 4990, 5002, 5014, 5026, 5038, - 5050, 5062, 5074, 5086, 5098, 5110, 5122, 5134, 5146, 5158, - 5170, 5182, 5194, 5206, 5218, 5230, 5242, 5254, 5266, 5278, - 5290, 5302, 5314, 5326, 5338, 5350, 5362, 5374, 5386, 5398, - 5410, 5422, 5434, 5446, 5458, 5470, 5482, 5494, 5506, 5518, - 5530, 5542, 5554, 5566, 5578, 5590, 5602, 5614, 5626, 5638, - 5650, 5662, 5674, 5686, 5698, 5710, 5722, 5734, 5746, 5758, - 5770, 5782, 5794, 5806, 5818, 5830, 5842, 5854, 5866, 5878, - 5890, 5902, 5914, 5926, 5938, 5950, 5962, 5974, 5986, 5998, - - 6010, 6022, 6034, 6046, 6058, 6070, 6082, 6094, 6106, 6118, - 6130, 6142, 6154, 6166, 6178, 6190, 6202, 6214, 6226, 6238, - 6250, 6262, 6274, 6286, 6298, 6310, 6322, 6334, 6346, 6358, - 6370, 6382, 6394, 6406, 6418, 6430, 6442, 6454, 6466, 6478, - 6490, 6502, 6514, 6526, 6538, 6550, 6562, 6574, 6586, 6598, - 6610, 6622, 6634, 6646, 6658, 6670, 6682, 6694, 6706, 6718, - 6730, 6742, 6754, 6766, 6778, 6790, 6802, 6814, 6826, 6838, - 6850, 6862, 6874, 6886, 6898, 6910, 6922, 6934, 6946, 6958, - 6970, 6982, 6994, 7006, 7018, 7030, 7042, 7054, 7066, 7078, - 7090, 7102, 7114, 7126, 7138, 7150, 7162, 7174, 7186, 7198, - - 7210, 7222, 7234, 7246, 7258, 7270, 7282, 7294, 7306, 7318, - 7330, 7342, 7354, 7366, 7378, 7390, 7402, 7414, 7426, 7438, - 7450, 7462, 7474, 7486, 7498, 7510, 7522, 7534, 7546, 7558, - 7570, 7582, 7594, 7606, 7618, 7630, 7642, 7654, 7666, 7678, - 7690, 7702, 7714, 7726, 7738, 7750, 7762, 7774, 7786, 7798, - 7810, 7822, 7834, 7846, 7858, 7870, 7882, 7894, 7906, 7918, - 7930, 7942, 7954, 7966, 7978, 7990, 8002, 8014, 8026, 8038, - 8050, 8062, 8074, 8086, 8098, 8110, 8122, 8134, 8146, 8158, - 8170, 8182, 8194, 8206, 8218, 8230, 8242, 8254, 8266, 8278, - 8290, 8302, 8314, 8326, 8338, 8350, 8362, 8374, 8386, 8398, - - 8410, 8422, 8434, 8446, 8458, 8470, 8482, 8494, 8506, 8518, - 8530, 8542, 8554, 8566, 8578, 8590, 8602, 8614, 8626, 8638, - 8650 - } ; - -static yyconst short int yy_def[1922] = - { 0, - 1493, 1493, 1492, 3, 1494, 1494, 1495, 1495, 1492, 9, - 1492, 11, 1496, 1496, 1492, 15, 1492, 17, 1492, 19, - 1497, 1497, 1497, 1497, 1498, 1498, 1492, 1499, 1500, 1492, - 1492, 1492, 1501, 1492, 1502, 1492, 1492, 1503, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1504, 1492, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1492, 1492, 1492, 1505, 1492, - 1492, 1505, 1505, 1506, 1492, 1506, 1492, 1506, 1492, 1492, - 90, 1492, 89, 1492, 93, 1492, 1507, 1492, 1492, 1492, - - 1508, 1492, 1509, 1492, 1492, 1502, 1492, 1492, 1492, 1510, - 1492, 1492, 1511, 1492, 1492, 1492, 1492, 1492, 1512, 1499, - 1499, 1492, 1492, 1492, 1492, 1492, 1501, 1492, 1513, 1501, - 1501, 1514, 1492, 1492, 1492, 1492, 1503, 1492, 1503, 39, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1504, 1504, 1504, 1504, 1504, - 1504, 1501, 1503, 1492, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1492, 1492, 1505, 1515, 1505, 1505, 1505, 1492, 1515, 1515, - 1516, 1492, 1492, 1505, 1506, 1517, 1506, 1506, 1506, 1517, - 1517, 1492, 1506, 89, 90, 90, 1518, 93, 94, 93, - 89, 1519, 90, 1492, 253, 90, 89, 1518, 1518, 1518, - 94, 89, 93, 94, 93, 93, 1492, 1507, 1492, 1492, - 1508, 1509, 1492, 1492, 1492, 1510, 1492, 1492, 1511, 1492, - 1492, 1492, 1520, 1512, 1492, 1492, 1492, 1492, 1501, 1513, - 1514, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1521, - 1492, 1492, 1492, 1492, 1492, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1492, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1515, 1492, 1516, 1492, 1505, - 1517, 1506, 89, 1519, 1519, 89, 1492, 1522, 254, 254, - 1523, 1523, 253, 1518, 1518, 259, 93, 93, 1492, 1524, - 1520, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1521, 1525, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1526, 1519, 89, 1522, - 1522, 89, 1523, 253, 1518, 93, 1527, 1524, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1525, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1492, 1522, 1523, 1528, 1527, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1529, 1528, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1504, 1504, 1504, 1504, 1504, 1504, - - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1530, 1529, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1531, - 1530, 1492, 1492, 1504, 1504, 1504, 1504, 1504, 1504, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1532, 1531, 1492, 1504, - 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1504, 1533, 1532, - 1492, 1504, 1504, 1504, 1504, 1534, 1533, 1492, 1504, 1504, - 1504, 1504, 1535, 1534, 1492, 1504, 1536, 1535, 1492, 1504, - - 1537, 1536, 1492, 1504, 1538, 1537, 1492, 1539, 1538, 1492, - 1492, 1540, 1539, 1492, 1492, 1492, 1492, 1541, 1540, 1492, - 1492, 1492, 1542, 1541, 1492, 1492, 1492, 1543, 1542, 1492, - 1492, 1492, 1492, 1544, 1543, 1545, 1544, 1546, 1545, 1547, - 1546, 1548, 1547, 1549, 1548, 1550, 1549, 1551, 1550, 1552, - 1551, 1553, 1552, 1554, 1553, 1555, 1554, 1556, 1555, 1557, - 1556, 1558, 1557, 1559, 1558, 1560, 1559, 1561, 1560, 1562, - 1561, 1563, 1562, 1564, 1563, 1565, 1564, 1566, 1565, 1567, - 1566, 1568, 1567, 1569, 1568, 1570, 1569, 1571, 1570, 1572, - 1571, 1573, 1572, 1574, 1573, 1575, 1574, 1576, 1575, 1577, - - 1576, 1578, 1577, 1579, 1578, 1580, 1579, 1581, 1580, 1582, - 1581, 1583, 1582, 1584, 1583, 1585, 1584, 1586, 1585, 1587, - 1586, 1588, 1587, 1589, 1588, 1590, 1589, 1591, 1590, 1592, - 1591, 1593, 1592, 1594, 1593, 1595, 1594, 1596, 1595, 1597, - 1596, 1598, 1597, 1599, 1598, 1600, 1599, 1601, 1600, 1602, - 1601, 1603, 1602, 1604, 1603, 1605, 1604, 1606, 1605, 1607, - 1606, 1608, 1607, 1609, 1608, 1610, 1609, 1611, 1610, 1612, - 1611, 1613, 1612, 1614, 1613, 1615, 1614, 1616, 1615, 1617, - 1616, 1618, 1617, 1619, 1618, 1620, 1619, 1621, 1620, 1622, - 1621, 1623, 1622, 1624, 1623, 1625, 1624, 1626, 1625, 1627, - - 1626, 1628, 1627, 1629, 1628, 1630, 1629, 1631, 1630, 1632, - 1631, 1633, 1632, 1634, 1633, 1635, 1634, 1636, 1635, 1637, - 1636, 1638, 1637, 1639, 1638, 1640, 1639, 1641, 1640, 1642, - 1641, 1643, 1642, 1644, 1643, 1645, 1644, 1646, 1645, 1647, - 1646, 1648, 1647, 1649, 1648, 1650, 1649, 1651, 1650, 1652, - 1651, 1653, 1652, 1654, 1653, 1655, 1654, 1656, 1655, 1657, - 1656, 1658, 1657, 1659, 1658, 1660, 1659, 1661, 1660, 1662, - 1661, 1663, 1662, 1664, 1663, 1665, 1664, 1666, 1665, 1667, - 1666, 1668, 1667, 1669, 1668, 1670, 1669, 1671, 1670, 1672, - 1671, 1673, 1672, 1674, 1673, 1675, 1674, 1676, 1675, 1677, - - 1676, 1678, 1677, 1679, 1678, 1680, 1679, 1681, 1680, 1682, - 1681, 1683, 1682, 1684, 1683, 1685, 1684, 1686, 1685, 1687, - 1686, 1688, 1687, 1689, 1688, 1690, 1689, 1691, 1690, 1692, - 1691, 1693, 1692, 1694, 1693, 1695, 1694, 1696, 1695, 1697, - 1696, 1698, 1697, 1699, 1698, 1700, 1699, 1701, 1700, 1702, - 1701, 1703, 1702, 1704, 1703, 1705, 1704, 1706, 1705, 1707, - 1706, 1708, 1707, 1709, 1708, 1710, 1709, 1711, 1710, 1712, - 1711, 1713, 1712, 1714, 1713, 1715, 1714, 1716, 1715, 1717, - 1716, 1718, 1717, 1719, 1718, 1720, 1719, 1721, 1720, 1722, - 1721, 1723, 1722, 1724, 1723, 1725, 1724, 1726, 1725, 1727, - - 1726, 1728, 1727, 1729, 1728, 1730, 1729, 1731, 1730, 1732, - 1731, 1733, 1732, 1734, 1733, 1735, 1734, 1736, 1735, 1737, - 1736, 1738, 1737, 1739, 1738, 1740, 1739, 1741, 1740, 1742, - 1741, 1743, 1742, 1744, 1743, 1745, 1744, 1746, 1745, 1747, - 1746, 1748, 1747, 1749, 1748, 1750, 1749, 1751, 1750, 1752, - 1751, 1753, 1752, 1754, 1753, 1755, 1754, 1756, 1755, 1757, - 1756, 1758, 1757, 1759, 1758, 1760, 1759, 1761, 1760, 1762, - 1761, 1763, 1762, 1764, 1763, 1765, 1764, 1766, 1765, 1767, - 1766, 1768, 1767, 1769, 1768, 1770, 1769, 1771, 1770, 1772, - 1771, 1773, 1772, 1774, 1773, 1775, 1774, 1776, 1775, 1777, - - 1776, 1778, 1777, 1779, 1778, 1780, 1779, 1781, 1780, 1782, - 1781, 1783, 1782, 1784, 1783, 1785, 1784, 1786, 1785, 1787, - 1786, 1788, 1787, 1789, 1788, 1790, 1789, 1791, 1790, 1792, - 1791, 1793, 1792, 1794, 1793, 1795, 1794, 1796, 1795, 1797, - 1796, 1798, 1797, 1799, 1798, 1800, 1799, 1801, 1800, 1802, - 1801, 1803, 1802, 1804, 1803, 1805, 1804, 1806, 1805, 1807, - 1806, 1808, 1807, 1809, 1808, 1810, 1809, 1811, 1810, 1812, - 1811, 1813, 1812, 1814, 1813, 1815, 1814, 1816, 1815, 1817, - 1816, 1818, 1817, 1819, 1818, 1820, 1819, 1821, 1820, 1822, - 1821, 1823, 1822, 1824, 1823, 1825, 1824, 1826, 1825, 1827, - - 1826, 1828, 1827, 1829, 1828, 1830, 1829, 1831, 1830, 1832, - 1831, 1833, 1832, 1834, 1833, 1835, 1834, 1836, 1835, 1837, - 1836, 1838, 1837, 1839, 1838, 1840, 1839, 1841, 1840, 1842, - 1841, 1843, 1842, 1844, 1843, 1845, 1844, 1846, 1845, 1847, - 1846, 1848, 1847, 1849, 1848, 1850, 1849, 1851, 1850, 1852, - 1851, 1853, 1852, 1854, 1853, 1855, 1854, 1856, 1855, 1857, - 1856, 1858, 1857, 1859, 1858, 1860, 1859, 1861, 1860, 1862, - 1861, 1863, 1862, 1864, 1863, 1865, 1864, 1866, 1865, 1867, - 1866, 1868, 1867, 1869, 1868, 1870, 1869, 1871, 1870, 1872, - 1871, 1873, 1872, 1874, 1873, 1875, 1874, 1876, 1875, 1877, - - 1876, 1878, 1877, 1879, 1878, 1880, 1879, 1881, 1880, 1882, - 1881, 1883, 1882, 1884, 1883, 1885, 1884, 1886, 1885, 1887, - 1886, 1888, 1887, 1889, 1888, 1890, 1889, 1891, 1890, 1892, - 1891, 1893, 1892, 1894, 1893, 1895, 1894, 1896, 1895, 1897, - 1896, 1898, 1897, 1899, 1898, 1900, 1899, 1901, 1900, 1902, - 1901, 1903, 1902, 1904, 1903, 1905, 1904, 1906, 1905, 1907, - 1906, 1908, 1907, 1909, 1908, 1910, 1909, 1911, 1910, 1912, - 1911, 1913, 1912, 1914, 1913, 1915, 1914, 1916, 1915, 1917, - 1916, 1918, 1917, 1919, 1918, 1920, 1919, 1921, 1920, 1492, - 1921, 0, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492 - } ; - -static yyconst short int yy_nxt[9029] = - { 0, - 30, 31, 31, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 40, 43, 44, 45, 46, - 47, 48, 40, 49, 50, 51, 52, 40, 30, 40, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 63, 63, 65, 63, 66, 67, 68, 63, - 69, 70, 71, 72, 73, 74, 75, 63, 63, 76, - 77, 78, 80, 80, 81, 81, 85, 85, 133, 134, - 114, 115, 114, 115, 135, 153, 116, 1017, 116, 125, - 125, 125, 138, 154, 155, 82, 82, 86, 86, 136, - 138, 87, 87, 117, 118, 117, 118, 151, 156, 156, - - 139, 158, 209, 157, 166, 210, 159, 152, 139, 167, - 168, 169, 160, 170, 171, 1019, 83, 83, 88, 88, - 89, 89, 90, 91, 89, 89, 89, 92, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 93, 89, - 89, 94, 89, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 95, - 89, 89, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 97, 96, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 96, 96, 96, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 101, 99, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, - - 101, 101, 101, 99, 99, 99, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 103, 102, 103, - 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, - 103, 103, 103, 103, 103, 102, 102, 102, 30, 104, - 104, 104, 105, 105, 104, 106, 105, 105, 104, 105, - 105, 105, 105, 105, 105, 105, 105, 107, 108, 105, - 105, 105, 105, 105, 105, 105, 104, 109, 105, 63, - - 105, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 105, 105, 105, - 122, 128, 161, 129, 162, 162, 161, 1021, 162, 162, - 172, 173, 212, 178, 182, 213, 216, 186, 123, 183, - 1023, 217, 163, 189, 130, 179, 163, 190, 187, 180, - 181, 188, 184, 191, 198, 214, 221, 273, 273, 192, - 199, 164, 224, 124, 202, 215, 200, 236, 193, 194, - 195, 203, 204, 267, 267, 131, 140, 205, 196, 185, - 197, 275, 275, 225, 1492, 1025, 285, 328, 237, 125, - - 125, 125, 222, 269, 274, 292, 293, 280, 280, 1492, - 295, 329, 1492, 280, 310, 311, 296, 1027, 141, 142, - 286, 143, 331, 144, 226, 332, 145, 314, 315, 238, - 280, 280, 146, 326, 327, 147, 148, 1492, 149, 227, - 227, 227, 227, 227, 228, 227, 229, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 230, 227, 227, - 231, 227, 231, 231, 231, 231, 231, 231, 231, 231, - 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, - 231, 231, 231, 231, 231, 231, 231, 231, 232, 227, - - 227, 228, 233, 233, 138, 128, 339, 129, 156, 156, - 1029, 305, 305, 161, 352, 162, 162, 340, 355, 409, - 353, 356, 139, 237, 225, 346, 163, 242, 290, 163, - 306, 410, 306, 163, 316, 307, 307, 317, 367, 318, - 1031, 347, 348, 319, 320, 267, 267, 273, 273, 369, - 275, 275, 307, 307, 243, 234, 239, 239, 239, 239, - 239, 239, 239, 240, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 241, 239, 239, 231, 242, 231, - 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, - - 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, - 231, 231, 231, 231, 231, 232, 239, 239, 244, 244, - 245, 246, 244, 244, 244, 247, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 248, 244, 244, 249, - 244, 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, 249, 250, 244, 244, - 251, 251, 245, 246, 251, 251, 251, 252, 251, 251, - 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, - - 251, 251, 251, 251, 251, 251, 251, 251, 253, 251, - 251, 254, 251, 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, 255, - 251, 251, 257, 257, 245, 246, 257, 257, 257, 258, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 259, 257, 257, 231, 257, 231, 231, 231, 231, 231, - 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, - 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, - - 231, 232, 257, 257, 244, 308, 308, 267, 267, 404, - 404, 404, 307, 307, 421, 422, 245, 246, 446, 308, - 308, 308, 308, 308, 308, 244, 447, 269, 244, 1033, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 245, - 246, 244, 244, 244, 260, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 261, 261, 244, 262, - 244, 244, 244, 244, 244, 263, 244, 244, 264, 244, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 265, 244, 244, 233, - 128, 128, 129, 1492, 128, 224, 129, 228, 228, 229, - 1492, 224, 228, 240, 366, 371, 1035, 245, 246, 1037, - 248, 1039, 258, 130, 130, 1041, 225, 130, 305, 305, - 230, 225, 225, 1043, 241, 230, 241, 228, 242, 366, - 242, 367, 228, 259, 1492, 476, 163, 404, 404, 404, - 547, 266, 369, 1045, 131, 131, 477, 226, 131, 1047, - 230, 548, 234, 226, 227, 225, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 236, 1492, 236, 370, 1492, 245, 246, - 245, 246, 1049, 374, 371, 384, 245, 246, 428, 1051, - 429, 385, 1053, 430, 237, 237, 237, 585, 237, 242, - 389, 389, 242, 431, 375, 241, 259, 432, 586, 242, - 484, 485, 386, 1055, 389, 389, 389, 389, 389, 389, - 536, 536, 537, 484, 485, 238, 243, 238, 239, 372, - 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, 1492, 1492, 1492, - - 260, 1492, 1492, 280, 280, 128, 1057, 129, 228, 280, - 1492, 1492, 1492, 1492, 245, 246, 1492, 1492, 248, 458, - 253, 263, 263, 248, 1059, 1061, 280, 280, 130, 308, - 308, 225, 237, 253, 245, 246, 242, 1063, 263, 460, - 375, 1492, 1065, 308, 308, 308, 308, 308, 308, 266, - 251, 383, 265, 387, 388, 541, 547, 592, 1067, 131, - 461, 585, 370, 372, 464, 1069, 542, 548, 593, 466, - 1071, 251, 586, 1073, 251, 1075, 251, 251, 251, 251, - 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, - 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, - - 251, 251, 251, 376, 376, 377, 377, 376, 376, 376, - 378, 376, 376, 376, 376, 376, 376, 376, 376, 376, - 376, 376, 379, 379, 376, 380, 376, 376, 376, 376, - 376, 381, 376, 376, 379, 376, 379, 379, 379, 379, - 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, - 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, - 379, 379, 382, 376, 376, 245, 246, 245, 246, 245, - 246, 622, 1492, 626, 384, 621, 621, 621, 628, 592, - 622, 541, 623, 1077, 627, 1079, 1081, 1083, 1085, 629, - 593, 623, 542, 381, 257, 259, 257, 257, 257, 257, - - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 289, 463, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 245, 246, 245, 246, 389, 389, 476, 465, - 1087, 1089, 1091, 1093, 1095, 1097, 1099, 1101, 626, 477, - 389, 389, 389, 389, 389, 389, 621, 621, 621, 627, - 386, 373, 1103, 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, - 376, 376, 628, 376, 1105, 1107, 1109, 1111, 1113, 652, - 1115, 1117, 376, 629, 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, - 1492, 1492, 476, 245, 246, 245, 246, 1492, 458, 541, - 532, 1492, 1119, 477, 1121, 1123, 1492, 245, 246, 1492, - 542, 248, 1492, 1125, 1492, 245, 246, 1127, 253, 375, - 465, 461, 263, 1129, 1131, 245, 246, 1133, 478, 1492, - 532, 1135, 1492, 381, 1492, 543, 653, 653, 653, 1137, - - 1139, 386, 388, 245, 246, 245, 246, 1141, 1143, 464, - 1492, 461, 1145, 466, 1147, 1149, 1151, 1492, 1153, 1155, - 174, 1157, 1159, 1161, 533, 1163, 1165, 1167, 1169, 1171, - 1173, 381, 459, 1175, 459, 459, 459, 459, 459, 459, - 459, 459, 459, 459, 459, 459, 459, 459, 459, 459, - 459, 459, 459, 459, 459, 459, 459, 459, 459, 459, - 459, 1492, 533, 1492, 1177, 1492, 1179, 1492, 653, 653, - 653, 1492, 1492, 1492, 1181, 1183, 1492, 1185, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 174, 1187, 1492, 1189, 710, 710, 710, 1492, - - 1191, 1193, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1195, 1492, 1197, 1492, 1492, 1492, 1199, 1492, 711, - 1492, 1492, 1492, 1492, 1492, 1492, 1201, 1492, 710, 710, - 710, 714, 714, 714, 1203, 715, 1205, 1492, 1492, 1492, - 716, 1207, 1492, 714, 714, 714, 1492, 715, 1492, 1209, - 1492, 711, 716, 1492, 1492, 1492, 1492, 1211, 732, 732, - 732, 732, 732, 732, 1213, 1492, 1215, 1492, 1217, 1492, - 1492, 1492, 1492, 1492, 1219, 1221, 1492, 1492, 717, 1223, - 1492, 1492, 733, 1492, 1492, 733, 1492, 1225, 1492, 1492, - 717, 1492, 1492, 1227, 1492, 1492, 1229, 1492, 1492, 1492, - - 1492, 1231, 1492, 1492, 1233, 1235, 1492, 1492, 1492, 1237, - 1239, 1492, 1241, 1243, 1492, 1492, 1245, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1247, 1492, 1492, 1492, 1249, 1492, - 1492, 1492, 1492, 1251, 1492, 1492, 1492, 1253, 1492, 1492, - 1492, 1492, 1255, 1492, 1492, 1492, 1257, 1259, 1492, 1492, - 1492, 1261, 1492, 1492, 1492, 1492, 1263, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1265, 1492, 1492, 1492, 1267, - 1269, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1271, 1492, 1273, 1492, - 1492, 1275, 1492, 1277, 1492, 1492, 1492, 1279, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1281, 1283, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1285, 1492, 1492, 1492, 1287, 1492, 1492, 1492, - 1492, 1289, 1492, 1291, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1293, - 1295, 1492, 1492, 1492, 1297, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1299, 1492, - 1492, 1301, 1303, 1492, 1492, 1492, 1305, 1307, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1309, 1492, 1492, 1492, 1492, - 1311, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1313, 1492, 1315, 1492, - 1492, 1317, 1492, 1319, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1321, - 1492, 1492, 1492, 1492, 1323, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1325, 1492, 1492, 1492, 1327, 1329, 1492, 1492, - 1492, 1331, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1333, 1492, 1492, 1492, 1335, - - 1337, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1339, 1492, 1341, 1492, - 1492, 1343, 1492, 1345, 1492, 1492, 1492, 1347, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1349, 1351, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1353, 1492, 1492, 1492, 1355, 1492, 1492, 1492, - 1492, 1357, 1492, 1359, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1361, - 1363, 1492, 1492, 1492, 1365, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1367, 1492, - 1492, 1369, 1371, 1492, 1492, 1492, 1373, 1375, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1377, 1492, 1492, 1492, 1492, - 1379, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1381, 1492, 1383, 1492, - 1492, 1385, 1492, 1387, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1389, - 1492, 1492, 1492, 1492, 1391, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1393, 1492, 1492, 1492, 1395, 1397, 1492, 1492, - 1492, 1399, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1401, 1492, 1492, 1492, 1403, - 1405, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1407, 1492, 1409, 1492, - 1492, 1411, 1492, 1413, 1492, 1492, 1492, 1415, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1417, 1419, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1421, 1492, 1492, 1492, 1423, 1492, 1492, 1492, - - 1492, 1425, 1492, 1427, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1429, - 1431, 1492, 1492, 1492, 1433, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1435, 1492, - 1492, 1437, 1439, 1492, 1492, 1492, 1441, 1443, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1445, 1492, 1492, 1492, 1492, - 1447, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1449, 1492, 1451, 1492, - 1492, 1453, 1492, 1455, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1457, - 1492, 1492, 1492, 1492, 1459, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1461, 1492, 1492, 1492, 1463, 1465, 1492, 1492, - 1492, 1467, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1469, 1492, 1492, 1492, 1471, - 1473, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1475, 1492, 1477, 1492, - 1492, 1479, 1492, 1481, 1492, 1492, 1492, 1483, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1485, 1487, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1489, 1492, 1492, 1492, 1491, 1492, 1492, 1492, - 1492, 132, 1492, 531, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1015, - 1013, 1492, 1492, 1492, 1011, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1009, 1492, - 1492, 1007, 1005, 1492, 1492, 1492, 1003, 1001, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 999, 1492, 1492, 1492, 1492, - - 997, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 995, 1492, 993, 1492, - 1492, 991, 1492, 989, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 987, - 1492, 1492, 1492, 1492, 985, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 983, 1492, 1492, 1492, 981, 979, 1492, 1492, - 1492, 977, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 975, 1492, 1492, 1492, 973, - 971, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 969, 1492, 967, 1492, - 1492, 965, 1492, 963, 1492, 1492, 1492, 961, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 959, 957, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 955, 1492, 1492, 1492, 953, 1492, 1492, 1492, - 1492, 951, 1492, 949, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 947, - 945, 1492, 1492, 1492, 943, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 941, 1492, - - 1492, 939, 937, 1492, 1492, 1492, 935, 933, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 931, 1492, 1492, 1492, 1492, - 929, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 927, 1492, 925, 1492, - 1492, 923, 1492, 921, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 919, - 1492, 1492, 1492, 1492, 917, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 915, 1492, 1492, 1492, 913, 911, 1492, 1492, - - 1492, 909, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 907, 1492, 1492, 1492, 905, - 903, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 901, 1492, 899, 1492, - 1492, 897, 1492, 895, 1492, 1492, 1492, 893, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 891, 889, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 887, 1492, 1492, 1492, 885, 1492, 1492, 1492, - 1492, 883, 1492, 881, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 879, - 877, 1492, 1492, 1492, 875, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 873, 1492, - 1492, 871, 869, 1492, 1492, 1492, 867, 865, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 863, 1492, 1492, 1492, 1492, - 861, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 859, 1492, 857, 1492, - 1492, 855, 1492, 853, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 851, - - 1492, 1492, 1492, 1492, 849, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 847, 1492, 1492, 1492, 845, 843, 1492, 1492, - 1492, 841, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 839, 1492, 1492, 1492, 837, - 835, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 833, 1492, 831, 1492, - 1492, 829, 1492, 827, 1492, 1492, 1492, 825, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 823, 821, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 819, 1492, 1492, 1492, 817, 1492, 1492, 1492, - 1492, 815, 1492, 813, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 811, - 809, 1492, 1492, 1492, 807, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 805, 1492, - 1492, 803, 801, 1492, 1492, 1492, 799, 797, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 795, 1492, 1492, 1492, 1492, - 793, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 791, 1492, 789, 1492, - 1492, 787, 1492, 785, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 783, - 1492, 1492, 1492, 1492, 781, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 779, 1492, 1492, 1492, 777, 775, 1492, 1492, - 1492, 773, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 771, 1492, 1492, 1492, 769, - 767, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 765, 1492, 763, 1492, - - 1492, 761, 1492, 759, 1492, 1492, 1492, 757, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 755, 753, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 751, 1492, 1492, 1492, 749, 1492, 1492, 1492, - 1492, 747, 1492, 745, 1492, 1492, 1492, 743, 1492, 1492, - 1492, 741, 1492, 739, 1492, 1492, 1492, 737, 1492, 727, - 727, 735, 731, 1492, 730, 729, 727, 1492, 726, 725, - 724, 722, 721, 1492, 720, 719, 713, 1492, 709, 707, - 706, 704, 703, 1492, 28, 28, 28, 28, 28, 28, - - 28, 28, 28, 28, 28, 28, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 98, 98, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 113, 113, 113, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 121, 121, - 121, 121, 121, 121, 121, 121, 702, 121, 121, 121, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - - 127, 127, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 176, 700, 699, 176, 223, 223, - 223, 698, 223, 223, 223, 223, 223, 223, 223, 223, - 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, - 696, 235, 268, 695, 694, 692, 268, 268, 691, 268, - 271, 690, 689, 271, 272, 688, 687, 272, 276, 276, - 276, 276, 685, 276, 276, 276, 276, 276, 276, 276, - 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, - 279, 279, 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 289, 289, 289, 289, 289, 289, - - 289, 289, 289, 684, 289, 291, 683, 682, 291, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 681, 227, - 368, 368, 680, 678, 368, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 677, 239, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 676, 257, 373, 373, 373, - 373, 373, 373, 373, 373, 373, 675, 373, 390, 390, - 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, - 407, 674, 673, 672, 671, 670, 669, 668, 407, 459, - 459, 459, 459, 459, 459, 459, 459, 459, 666, 459, - 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, - - 462, 462, 467, 467, 467, 467, 467, 467, 467, 467, - 467, 467, 467, 467, 486, 665, 664, 663, 486, 662, - 661, 486, 534, 534, 534, 534, 534, 534, 534, 534, - 534, 534, 534, 534, 582, 582, 582, 582, 582, 582, - 582, 582, 582, 582, 582, 582, 619, 619, 619, 619, - 619, 619, 619, 619, 619, 619, 619, 619, 650, 650, - 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, - 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, - 667, 667, 679, 679, 679, 679, 679, 679, 679, 679, - 679, 679, 679, 679, 686, 686, 686, 686, 686, 686, - - 686, 686, 686, 686, 686, 686, 693, 693, 693, 693, - 693, 693, 693, 693, 693, 693, 693, 693, 697, 697, - 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, - 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, - 701, 701, 705, 705, 705, 705, 705, 705, 705, 705, - 705, 705, 705, 705, 708, 708, 708, 708, 708, 708, - 708, 708, 708, 708, 708, 708, 712, 712, 712, 712, - 712, 712, 712, 712, 712, 712, 712, 712, 718, 718, - 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, - 723, 723, 723, 723, 723, 723, 723, 723, 723, 723, - - 723, 723, 728, 728, 728, 728, 728, 728, 728, 728, - 728, 728, 728, 728, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 736, 736, 736, 736, - 736, 736, 736, 736, 736, 736, 736, 736, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, - 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, - 740, 740, 742, 742, 742, 742, 742, 742, 742, 742, - 742, 742, 742, 742, 744, 744, 744, 744, 744, 744, - 744, 744, 744, 744, 744, 744, 746, 746, 746, 746, - 746, 746, 746, 746, 746, 746, 746, 746, 748, 748, - - 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, - 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, - 750, 750, 752, 752, 752, 752, 752, 752, 752, 752, - 752, 752, 752, 752, 754, 754, 754, 754, 754, 754, - 754, 754, 754, 754, 754, 754, 756, 756, 756, 756, - 756, 756, 756, 756, 756, 756, 756, 756, 758, 758, - 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, - 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, - 760, 760, 762, 762, 762, 762, 762, 762, 762, 762, - 762, 762, 762, 762, 764, 764, 764, 764, 764, 764, - - 764, 764, 764, 764, 764, 764, 766, 766, 766, 766, - 766, 766, 766, 766, 766, 766, 766, 766, 768, 768, - 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, - 770, 770, 770, 770, 770, 770, 770, 770, 770, 770, - 770, 770, 772, 772, 772, 772, 772, 772, 772, 772, - 772, 772, 772, 772, 774, 774, 774, 774, 774, 774, - 774, 774, 774, 774, 774, 774, 776, 776, 776, 776, - 776, 776, 776, 776, 776, 776, 776, 776, 778, 778, - 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, - 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, - - 780, 780, 782, 782, 782, 782, 782, 782, 782, 782, - 782, 782, 782, 782, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 786, 786, 786, 786, - 786, 786, 786, 786, 786, 786, 786, 786, 788, 788, - 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, - 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, - 790, 790, 792, 792, 792, 792, 792, 792, 792, 792, - 792, 792, 792, 792, 794, 794, 794, 794, 794, 794, - 794, 794, 794, 794, 794, 794, 796, 796, 796, 796, - 796, 796, 796, 796, 796, 796, 796, 796, 798, 798, - - 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, - 800, 800, 802, 802, 802, 802, 802, 802, 802, 802, - 802, 802, 802, 802, 804, 804, 804, 804, 804, 804, - 804, 804, 804, 804, 804, 804, 806, 806, 806, 806, - 806, 806, 806, 806, 806, 806, 806, 806, 808, 808, - 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, - 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, - 810, 810, 812, 812, 812, 812, 812, 812, 812, 812, - 812, 812, 812, 812, 814, 814, 814, 814, 814, 814, - - 814, 814, 814, 814, 814, 814, 816, 816, 816, 816, - 816, 816, 816, 816, 816, 816, 816, 816, 818, 818, - 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, - 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, - 820, 820, 822, 822, 822, 822, 822, 822, 822, 822, - 822, 822, 822, 822, 824, 824, 824, 824, 824, 824, - 824, 824, 824, 824, 824, 824, 826, 826, 826, 826, - 826, 826, 826, 826, 826, 826, 826, 826, 828, 828, - 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, - 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, - - 830, 830, 832, 832, 832, 832, 832, 832, 832, 832, - 832, 832, 832, 832, 834, 834, 834, 834, 834, 834, - 834, 834, 834, 834, 834, 834, 836, 836, 836, 836, - 836, 836, 836, 836, 836, 836, 836, 836, 838, 838, - 838, 838, 838, 838, 838, 838, 838, 838, 838, 838, - 840, 840, 840, 840, 840, 840, 840, 840, 840, 840, - 840, 840, 842, 842, 842, 842, 842, 842, 842, 842, - 842, 842, 842, 842, 844, 844, 844, 844, 844, 844, - 844, 844, 844, 844, 844, 844, 846, 846, 846, 846, - 846, 846, 846, 846, 846, 846, 846, 846, 848, 848, - - 848, 848, 848, 848, 848, 848, 848, 848, 848, 848, - 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, - 850, 850, 852, 852, 852, 852, 852, 852, 852, 852, - 852, 852, 852, 852, 854, 854, 854, 854, 854, 854, - 854, 854, 854, 854, 854, 854, 856, 856, 856, 856, - 856, 856, 856, 856, 856, 856, 856, 856, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, - 860, 860, 862, 862, 862, 862, 862, 862, 862, 862, - 862, 862, 862, 862, 864, 864, 864, 864, 864, 864, - - 864, 864, 864, 864, 864, 864, 866, 866, 866, 866, - 866, 866, 866, 866, 866, 866, 866, 866, 868, 868, - 868, 868, 868, 868, 868, 868, 868, 868, 868, 868, - 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 872, 872, 872, 872, 872, 872, 872, 872, - 872, 872, 872, 872, 874, 874, 874, 874, 874, 874, - 874, 874, 874, 874, 874, 874, 876, 876, 876, 876, - 876, 876, 876, 876, 876, 876, 876, 876, 878, 878, - 878, 878, 878, 878, 878, 878, 878, 878, 878, 878, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - - 880, 880, 882, 882, 882, 882, 882, 882, 882, 882, - 882, 882, 882, 882, 884, 884, 884, 884, 884, 884, - 884, 884, 884, 884, 884, 884, 886, 886, 886, 886, - 886, 886, 886, 886, 886, 886, 886, 886, 888, 888, - 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, - 890, 890, 890, 890, 890, 890, 890, 890, 890, 890, - 890, 890, 892, 892, 892, 892, 892, 892, 892, 892, - 892, 892, 892, 892, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 896, 896, 896, 896, - 896, 896, 896, 896, 896, 896, 896, 896, 898, 898, - - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, - 900, 900, 902, 902, 902, 902, 902, 902, 902, 902, - 902, 902, 902, 902, 904, 904, 904, 904, 904, 904, - 904, 904, 904, 904, 904, 904, 906, 906, 906, 906, - 906, 906, 906, 906, 906, 906, 906, 906, 908, 908, - 908, 908, 908, 908, 908, 908, 908, 908, 908, 908, - 910, 910, 910, 910, 910, 910, 910, 910, 910, 910, - 910, 910, 912, 912, 912, 912, 912, 912, 912, 912, - 912, 912, 912, 912, 914, 914, 914, 914, 914, 914, - - 914, 914, 914, 914, 914, 914, 916, 916, 916, 916, - 916, 916, 916, 916, 916, 916, 916, 916, 918, 918, - 918, 918, 918, 918, 918, 918, 918, 918, 918, 918, - 920, 920, 920, 920, 920, 920, 920, 920, 920, 920, - 920, 920, 922, 922, 922, 922, 922, 922, 922, 922, - 922, 922, 922, 922, 924, 924, 924, 924, 924, 924, - 924, 924, 924, 924, 924, 924, 926, 926, 926, 926, - 926, 926, 926, 926, 926, 926, 926, 926, 928, 928, - 928, 928, 928, 928, 928, 928, 928, 928, 928, 928, - 930, 930, 930, 930, 930, 930, 930, 930, 930, 930, - - 930, 930, 932, 932, 932, 932, 932, 932, 932, 932, - 932, 932, 932, 932, 934, 934, 934, 934, 934, 934, - 934, 934, 934, 934, 934, 934, 936, 936, 936, 936, - 936, 936, 936, 936, 936, 936, 936, 936, 938, 938, - 938, 938, 938, 938, 938, 938, 938, 938, 938, 938, - 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, - 940, 940, 942, 942, 942, 942, 942, 942, 942, 942, - 942, 942, 942, 942, 944, 944, 944, 944, 944, 944, - 944, 944, 944, 944, 944, 944, 946, 946, 946, 946, - 946, 946, 946, 946, 946, 946, 946, 946, 948, 948, - - 948, 948, 948, 948, 948, 948, 948, 948, 948, 948, - 950, 950, 950, 950, 950, 950, 950, 950, 950, 950, - 950, 950, 952, 952, 952, 952, 952, 952, 952, 952, - 952, 952, 952, 952, 954, 954, 954, 954, 954, 954, - 954, 954, 954, 954, 954, 954, 956, 956, 956, 956, - 956, 956, 956, 956, 956, 956, 956, 956, 958, 958, - 958, 958, 958, 958, 958, 958, 958, 958, 958, 958, - 960, 960, 960, 960, 960, 960, 960, 960, 960, 960, - 960, 960, 962, 962, 962, 962, 962, 962, 962, 962, - 962, 962, 962, 962, 964, 964, 964, 964, 964, 964, - - 964, 964, 964, 964, 964, 964, 966, 966, 966, 966, - 966, 966, 966, 966, 966, 966, 966, 966, 968, 968, - 968, 968, 968, 968, 968, 968, 968, 968, 968, 968, - 970, 970, 970, 970, 970, 970, 970, 970, 970, 970, - 970, 970, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 974, 974, 974, 974, 974, 974, - 974, 974, 974, 974, 974, 974, 976, 976, 976, 976, - 976, 976, 976, 976, 976, 976, 976, 976, 978, 978, - 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, - 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, - - 980, 980, 982, 982, 982, 982, 982, 982, 982, 982, - 982, 982, 982, 982, 984, 984, 984, 984, 984, 984, - 984, 984, 984, 984, 984, 984, 986, 986, 986, 986, - 986, 986, 986, 986, 986, 986, 986, 986, 988, 988, - 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, - 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, - 990, 990, 992, 992, 992, 992, 992, 992, 992, 992, - 992, 992, 992, 992, 994, 994, 994, 994, 994, 994, - 994, 994, 994, 994, 994, 994, 996, 996, 996, 996, - 996, 996, 996, 996, 996, 996, 996, 996, 998, 998, - - 998, 998, 998, 998, 998, 998, 998, 998, 998, 998, - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, - 1000, 1000, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, - 1002, 1002, 1002, 1002, 1004, 1004, 1004, 1004, 1004, 1004, - 1004, 1004, 1004, 1004, 1004, 1004, 1006, 1006, 1006, 1006, - 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1008, 1008, - 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, - 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, - 1010, 1010, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, - 1012, 1012, 1012, 1012, 1014, 1014, 1014, 1014, 1014, 1014, - - 1014, 1014, 1014, 1014, 1014, 1014, 1016, 1016, 1016, 1016, - 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1018, 1018, - 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, - 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, - 1020, 1020, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, - 1022, 1022, 1022, 1022, 1024, 1024, 1024, 1024, 1024, 1024, - 1024, 1024, 1024, 1024, 1024, 1024, 1026, 1026, 1026, 1026, - 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1028, 1028, - 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, - 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, - - 1030, 1030, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, - 1032, 1032, 1032, 1032, 1034, 1034, 1034, 1034, 1034, 1034, - 1034, 1034, 1034, 1034, 1034, 1034, 1036, 1036, 1036, 1036, - 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1038, 1038, - 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1040, - 1040, 1040, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, - 1042, 1042, 1042, 1042, 1044, 1044, 1044, 1044, 1044, 1044, - 1044, 1044, 1044, 1044, 1044, 1044, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1048, 1048, - - 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, - 1052, 1052, 1052, 1052, 1054, 1054, 1054, 1054, 1054, 1054, - 1054, 1054, 1054, 1054, 1054, 1054, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1058, 1058, - 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, - 1062, 1062, 1062, 1062, 1064, 1064, 1064, 1064, 1064, 1064, - - 1064, 1064, 1064, 1064, 1064, 1064, 1066, 1066, 1066, 1066, - 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1068, 1068, - 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, - 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, - 1070, 1070, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, - 1072, 1072, 1072, 1072, 1074, 1074, 1074, 1074, 1074, 1074, - 1074, 1074, 1074, 1074, 1074, 1074, 1076, 1076, 1076, 1076, - 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1078, 1078, - 1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078, - 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, - - 1080, 1080, 1082, 1082, 1082, 1082, 1082, 1082, 1082, 1082, - 1082, 1082, 1082, 1082, 1084, 1084, 1084, 1084, 1084, 1084, - 1084, 1084, 1084, 1084, 1084, 1084, 1086, 1086, 1086, 1086, - 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1088, 1088, - 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, - 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, - 1090, 1090, 1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092, - 1092, 1092, 1092, 1092, 1094, 1094, 1094, 1094, 1094, 1094, - 1094, 1094, 1094, 1094, 1094, 1094, 1096, 1096, 1096, 1096, - 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1098, 1098, - - 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, - 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, - 1100, 1100, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, - 1102, 1102, 1102, 1102, 1104, 1104, 1104, 1104, 1104, 1104, - 1104, 1104, 1104, 1104, 1104, 1104, 1106, 1106, 1106, 1106, - 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1108, 1108, - 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, - 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, - 1110, 1110, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, - 1112, 1112, 1112, 1112, 1114, 1114, 1114, 1114, 1114, 1114, - - 1114, 1114, 1114, 1114, 1114, 1114, 1116, 1116, 1116, 1116, - 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1118, 1118, - 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, - 1122, 1122, 1122, 1122, 1124, 1124, 1124, 1124, 1124, 1124, - 1124, 1124, 1124, 1124, 1124, 1124, 1126, 1126, 1126, 1126, - 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1128, 1128, - 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, - 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, - - 1130, 1130, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, - 1132, 1132, 1132, 1132, 1134, 1134, 1134, 1134, 1134, 1134, - 1134, 1134, 1134, 1134, 1134, 1134, 1136, 1136, 1136, 1136, - 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1138, 1138, - 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138, - 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, - 1140, 1140, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142, - 1142, 1142, 1142, 1142, 1144, 1144, 1144, 1144, 1144, 1144, - 1144, 1144, 1144, 1144, 1144, 1144, 1146, 1146, 1146, 1146, - 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1148, 1148, - - 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148, - 1150, 1150, 1150, 1150, 1150, 1150, 1150, 1150, 1150, 1150, - 1150, 1150, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - 1152, 1152, 1152, 1152, 1154, 1154, 1154, 1154, 1154, 1154, - 1154, 1154, 1154, 1154, 1154, 1154, 1156, 1156, 1156, 1156, - 1156, 1156, 1156, 1156, 1156, 1156, 1156, 1156, 1158, 1158, - 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, - 1160, 1160, 1160, 1160, 1160, 1160, 1160, 1160, 1160, 1160, - 1160, 1160, 1162, 1162, 1162, 1162, 1162, 1162, 1162, 1162, - 1162, 1162, 1162, 1162, 1164, 1164, 1164, 1164, 1164, 1164, - - 1164, 1164, 1164, 1164, 1164, 1164, 1166, 1166, 1166, 1166, - 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1168, 1168, - 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168, - 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, - 1170, 1170, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, - 1172, 1172, 1172, 1172, 1174, 1174, 1174, 1174, 1174, 1174, - 1174, 1174, 1174, 1174, 1174, 1174, 1176, 1176, 1176, 1176, - 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1178, 1178, - 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, - 1180, 1180, 1180, 1180, 1180, 1180, 1180, 1180, 1180, 1180, - - 1180, 1180, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, - 1182, 1182, 1182, 1182, 1184, 1184, 1184, 1184, 1184, 1184, - 1184, 1184, 1184, 1184, 1184, 1184, 1186, 1186, 1186, 1186, - 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1188, 1188, - 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, - 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, - 1190, 1190, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, - 1192, 1192, 1192, 1192, 1194, 1194, 1194, 1194, 1194, 1194, - 1194, 1194, 1194, 1194, 1194, 1194, 1196, 1196, 1196, 1196, - 1196, 1196, 1196, 1196, 1196, 1196, 1196, 1196, 1198, 1198, - - 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, - 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200, - 1200, 1200, 1202, 1202, 1202, 1202, 1202, 1202, 1202, 1202, - 1202, 1202, 1202, 1202, 1204, 1204, 1204, 1204, 1204, 1204, - 1204, 1204, 1204, 1204, 1204, 1204, 1206, 1206, 1206, 1206, - 1206, 1206, 1206, 1206, 1206, 1206, 1206, 1206, 1208, 1208, - 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, - 1210, 1210, 1210, 1210, 1210, 1210, 1210, 1210, 1210, 1210, - 1210, 1210, 1212, 1212, 1212, 1212, 1212, 1212, 1212, 1212, - 1212, 1212, 1212, 1212, 1214, 1214, 1214, 1214, 1214, 1214, - - 1214, 1214, 1214, 1214, 1214, 1214, 1216, 1216, 1216, 1216, - 1216, 1216, 1216, 1216, 1216, 1216, 1216, 1216, 1218, 1218, - 1218, 1218, 1218, 1218, 1218, 1218, 1218, 1218, 1218, 1218, - 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, - 1220, 1220, 1222, 1222, 1222, 1222, 1222, 1222, 1222, 1222, - 1222, 1222, 1222, 1222, 1224, 1224, 1224, 1224, 1224, 1224, - 1224, 1224, 1224, 1224, 1224, 1224, 1226, 1226, 1226, 1226, - 1226, 1226, 1226, 1226, 1226, 1226, 1226, 1226, 1228, 1228, - 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, - 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, - - 1230, 1230, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, - 1232, 1232, 1232, 1232, 1234, 1234, 1234, 1234, 1234, 1234, - 1234, 1234, 1234, 1234, 1234, 1234, 1236, 1236, 1236, 1236, - 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1238, 1238, - 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, - 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, - 1240, 1240, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, - 1242, 1242, 1242, 1242, 1244, 1244, 1244, 1244, 1244, 1244, - 1244, 1244, 1244, 1244, 1244, 1244, 1246, 1246, 1246, 1246, - 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1248, 1248, - - 1248, 1248, 1248, 1248, 1248, 1248, 1248, 1248, 1248, 1248, - 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, - 1250, 1250, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1252, - 1252, 1252, 1252, 1252, 1254, 1254, 1254, 1254, 1254, 1254, - 1254, 1254, 1254, 1254, 1254, 1254, 1256, 1256, 1256, 1256, - 1256, 1256, 1256, 1256, 1256, 1256, 1256, 1256, 1258, 1258, - 1258, 1258, 1258, 1258, 1258, 1258, 1258, 1258, 1258, 1258, - 1260, 1260, 1260, 1260, 1260, 1260, 1260, 1260, 1260, 1260, - 1260, 1260, 1262, 1262, 1262, 1262, 1262, 1262, 1262, 1262, - 1262, 1262, 1262, 1262, 1264, 1264, 1264, 1264, 1264, 1264, - - 1264, 1264, 1264, 1264, 1264, 1264, 1266, 1266, 1266, 1266, - 1266, 1266, 1266, 1266, 1266, 1266, 1266, 1266, 1268, 1268, - 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, - 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, - 1270, 1270, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, - 1272, 1272, 1272, 1272, 1274, 1274, 1274, 1274, 1274, 1274, - 1274, 1274, 1274, 1274, 1274, 1274, 1276, 1276, 1276, 1276, - 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1278, 1278, - 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, - 1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280, - - 1280, 1280, 1282, 1282, 1282, 1282, 1282, 1282, 1282, 1282, - 1282, 1282, 1282, 1282, 1284, 1284, 1284, 1284, 1284, 1284, - 1284, 1284, 1284, 1284, 1284, 1284, 1286, 1286, 1286, 1286, - 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1288, 1288, - 1288, 1288, 1288, 1288, 1288, 1288, 1288, 1288, 1288, 1288, - 1290, 1290, 1290, 1290, 1290, 1290, 1290, 1290, 1290, 1290, - 1290, 1290, 1292, 1292, 1292, 1292, 1292, 1292, 1292, 1292, - 1292, 1292, 1292, 1292, 1294, 1294, 1294, 1294, 1294, 1294, - 1294, 1294, 1294, 1294, 1294, 1294, 1296, 1296, 1296, 1296, - 1296, 1296, 1296, 1296, 1296, 1296, 1296, 1296, 1298, 1298, - - 1298, 1298, 1298, 1298, 1298, 1298, 1298, 1298, 1298, 1298, - 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, - 1300, 1300, 1302, 1302, 1302, 1302, 1302, 1302, 1302, 1302, - 1302, 1302, 1302, 1302, 1304, 1304, 1304, 1304, 1304, 1304, - 1304, 1304, 1304, 1304, 1304, 1304, 1306, 1306, 1306, 1306, - 1306, 1306, 1306, 1306, 1306, 1306, 1306, 1306, 1308, 1308, - 1308, 1308, 1308, 1308, 1308, 1308, 1308, 1308, 1308, 1308, - 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, - 1310, 1310, 1312, 1312, 1312, 1312, 1312, 1312, 1312, 1312, - 1312, 1312, 1312, 1312, 1314, 1314, 1314, 1314, 1314, 1314, - - 1314, 1314, 1314, 1314, 1314, 1314, 1316, 1316, 1316, 1316, - 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1318, 1318, - 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, - 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, - 1320, 1320, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, - 1322, 1322, 1322, 1322, 1324, 1324, 1324, 1324, 1324, 1324, - 1324, 1324, 1324, 1324, 1324, 1324, 1326, 1326, 1326, 1326, - 1326, 1326, 1326, 1326, 1326, 1326, 1326, 1326, 1328, 1328, - 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1328, - 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, - - 1330, 1330, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, - 1332, 1332, 1332, 1332, 1334, 1334, 1334, 1334, 1334, 1334, - 1334, 1334, 1334, 1334, 1334, 1334, 1336, 1336, 1336, 1336, - 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1338, 1338, - 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, - 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, - 1340, 1340, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - 1342, 1342, 1342, 1342, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1346, 1346, 1346, 1346, - 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1348, 1348, - - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1350, 1350, 1350, 1350, 1350, 1350, 1350, 1350, 1350, 1350, - 1350, 1350, 1352, 1352, 1352, 1352, 1352, 1352, 1352, 1352, - 1352, 1352, 1352, 1352, 1354, 1354, 1354, 1354, 1354, 1354, - 1354, 1354, 1354, 1354, 1354, 1354, 1356, 1356, 1356, 1356, - 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1358, 1358, - 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, - 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, - 1360, 1360, 1362, 1362, 1362, 1362, 1362, 1362, 1362, 1362, - 1362, 1362, 1362, 1362, 1364, 1364, 1364, 1364, 1364, 1364, - - 1364, 1364, 1364, 1364, 1364, 1364, 1366, 1366, 1366, 1366, - 1366, 1366, 1366, 1366, 1366, 1366, 1366, 1366, 1368, 1368, - 1368, 1368, 1368, 1368, 1368, 1368, 1368, 1368, 1368, 1368, - 1370, 1370, 1370, 1370, 1370, 1370, 1370, 1370, 1370, 1370, - 1370, 1370, 1372, 1372, 1372, 1372, 1372, 1372, 1372, 1372, - 1372, 1372, 1372, 1372, 1374, 1374, 1374, 1374, 1374, 1374, - 1374, 1374, 1374, 1374, 1374, 1374, 1376, 1376, 1376, 1376, - 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1378, 1378, - 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, - 1380, 1380, 1380, 1380, 1380, 1380, 1380, 1380, 1380, 1380, - - 1380, 1380, 1382, 1382, 1382, 1382, 1382, 1382, 1382, 1382, - 1382, 1382, 1382, 1382, 1384, 1384, 1384, 1384, 1384, 1384, - 1384, 1384, 1384, 1384, 1384, 1384, 1386, 1386, 1386, 1386, - 1386, 1386, 1386, 1386, 1386, 1386, 1386, 1386, 1388, 1388, - 1388, 1388, 1388, 1388, 1388, 1388, 1388, 1388, 1388, 1388, - 1390, 1390, 1390, 1390, 1390, 1390, 1390, 1390, 1390, 1390, - 1390, 1390, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, - 1392, 1392, 1392, 1392, 1394, 1394, 1394, 1394, 1394, 1394, - 1394, 1394, 1394, 1394, 1394, 1394, 1396, 1396, 1396, 1396, - 1396, 1396, 1396, 1396, 1396, 1396, 1396, 1396, 1398, 1398, - - 1398, 1398, 1398, 1398, 1398, 1398, 1398, 1398, 1398, 1398, - 1400, 1400, 1400, 1400, 1400, 1400, 1400, 1400, 1400, 1400, - 1400, 1400, 1402, 1402, 1402, 1402, 1402, 1402, 1402, 1402, - 1402, 1402, 1402, 1402, 1404, 1404, 1404, 1404, 1404, 1404, - 1404, 1404, 1404, 1404, 1404, 1404, 1406, 1406, 1406, 1406, - 1406, 1406, 1406, 1406, 1406, 1406, 1406, 1406, 1408, 1408, - 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408, - 1410, 1410, 1410, 1410, 1410, 1410, 1410, 1410, 1410, 1410, - 1410, 1410, 1412, 1412, 1412, 1412, 1412, 1412, 1412, 1412, - 1412, 1412, 1412, 1412, 1414, 1414, 1414, 1414, 1414, 1414, - - 1414, 1414, 1414, 1414, 1414, 1414, 1416, 1416, 1416, 1416, - 1416, 1416, 1416, 1416, 1416, 1416, 1416, 1416, 1418, 1418, - 1418, 1418, 1418, 1418, 1418, 1418, 1418, 1418, 1418, 1418, - 1420, 1420, 1420, 1420, 1420, 1420, 1420, 1420, 1420, 1420, - 1420, 1420, 1422, 1422, 1422, 1422, 1422, 1422, 1422, 1422, - 1422, 1422, 1422, 1422, 1424, 1424, 1424, 1424, 1424, 1424, - 1424, 1424, 1424, 1424, 1424, 1424, 1426, 1426, 1426, 1426, - 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1428, 1428, - 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1428, - 1430, 1430, 1430, 1430, 1430, 1430, 1430, 1430, 1430, 1430, - - 1430, 1430, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1432, - 1432, 1432, 1432, 1432, 1434, 1434, 1434, 1434, 1434, 1434, - 1434, 1434, 1434, 1434, 1434, 1434, 1436, 1436, 1436, 1436, - 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1438, 1438, - 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, - 1440, 1440, 1442, 1442, 1442, 1442, 1442, 1442, 1442, 1442, - 1442, 1442, 1442, 1442, 1444, 1444, 1444, 1444, 1444, 1444, - 1444, 1444, 1444, 1444, 1444, 1444, 1446, 1446, 1446, 1446, - 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1448, 1448, - - 1448, 1448, 1448, 1448, 1448, 1448, 1448, 1448, 1448, 1448, - 1450, 1450, 1450, 1450, 1450, 1450, 1450, 1450, 1450, 1450, - 1450, 1450, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, - 1452, 1452, 1452, 1452, 1454, 1454, 1454, 1454, 1454, 1454, - 1454, 1454, 1454, 1454, 1454, 1454, 1456, 1456, 1456, 1456, - 1456, 1456, 1456, 1456, 1456, 1456, 1456, 1456, 1458, 1458, - 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, - 1460, 1460, 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1464, 1464, 1464, 1464, 1464, 1464, - - 1464, 1464, 1464, 1464, 1464, 1464, 1466, 1466, 1466, 1466, - 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1468, 1468, - 1468, 1468, 1468, 1468, 1468, 1468, 1468, 1468, 1468, 1468, - 1470, 1470, 1470, 1470, 1470, 1470, 1470, 1470, 1470, 1470, - 1470, 1470, 1472, 1472, 1472, 1472, 1472, 1472, 1472, 1472, - 1472, 1472, 1472, 1472, 1474, 1474, 1474, 1474, 1474, 1474, - 1474, 1474, 1474, 1474, 1474, 1474, 1476, 1476, 1476, 1476, - 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1478, 1478, - 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, - 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480, - - 1480, 1480, 1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482, - 1482, 1482, 1482, 1482, 1484, 1484, 1484, 1484, 1484, 1484, - 1484, 1484, 1484, 1484, 1484, 1484, 1486, 1486, 1486, 1486, - 1486, 1486, 1486, 1486, 1486, 1486, 1486, 1486, 1488, 1488, - 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, - 1490, 1490, 1490, 1490, 1490, 1490, 1490, 1490, 1490, 1490, - 1490, 1490, 660, 659, 658, 657, 656, 655, 654, 651, - 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, - 639, 638, 637, 636, 635, 634, 633, 632, 631, 630, - 625, 624, 620, 618, 617, 616, 615, 614, 613, 612, - - 611, 610, 609, 608, 607, 606, 605, 604, 603, 602, - 601, 600, 599, 598, 597, 596, 595, 594, 591, 590, - 589, 480, 588, 587, 584, 536, 583, 581, 580, 579, - 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, - 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, - 558, 557, 556, 555, 554, 553, 552, 484, 551, 550, - 549, 546, 545, 480, 544, 540, 539, 538, 535, 530, - 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, - 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, - 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, - - 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, - 489, 488, 487, 406, 483, 482, 481, 480, 479, 475, - 474, 473, 472, 471, 470, 469, 468, 457, 456, 455, - 454, 453, 452, 451, 450, 449, 448, 445, 444, 443, - 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, - 427, 426, 425, 424, 423, 420, 419, 418, 417, 416, - 310, 415, 414, 413, 412, 411, 408, 314, 406, 405, - 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, - 292, 393, 392, 391, 256, 235, 223, 365, 364, 363, - 362, 361, 360, 359, 358, 357, 354, 351, 350, 349, - - 345, 344, 343, 342, 341, 338, 337, 336, 335, 334, - 333, 330, 325, 324, 323, 322, 321, 313, 312, 309, - 304, 303, 302, 301, 300, 299, 298, 297, 294, 288, - 287, 285, 120, 284, 282, 282, 281, 278, 277, 270, - 256, 235, 223, 220, 219, 218, 211, 208, 207, 206, - 201, 177, 175, 174, 165, 150, 126, 120, 1492, 112, - 112, 111, 111, 29, 29, 27, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492 - } ; - -static yyconst short int yy_chk[9029] = - { 0, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 5, 6, 5, 6, 7, 8, 36, 36, - 25, 25, 26, 26, 37, 43, 25, 1014, 26, 31, - 31, 31, 38, 43, 43, 5, 6, 7, 8, 37, - 137, 7, 8, 25, 25, 26, 26, 42, 44, 44, - - 38, 45, 68, 44, 49, 68, 45, 42, 137, 49, - 49, 49, 45, 50, 50, 1016, 5, 6, 7, 8, - 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, 9, 9, - 9, 9, 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, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - - 15, 15, 15, 15, 15, 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, 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, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 29, 33, 46, 33, 46, 46, 47, 1018, 47, 47, - 51, 51, 70, 56, 57, 70, 72, 58, 29, 57, - 1020, 72, 46, 59, 33, 56, 47, 59, 58, 56, - 56, 58, 57, 59, 61, 71, 77, 107, 107, 60, - 61, 46, 79, 29, 64, 71, 61, 84, 60, 60, - 60, 64, 64, 97, 97, 33, 39, 64, 60, 57, - 60, 108, 108, 79, 120, 1022, 123, 187, 84, 125, - - 125, 125, 77, 97, 107, 134, 134, 113, 113, 120, - 142, 187, 120, 113, 167, 167, 142, 1024, 39, 39, - 123, 39, 189, 39, 79, 189, 39, 174, 174, 84, - 113, 113, 39, 186, 186, 39, 39, 120, 39, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - - 81, 83, 88, 83, 183, 129, 197, 129, 156, 156, - 1026, 161, 161, 162, 209, 162, 162, 197, 211, 317, - 209, 211, 183, 88, 83, 204, 156, 88, 129, 161, - 163, 317, 163, 162, 177, 163, 163, 177, 231, 177, - 1028, 204, 204, 177, 177, 269, 269, 273, 273, 231, - 275, 275, 306, 306, 88, 83, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - - 92, 92, 92, 92, 93, 164, 164, 268, 268, 304, - 304, 304, 307, 307, 330, 330, 381, 381, 352, 164, - 164, 164, 164, 164, 164, 93, 352, 268, 93, 1030, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 95, - 127, 131, 127, 131, 182, 223, 182, 224, 226, 224, - 226, 227, 229, 236, 229, 240, 1032, 247, 247, 1034, - 95, 1036, 247, 127, 131, 1038, 223, 182, 305, 305, - 224, 226, 227, 1040, 236, 229, 240, 366, 236, 366, - 240, 368, 234, 247, 234, 476, 305, 404, 404, 404, - 480, 95, 368, 1042, 127, 131, 476, 223, 182, 1044, - 366, 480, 226, 227, 230, 234, 230, 230, 230, 230, - 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, - - 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, - 230, 230, 230, 235, 238, 239, 234, 243, 252, 252, - 258, 258, 1046, 252, 371, 258, 260, 260, 337, 1048, - 337, 260, 1050, 337, 235, 238, 239, 539, 243, 238, - 274, 274, 243, 337, 252, 371, 258, 337, 539, 371, - 407, 407, 260, 1052, 274, 274, 274, 274, 274, 274, - 469, 469, 469, 486, 486, 235, 238, 239, 241, 243, - 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, - 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, - 241, 241, 241, 241, 241, 241, 241, 250, 284, 255, - - 262, 265, 266, 279, 279, 289, 1054, 289, 370, 279, - 370, 372, 383, 284, 374, 374, 284, 387, 250, 374, - 255, 262, 265, 266, 1056, 1058, 279, 279, 289, 308, - 308, 370, 372, 383, 378, 378, 372, 1060, 387, 378, - 374, 284, 1062, 308, 308, 308, 308, 308, 308, 250, - 253, 255, 262, 265, 266, 541, 547, 550, 1064, 289, - 378, 585, 370, 372, 383, 1066, 541, 547, 550, 387, - 1068, 253, 585, 1070, 253, 1072, 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, 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, 254, 254, 254, - 254, 254, 254, 254, 254, 259, 259, 382, 382, 384, - 384, 587, 382, 590, 384, 584, 584, 584, 591, 592, - 622, 624, 587, 1074, 590, 1076, 1078, 1080, 1082, 591, - 592, 622, 624, 382, 259, 384, 259, 259, 259, 259, - - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 290, 382, 290, 290, 290, 290, 290, - 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, - 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, - 290, 290, 375, 375, 385, 385, 389, 389, 625, 385, - 1084, 1086, 1088, 1090, 1092, 1094, 1096, 1098, 626, 625, - 389, 389, 389, 389, 389, 389, 621, 621, 621, 626, - 385, 375, 1100, 375, 375, 375, 375, 375, 375, 375, - 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, - - 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, - 380, 380, 628, 380, 1102, 1104, 1106, 1108, 1110, 621, - 1112, 1114, 380, 628, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - 388, 391, 399, 458, 458, 460, 460, 464, 458, 473, - 460, 466, 1116, 399, 1118, 1120, 391, 463, 463, 391, - 473, 388, 463, 1122, 468, 465, 465, 1124, 464, 458, - 465, 460, 466, 1126, 1128, 532, 532, 1130, 399, 468, - 532, 1132, 468, 463, 391, 473, 630, 630, 630, 1134, - - 1136, 465, 388, 461, 461, 533, 533, 1138, 1140, 464, - 533, 532, 1142, 466, 1144, 1146, 1148, 468, 1150, 1152, - 630, 1154, 1156, 1158, 463, 1160, 1162, 1164, 1166, 1168, - 1170, 533, 461, 1172, 461, 461, 461, 461, 461, 461, - 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, - 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, - 461, 535, 533, 583, 1174, 620, 1176, 651, 653, 653, - 653, 668, 680, 687, 1178, 1180, 535, 1182, 583, 535, - 620, 583, 651, 620, 694, 651, 668, 680, 687, 668, - 680, 687, 653, 1184, 698, 1186, 707, 707, 707, 694, - - 1188, 1190, 694, 702, 535, 706, 583, 709, 620, 698, - 651, 1192, 698, 1194, 668, 680, 687, 1196, 702, 707, - 706, 702, 709, 706, 713, 709, 1198, 694, 710, 710, - 710, 711, 711, 711, 1200, 711, 1202, 698, 719, 713, - 711, 1204, 713, 714, 714, 714, 702, 714, 706, 1206, - 709, 710, 714, 719, 724, 729, 719, 1208, 727, 727, - 727, 732, 732, 732, 1210, 735, 1212, 713, 1214, 724, - 729, 737, 724, 729, 1216, 1218, 739, 741, 711, 1220, - 735, 719, 727, 735, 743, 732, 737, 1222, 745, 737, - 714, 739, 741, 1224, 739, 741, 1226, 724, 729, 743, - - 747, 1228, 743, 745, 1230, 1232, 745, 749, 735, 1234, - 1236, 751, 1238, 1240, 737, 747, 1242, 753, 747, 739, - 741, 755, 749, 757, 1244, 749, 751, 743, 1246, 751, - 759, 745, 753, 1248, 761, 753, 755, 1250, 757, 755, - 763, 757, 1252, 747, 765, 759, 1254, 1256, 759, 761, - 749, 1258, 761, 767, 751, 763, 1260, 769, 763, 765, - 753, 771, 765, 773, 755, 1262, 757, 775, 767, 1264, - 1266, 767, 769, 759, 777, 769, 771, 761, 773, 771, - 779, 773, 775, 763, 781, 775, 1268, 765, 1270, 777, - 783, 1272, 777, 1274, 785, 779, 767, 1276, 779, 781, - - 769, 787, 781, 789, 771, 783, 773, 791, 783, 785, - 775, 793, 785, 795, 1278, 1280, 787, 777, 789, 787, - 797, 789, 791, 779, 799, 791, 793, 781, 795, 793, - 801, 795, 1282, 783, 803, 797, 1284, 785, 797, 799, - 805, 1286, 799, 1288, 787, 801, 789, 807, 801, 803, - 791, 809, 803, 811, 793, 805, 795, 813, 805, 1290, - 1292, 815, 807, 797, 1294, 807, 809, 799, 811, 809, - 817, 811, 813, 801, 819, 813, 815, 803, 1296, 815, - 821, 1298, 1300, 805, 823, 817, 1302, 1304, 817, 819, - 807, 825, 819, 827, 809, 821, 811, 829, 821, 823, - - 813, 831, 823, 833, 815, 1306, 825, 835, 827, 825, - 1308, 827, 829, 817, 837, 829, 831, 819, 833, 831, - 839, 833, 835, 821, 841, 835, 1310, 823, 1312, 837, - 843, 1314, 837, 1316, 825, 839, 827, 845, 839, 841, - 829, 847, 841, 849, 831, 843, 833, 851, 843, 1318, - 835, 853, 845, 855, 1320, 845, 847, 837, 849, 847, - 857, 849, 851, 839, 859, 851, 853, 841, 855, 853, - 861, 855, 1322, 843, 863, 857, 1324, 1326, 857, 859, - 845, 1328, 859, 865, 847, 861, 849, 867, 861, 863, - 851, 869, 863, 871, 853, 1330, 855, 873, 865, 1332, - - 1334, 865, 867, 857, 875, 867, 869, 859, 871, 869, - 877, 871, 873, 861, 879, 873, 1336, 863, 1338, 875, - 881, 1340, 875, 1342, 883, 877, 865, 1344, 877, 879, - 867, 885, 879, 887, 869, 881, 871, 889, 881, 883, - 873, 891, 883, 893, 1346, 1348, 885, 875, 887, 885, - 895, 887, 889, 877, 897, 889, 891, 879, 893, 891, - 899, 893, 1350, 881, 901, 895, 1352, 883, 895, 897, - 903, 1354, 897, 1356, 885, 899, 887, 905, 899, 901, - 889, 907, 901, 909, 891, 903, 893, 911, 903, 1358, - 1360, 913, 905, 895, 1362, 905, 907, 897, 909, 907, - - 915, 909, 911, 899, 917, 911, 913, 901, 1364, 913, - 919, 1366, 1368, 903, 921, 915, 1370, 1372, 915, 917, - 905, 923, 917, 925, 907, 919, 909, 927, 919, 921, - 911, 929, 921, 931, 913, 1374, 923, 933, 925, 923, - 1376, 925, 927, 915, 935, 927, 929, 917, 931, 929, - 937, 931, 933, 919, 939, 933, 1378, 921, 1380, 935, - 941, 1382, 935, 1384, 923, 937, 925, 943, 937, 939, - 927, 945, 939, 947, 929, 941, 931, 949, 941, 1386, - 933, 951, 943, 953, 1388, 943, 945, 935, 947, 945, - 955, 947, 949, 937, 957, 949, 951, 939, 953, 951, - - 959, 953, 1390, 941, 961, 955, 1392, 1394, 955, 957, - 943, 1396, 957, 963, 945, 959, 947, 965, 959, 961, - 949, 967, 961, 969, 951, 1398, 953, 971, 963, 1400, - 1402, 963, 965, 955, 973, 965, 967, 957, 969, 967, - 975, 969, 971, 959, 977, 971, 1404, 961, 1406, 973, - 979, 1408, 973, 1410, 981, 975, 963, 1412, 975, 977, - 965, 983, 977, 985, 967, 979, 969, 987, 979, 981, - 971, 989, 981, 991, 1414, 1416, 983, 973, 985, 983, - 993, 985, 987, 975, 995, 987, 989, 977, 991, 989, - 997, 991, 1418, 979, 999, 993, 1420, 981, 993, 995, - - 1001, 1422, 995, 1424, 983, 997, 985, 1003, 997, 999, - 987, 1005, 999, 1007, 989, 1001, 991, 1009, 1001, 1426, - 1428, 1011, 1003, 993, 1430, 1003, 1005, 995, 1007, 1005, - 1013, 1007, 1009, 997, 1015, 1009, 1011, 999, 1432, 1011, - 1017, 1434, 1436, 1001, 1019, 1013, 1438, 1440, 1013, 1015, - 1003, 1021, 1015, 1023, 1005, 1017, 1007, 1025, 1017, 1019, - 1009, 1027, 1019, 1029, 1011, 1442, 1021, 1031, 1023, 1021, - 1444, 1023, 1025, 1013, 1033, 1025, 1027, 1015, 1029, 1027, - 1035, 1029, 1031, 1017, 1037, 1031, 1446, 1019, 1448, 1033, - 1039, 1450, 1033, 1452, 1021, 1035, 1023, 1041, 1035, 1037, - - 1025, 1043, 1037, 1045, 1027, 1039, 1029, 1047, 1039, 1454, - 1031, 1049, 1041, 1051, 1456, 1041, 1043, 1033, 1045, 1043, - 1053, 1045, 1047, 1035, 1055, 1047, 1049, 1037, 1051, 1049, - 1057, 1051, 1458, 1039, 1059, 1053, 1460, 1462, 1053, 1055, - 1041, 1464, 1055, 1061, 1043, 1057, 1045, 1063, 1057, 1059, - 1047, 1065, 1059, 1067, 1049, 1466, 1051, 1069, 1061, 1468, - 1470, 1061, 1063, 1053, 1071, 1063, 1065, 1055, 1067, 1065, - 1073, 1067, 1069, 1057, 1075, 1069, 1472, 1059, 1474, 1071, - 1077, 1476, 1071, 1478, 1079, 1073, 1061, 1480, 1073, 1075, - 1063, 1081, 1075, 1083, 1065, 1077, 1067, 1085, 1077, 1079, - - 1069, 1087, 1079, 1089, 1482, 1484, 1081, 1071, 1083, 1081, - 1091, 1083, 1085, 1073, 1093, 1085, 1087, 1075, 1089, 1087, - 1095, 1089, 1486, 1077, 1097, 1091, 1488, 1079, 1091, 1093, - 1099, 1502, 1093, 1526, 1081, 1095, 1083, 1101, 1095, 1097, - 1085, 1103, 1097, 1105, 1087, 1099, 1089, 1107, 1099, 1012, - 1010, 1109, 1101, 1091, 1008, 1101, 1103, 1093, 1105, 1103, - 1111, 1105, 1107, 1095, 1113, 1107, 1109, 1097, 1006, 1109, - 1115, 1004, 1002, 1099, 1117, 1111, 1000, 998, 1111, 1113, - 1101, 1119, 1113, 1121, 1103, 1115, 1105, 1123, 1115, 1117, - 1107, 1125, 1117, 1127, 1109, 996, 1119, 1129, 1121, 1119, - - 994, 1121, 1123, 1111, 1131, 1123, 1125, 1113, 1127, 1125, - 1133, 1127, 1129, 1115, 1135, 1129, 992, 1117, 990, 1131, - 1137, 988, 1131, 986, 1119, 1133, 1121, 1139, 1133, 1135, - 1123, 1141, 1135, 1143, 1125, 1137, 1127, 1145, 1137, 984, - 1129, 1147, 1139, 1149, 982, 1139, 1141, 1131, 1143, 1141, - 1151, 1143, 1145, 1133, 1153, 1145, 1147, 1135, 1149, 1147, - 1155, 1149, 980, 1137, 1157, 1151, 978, 976, 1151, 1153, - 1139, 974, 1153, 1159, 1141, 1155, 1143, 1161, 1155, 1157, - 1145, 1163, 1157, 1165, 1147, 972, 1149, 1167, 1159, 970, - 968, 1159, 1161, 1151, 1169, 1161, 1163, 1153, 1165, 1163, - - 1171, 1165, 1167, 1155, 1173, 1167, 966, 1157, 964, 1169, - 1175, 962, 1169, 960, 1177, 1171, 1159, 958, 1171, 1173, - 1161, 1179, 1173, 1181, 1163, 1175, 1165, 1183, 1175, 1177, - 1167, 1185, 1177, 1187, 956, 954, 1179, 1169, 1181, 1179, - 1189, 1181, 1183, 1171, 1191, 1183, 1185, 1173, 1187, 1185, - 1193, 1187, 952, 1175, 1195, 1189, 950, 1177, 1189, 1191, - 1197, 948, 1191, 946, 1179, 1193, 1181, 1199, 1193, 1195, - 1183, 1201, 1195, 1203, 1185, 1197, 1187, 1205, 1197, 944, - 942, 1207, 1199, 1189, 940, 1199, 1201, 1191, 1203, 1201, - 1209, 1203, 1205, 1193, 1211, 1205, 1207, 1195, 938, 1207, - - 1213, 936, 934, 1197, 1215, 1209, 932, 930, 1209, 1211, - 1199, 1217, 1211, 1219, 1201, 1213, 1203, 1221, 1213, 1215, - 1205, 1223, 1215, 1225, 1207, 928, 1217, 1227, 1219, 1217, - 926, 1219, 1221, 1209, 1229, 1221, 1223, 1211, 1225, 1223, - 1231, 1225, 1227, 1213, 1233, 1227, 924, 1215, 922, 1229, - 1235, 920, 1229, 918, 1217, 1231, 1219, 1237, 1231, 1233, - 1221, 1239, 1233, 1241, 1223, 1235, 1225, 1243, 1235, 916, - 1227, 1245, 1237, 1247, 914, 1237, 1239, 1229, 1241, 1239, - 1249, 1241, 1243, 1231, 1251, 1243, 1245, 1233, 1247, 1245, - 1253, 1247, 912, 1235, 1255, 1249, 910, 908, 1249, 1251, - - 1237, 906, 1251, 1257, 1239, 1253, 1241, 1259, 1253, 1255, - 1243, 1261, 1255, 1263, 1245, 904, 1247, 1265, 1257, 902, - 900, 1257, 1259, 1249, 1267, 1259, 1261, 1251, 1263, 1261, - 1269, 1263, 1265, 1253, 1271, 1265, 898, 1255, 896, 1267, - 1273, 894, 1267, 892, 1275, 1269, 1257, 890, 1269, 1271, - 1259, 1277, 1271, 1279, 1261, 1273, 1263, 1281, 1273, 1275, - 1265, 1283, 1275, 1285, 888, 886, 1277, 1267, 1279, 1277, - 1287, 1279, 1281, 1269, 1289, 1281, 1283, 1271, 1285, 1283, - 1291, 1285, 884, 1273, 1293, 1287, 882, 1275, 1287, 1289, - 1295, 880, 1289, 878, 1277, 1291, 1279, 1297, 1291, 1293, - - 1281, 1299, 1293, 1301, 1283, 1295, 1285, 1303, 1295, 876, - 874, 1305, 1297, 1287, 872, 1297, 1299, 1289, 1301, 1299, - 1307, 1301, 1303, 1291, 1309, 1303, 1305, 1293, 870, 1305, - 1311, 868, 866, 1295, 1313, 1307, 864, 862, 1307, 1309, - 1297, 1315, 1309, 1317, 1299, 1311, 1301, 1319, 1311, 1313, - 1303, 1321, 1313, 1323, 1305, 860, 1315, 1325, 1317, 1315, - 858, 1317, 1319, 1307, 1327, 1319, 1321, 1309, 1323, 1321, - 1329, 1323, 1325, 1311, 1331, 1325, 856, 1313, 854, 1327, - 1333, 852, 1327, 850, 1315, 1329, 1317, 1335, 1329, 1331, - 1319, 1337, 1331, 1339, 1321, 1333, 1323, 1341, 1333, 848, - - 1325, 1343, 1335, 1345, 846, 1335, 1337, 1327, 1339, 1337, - 1347, 1339, 1341, 1329, 1349, 1341, 1343, 1331, 1345, 1343, - 1351, 1345, 844, 1333, 1353, 1347, 842, 840, 1347, 1349, - 1335, 838, 1349, 1355, 1337, 1351, 1339, 1357, 1351, 1353, - 1341, 1359, 1353, 1361, 1343, 836, 1345, 1363, 1355, 834, - 832, 1355, 1357, 1347, 1365, 1357, 1359, 1349, 1361, 1359, - 1367, 1361, 1363, 1351, 1369, 1363, 830, 1353, 828, 1365, - 1371, 826, 1365, 824, 1373, 1367, 1355, 822, 1367, 1369, - 1357, 1375, 1369, 1377, 1359, 1371, 1361, 1379, 1371, 1373, - 1363, 1381, 1373, 1383, 820, 818, 1375, 1365, 1377, 1375, - - 1385, 1377, 1379, 1367, 1387, 1379, 1381, 1369, 1383, 1381, - 1389, 1383, 816, 1371, 1391, 1385, 814, 1373, 1385, 1387, - 1393, 812, 1387, 810, 1375, 1389, 1377, 1395, 1389, 1391, - 1379, 1397, 1391, 1399, 1381, 1393, 1383, 1401, 1393, 808, - 806, 1403, 1395, 1385, 804, 1395, 1397, 1387, 1399, 1397, - 1405, 1399, 1401, 1389, 1407, 1401, 1403, 1391, 802, 1403, - 1409, 800, 798, 1393, 1411, 1405, 796, 794, 1405, 1407, - 1395, 1413, 1407, 1415, 1397, 1409, 1399, 1417, 1409, 1411, - 1401, 1419, 1411, 1421, 1403, 792, 1413, 1423, 1415, 1413, - 790, 1415, 1417, 1405, 1425, 1417, 1419, 1407, 1421, 1419, - - 1427, 1421, 1423, 1409, 1429, 1423, 788, 1411, 786, 1425, - 1431, 784, 1425, 782, 1413, 1427, 1415, 1433, 1427, 1429, - 1417, 1435, 1429, 1437, 1419, 1431, 1421, 1439, 1431, 780, - 1423, 1441, 1433, 1443, 778, 1433, 1435, 1425, 1437, 1435, - 1445, 1437, 1439, 1427, 1447, 1439, 1441, 1429, 1443, 1441, - 1449, 1443, 776, 1431, 1451, 1445, 774, 772, 1445, 1447, - 1433, 770, 1447, 1453, 1435, 1449, 1437, 1455, 1449, 1451, - 1439, 1457, 1451, 1459, 1441, 768, 1443, 1461, 1453, 766, - 764, 1453, 1455, 1445, 1463, 1455, 1457, 1447, 1459, 1457, - 1465, 1459, 1461, 1449, 1467, 1461, 762, 1451, 760, 1463, - - 1469, 758, 1463, 756, 1471, 1465, 1453, 754, 1465, 1467, - 1455, 1473, 1467, 1475, 1457, 1469, 1459, 1477, 1469, 1471, - 1461, 1479, 1471, 1481, 752, 750, 1473, 1463, 1475, 1473, - 1483, 1475, 1477, 1465, 1485, 1477, 1479, 1467, 1481, 1479, - 1487, 1481, 748, 1469, 1489, 1483, 746, 1471, 1483, 1485, - 1491, 744, 1485, 742, 1473, 1487, 1475, 740, 1487, 1489, - 1477, 738, 1489, 736, 1479, 1491, 1481, 734, 1491, 731, - 730, 728, 726, 1483, 725, 723, 722, 1485, 721, 720, - 718, 717, 716, 1487, 715, 712, 708, 1489, 705, 703, - 701, 700, 699, 1491, 1493, 1493, 1493, 1493, 1493, 1493, - - 1493, 1493, 1493, 1493, 1493, 1493, 1494, 1494, 1494, 1494, - 1494, 1494, 1494, 1494, 1494, 1494, 1494, 1494, 1495, 1495, - 1495, 1495, 1495, 1495, 1495, 1495, 1495, 1495, 1495, 1495, - 1496, 1496, 1496, 1496, 1496, 1496, 1496, 1496, 1496, 1496, - 1496, 1496, 1497, 1497, 1497, 1497, 1497, 1497, 1497, 1497, - 1497, 1497, 1497, 1497, 1498, 1498, 1498, 1498, 1498, 1498, - 1498, 1498, 1498, 1498, 1498, 1498, 1499, 1499, 1499, 1499, - 1499, 1499, 1499, 1499, 1499, 1499, 1499, 1499, 1500, 1500, - 1500, 1500, 1500, 1500, 1500, 1500, 697, 1500, 1500, 1500, - 1501, 1501, 1501, 1501, 1501, 1501, 1501, 1501, 1501, 1501, - - 1501, 1501, 1503, 1503, 1503, 1503, 1503, 1503, 1503, 1503, - 1503, 1503, 1503, 1503, 1504, 696, 695, 1504, 1505, 1505, - 1505, 693, 1505, 1505, 1505, 1505, 1505, 1505, 1505, 1505, - 1506, 1506, 1506, 1506, 1506, 1506, 1506, 1506, 1506, 1506, - 690, 1506, 1507, 688, 686, 685, 1507, 1507, 684, 1507, - 1508, 683, 682, 1508, 1509, 681, 679, 1509, 1510, 1510, - 1510, 1510, 678, 1510, 1510, 1510, 1510, 1510, 1510, 1510, - 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - 1511, 1511, 1512, 1512, 1512, 1512, 1512, 1512, 1512, 1512, - 1512, 1512, 1512, 1512, 1513, 1513, 1513, 1513, 1513, 1513, - - 1513, 1513, 1513, 676, 1513, 1514, 671, 670, 1514, 1515, - 1515, 1515, 1515, 1515, 1515, 1515, 1515, 1515, 669, 1515, - 1516, 1516, 667, 666, 1516, 1517, 1517, 1517, 1517, 1517, - 1517, 1517, 1517, 1517, 663, 1517, 1518, 1518, 1518, 1518, - 1518, 1518, 1518, 1518, 1518, 662, 1518, 1519, 1519, 1519, - 1519, 1519, 1519, 1519, 1519, 1519, 661, 1519, 1520, 1520, - 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1520, - 1521, 659, 658, 657, 656, 655, 652, 650, 1521, 1522, - 1522, 1522, 1522, 1522, 1522, 1522, 1522, 1522, 649, 1522, - 1523, 1523, 1523, 1523, 1523, 1523, 1523, 1523, 1523, 1523, - - 1523, 1523, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 1524, - 1524, 1524, 1524, 1524, 1525, 648, 647, 646, 1525, 645, - 644, 1525, 1527, 1527, 1527, 1527, 1527, 1527, 1527, 1527, - 1527, 1527, 1527, 1527, 1528, 1528, 1528, 1528, 1528, 1528, - 1528, 1528, 1528, 1528, 1528, 1528, 1529, 1529, 1529, 1529, - 1529, 1529, 1529, 1529, 1529, 1529, 1529, 1529, 1530, 1530, - 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1530, - 1531, 1531, 1531, 1531, 1531, 1531, 1531, 1531, 1531, 1531, - 1531, 1531, 1532, 1532, 1532, 1532, 1532, 1532, 1532, 1532, - 1532, 1532, 1532, 1532, 1533, 1533, 1533, 1533, 1533, 1533, - - 1533, 1533, 1533, 1533, 1533, 1533, 1534, 1534, 1534, 1534, - 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1535, 1535, - 1535, 1535, 1535, 1535, 1535, 1535, 1535, 1535, 1535, 1535, - 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, - 1536, 1536, 1537, 1537, 1537, 1537, 1537, 1537, 1537, 1537, - 1537, 1537, 1537, 1537, 1538, 1538, 1538, 1538, 1538, 1538, - 1538, 1538, 1538, 1538, 1538, 1538, 1539, 1539, 1539, 1539, - 1539, 1539, 1539, 1539, 1539, 1539, 1539, 1539, 1540, 1540, - 1540, 1540, 1540, 1540, 1540, 1540, 1540, 1540, 1540, 1540, - 1541, 1541, 1541, 1541, 1541, 1541, 1541, 1541, 1541, 1541, - - 1541, 1541, 1542, 1542, 1542, 1542, 1542, 1542, 1542, 1542, - 1542, 1542, 1542, 1542, 1543, 1543, 1543, 1543, 1543, 1543, - 1543, 1543, 1543, 1543, 1543, 1543, 1544, 1544, 1544, 1544, - 1544, 1544, 1544, 1544, 1544, 1544, 1544, 1544, 1545, 1545, - 1545, 1545, 1545, 1545, 1545, 1545, 1545, 1545, 1545, 1545, - 1546, 1546, 1546, 1546, 1546, 1546, 1546, 1546, 1546, 1546, - 1546, 1546, 1547, 1547, 1547, 1547, 1547, 1547, 1547, 1547, - 1547, 1547, 1547, 1547, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1549, 1549, 1549, 1549, - 1549, 1549, 1549, 1549, 1549, 1549, 1549, 1549, 1550, 1550, - - 1550, 1550, 1550, 1550, 1550, 1550, 1550, 1550, 1550, 1550, - 1551, 1551, 1551, 1551, 1551, 1551, 1551, 1551, 1551, 1551, - 1551, 1551, 1552, 1552, 1552, 1552, 1552, 1552, 1552, 1552, - 1552, 1552, 1552, 1552, 1553, 1553, 1553, 1553, 1553, 1553, - 1553, 1553, 1553, 1553, 1553, 1553, 1554, 1554, 1554, 1554, - 1554, 1554, 1554, 1554, 1554, 1554, 1554, 1554, 1555, 1555, - 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1555, - 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, - 1556, 1556, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1557, - 1557, 1557, 1557, 1557, 1558, 1558, 1558, 1558, 1558, 1558, - - 1558, 1558, 1558, 1558, 1558, 1558, 1559, 1559, 1559, 1559, - 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1560, 1560, - 1560, 1560, 1560, 1560, 1560, 1560, 1560, 1560, 1560, 1560, - 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, - 1561, 1561, 1562, 1562, 1562, 1562, 1562, 1562, 1562, 1562, - 1562, 1562, 1562, 1562, 1563, 1563, 1563, 1563, 1563, 1563, - 1563, 1563, 1563, 1563, 1563, 1563, 1564, 1564, 1564, 1564, - 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1565, 1565, - 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, - 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - - 1566, 1566, 1567, 1567, 1567, 1567, 1567, 1567, 1567, 1567, - 1567, 1567, 1567, 1567, 1568, 1568, 1568, 1568, 1568, 1568, - 1568, 1568, 1568, 1568, 1568, 1568, 1569, 1569, 1569, 1569, - 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1570, 1570, - 1570, 1570, 1570, 1570, 1570, 1570, 1570, 1570, 1570, 1570, - 1571, 1571, 1571, 1571, 1571, 1571, 1571, 1571, 1571, 1571, - 1571, 1571, 1572, 1572, 1572, 1572, 1572, 1572, 1572, 1572, - 1572, 1572, 1572, 1572, 1573, 1573, 1573, 1573, 1573, 1573, - 1573, 1573, 1573, 1573, 1573, 1573, 1574, 1574, 1574, 1574, - 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1575, 1575, - - 1575, 1575, 1575, 1575, 1575, 1575, 1575, 1575, 1575, 1575, - 1576, 1576, 1576, 1576, 1576, 1576, 1576, 1576, 1576, 1576, - 1576, 1576, 1577, 1577, 1577, 1577, 1577, 1577, 1577, 1577, - 1577, 1577, 1577, 1577, 1578, 1578, 1578, 1578, 1578, 1578, - 1578, 1578, 1578, 1578, 1578, 1578, 1579, 1579, 1579, 1579, - 1579, 1579, 1579, 1579, 1579, 1579, 1579, 1579, 1580, 1580, - 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, - 1581, 1581, 1581, 1581, 1581, 1581, 1581, 1581, 1581, 1581, - 1581, 1581, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, - 1582, 1582, 1582, 1582, 1583, 1583, 1583, 1583, 1583, 1583, - - 1583, 1583, 1583, 1583, 1583, 1583, 1584, 1584, 1584, 1584, - 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1585, 1585, - 1585, 1585, 1585, 1585, 1585, 1585, 1585, 1585, 1585, 1585, - 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, - 1586, 1586, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, - 1587, 1587, 1587, 1587, 1588, 1588, 1588, 1588, 1588, 1588, - 1588, 1588, 1588, 1588, 1588, 1588, 1589, 1589, 1589, 1589, - 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1590, 1590, - 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, 1590, - 1591, 1591, 1591, 1591, 1591, 1591, 1591, 1591, 1591, 1591, - - 1591, 1591, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - 1592, 1592, 1592, 1592, 1593, 1593, 1593, 1593, 1593, 1593, - 1593, 1593, 1593, 1593, 1593, 1593, 1594, 1594, 1594, 1594, - 1594, 1594, 1594, 1594, 1594, 1594, 1594, 1594, 1595, 1595, - 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, - 1596, 1596, 1596, 1596, 1596, 1596, 1596, 1596, 1596, 1596, - 1596, 1596, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, - 1597, 1597, 1597, 1597, 1598, 1598, 1598, 1598, 1598, 1598, - 1598, 1598, 1598, 1598, 1598, 1598, 1599, 1599, 1599, 1599, - 1599, 1599, 1599, 1599, 1599, 1599, 1599, 1599, 1600, 1600, - - 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, - 1601, 1601, 1601, 1601, 1601, 1601, 1601, 1601, 1601, 1601, - 1601, 1601, 1602, 1602, 1602, 1602, 1602, 1602, 1602, 1602, - 1602, 1602, 1602, 1602, 1603, 1603, 1603, 1603, 1603, 1603, - 1603, 1603, 1603, 1603, 1603, 1603, 1604, 1604, 1604, 1604, - 1604, 1604, 1604, 1604, 1604, 1604, 1604, 1604, 1605, 1605, - 1605, 1605, 1605, 1605, 1605, 1605, 1605, 1605, 1605, 1605, - 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - 1606, 1606, 1607, 1607, 1607, 1607, 1607, 1607, 1607, 1607, - 1607, 1607, 1607, 1607, 1608, 1608, 1608, 1608, 1608, 1608, - - 1608, 1608, 1608, 1608, 1608, 1608, 1609, 1609, 1609, 1609, - 1609, 1609, 1609, 1609, 1609, 1609, 1609, 1609, 1610, 1610, - 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, - 1611, 1611, 1611, 1611, 1611, 1611, 1611, 1611, 1611, 1611, - 1611, 1611, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612, - 1612, 1612, 1612, 1612, 1613, 1613, 1613, 1613, 1613, 1613, - 1613, 1613, 1613, 1613, 1613, 1613, 1614, 1614, 1614, 1614, - 1614, 1614, 1614, 1614, 1614, 1614, 1614, 1614, 1615, 1615, - 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, - 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, - - 1616, 1616, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, - 1617, 1617, 1617, 1617, 1618, 1618, 1618, 1618, 1618, 1618, - 1618, 1618, 1618, 1618, 1618, 1618, 1619, 1619, 1619, 1619, - 1619, 1619, 1619, 1619, 1619, 1619, 1619, 1619, 1620, 1620, - 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, - 1621, 1621, 1621, 1621, 1621, 1621, 1621, 1621, 1621, 1621, - 1621, 1621, 1622, 1622, 1622, 1622, 1622, 1622, 1622, 1622, - 1622, 1622, 1622, 1622, 1623, 1623, 1623, 1623, 1623, 1623, - 1623, 1623, 1623, 1623, 1623, 1623, 1624, 1624, 1624, 1624, - 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1625, 1625, - - 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, - 1626, 1626, 1626, 1626, 1626, 1626, 1626, 1626, 1626, 1626, - 1626, 1626, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, - 1627, 1627, 1627, 1627, 1628, 1628, 1628, 1628, 1628, 1628, - 1628, 1628, 1628, 1628, 1628, 1628, 1629, 1629, 1629, 1629, - 1629, 1629, 1629, 1629, 1629, 1629, 1629, 1629, 1630, 1630, - 1630, 1630, 1630, 1630, 1630, 1630, 1630, 1630, 1630, 1630, - 1631, 1631, 1631, 1631, 1631, 1631, 1631, 1631, 1631, 1631, - 1631, 1631, 1632, 1632, 1632, 1632, 1632, 1632, 1632, 1632, - 1632, 1632, 1632, 1632, 1633, 1633, 1633, 1633, 1633, 1633, - - 1633, 1633, 1633, 1633, 1633, 1633, 1634, 1634, 1634, 1634, - 1634, 1634, 1634, 1634, 1634, 1634, 1634, 1634, 1635, 1635, - 1635, 1635, 1635, 1635, 1635, 1635, 1635, 1635, 1635, 1635, - 1636, 1636, 1636, 1636, 1636, 1636, 1636, 1636, 1636, 1636, - 1636, 1636, 1637, 1637, 1637, 1637, 1637, 1637, 1637, 1637, - 1637, 1637, 1637, 1637, 1638, 1638, 1638, 1638, 1638, 1638, - 1638, 1638, 1638, 1638, 1638, 1638, 1639, 1639, 1639, 1639, - 1639, 1639, 1639, 1639, 1639, 1639, 1639, 1639, 1640, 1640, - 1640, 1640, 1640, 1640, 1640, 1640, 1640, 1640, 1640, 1640, - 1641, 1641, 1641, 1641, 1641, 1641, 1641, 1641, 1641, 1641, - - 1641, 1641, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, - 1642, 1642, 1642, 1642, 1643, 1643, 1643, 1643, 1643, 1643, - 1643, 1643, 1643, 1643, 1643, 1643, 1644, 1644, 1644, 1644, - 1644, 1644, 1644, 1644, 1644, 1644, 1644, 1644, 1645, 1645, - 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, - 1646, 1646, 1646, 1646, 1646, 1646, 1646, 1646, 1646, 1646, - 1646, 1646, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - 1647, 1647, 1647, 1647, 1648, 1648, 1648, 1648, 1648, 1648, - 1648, 1648, 1648, 1648, 1648, 1648, 1649, 1649, 1649, 1649, - 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1650, 1650, - - 1650, 1650, 1650, 1650, 1650, 1650, 1650, 1650, 1650, 1650, - 1651, 1651, 1651, 1651, 1651, 1651, 1651, 1651, 1651, 1651, - 1651, 1651, 1652, 1652, 1652, 1652, 1652, 1652, 1652, 1652, - 1652, 1652, 1652, 1652, 1653, 1653, 1653, 1653, 1653, 1653, - 1653, 1653, 1653, 1653, 1653, 1653, 1654, 1654, 1654, 1654, - 1654, 1654, 1654, 1654, 1654, 1654, 1654, 1654, 1655, 1655, - 1655, 1655, 1655, 1655, 1655, 1655, 1655, 1655, 1655, 1655, - 1656, 1656, 1656, 1656, 1656, 1656, 1656, 1656, 1656, 1656, - 1656, 1656, 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657, - 1657, 1657, 1657, 1657, 1658, 1658, 1658, 1658, 1658, 1658, - - 1658, 1658, 1658, 1658, 1658, 1658, 1659, 1659, 1659, 1659, - 1659, 1659, 1659, 1659, 1659, 1659, 1659, 1659, 1660, 1660, - 1660, 1660, 1660, 1660, 1660, 1660, 1660, 1660, 1660, 1660, - 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, - 1661, 1661, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, - 1662, 1662, 1662, 1662, 1663, 1663, 1663, 1663, 1663, 1663, - 1663, 1663, 1663, 1663, 1663, 1663, 1664, 1664, 1664, 1664, - 1664, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 1665, 1665, - 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - - 1666, 1666, 1667, 1667, 1667, 1667, 1667, 1667, 1667, 1667, - 1667, 1667, 1667, 1667, 1668, 1668, 1668, 1668, 1668, 1668, - 1668, 1668, 1668, 1668, 1668, 1668, 1669, 1669, 1669, 1669, - 1669, 1669, 1669, 1669, 1669, 1669, 1669, 1669, 1670, 1670, - 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - 1671, 1671, 1671, 1671, 1671, 1671, 1671, 1671, 1671, 1671, - 1671, 1671, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - 1672, 1672, 1672, 1672, 1673, 1673, 1673, 1673, 1673, 1673, - 1673, 1673, 1673, 1673, 1673, 1673, 1674, 1674, 1674, 1674, - 1674, 1674, 1674, 1674, 1674, 1674, 1674, 1674, 1675, 1675, - - 1675, 1675, 1675, 1675, 1675, 1675, 1675, 1675, 1675, 1675, - 1676, 1676, 1676, 1676, 1676, 1676, 1676, 1676, 1676, 1676, - 1676, 1676, 1677, 1677, 1677, 1677, 1677, 1677, 1677, 1677, - 1677, 1677, 1677, 1677, 1678, 1678, 1678, 1678, 1678, 1678, - 1678, 1678, 1678, 1678, 1678, 1678, 1679, 1679, 1679, 1679, - 1679, 1679, 1679, 1679, 1679, 1679, 1679, 1679, 1680, 1680, - 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, - 1681, 1681, 1681, 1681, 1681, 1681, 1681, 1681, 1681, 1681, - 1681, 1681, 1682, 1682, 1682, 1682, 1682, 1682, 1682, 1682, - 1682, 1682, 1682, 1682, 1683, 1683, 1683, 1683, 1683, 1683, - - 1683, 1683, 1683, 1683, 1683, 1683, 1684, 1684, 1684, 1684, - 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1685, 1685, - 1685, 1685, 1685, 1685, 1685, 1685, 1685, 1685, 1685, 1685, - 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, - 1686, 1686, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, - 1687, 1687, 1687, 1687, 1688, 1688, 1688, 1688, 1688, 1688, - 1688, 1688, 1688, 1688, 1688, 1688, 1689, 1689, 1689, 1689, - 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1690, 1690, - 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - 1691, 1691, 1691, 1691, 1691, 1691, 1691, 1691, 1691, 1691, - - 1691, 1691, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, - 1692, 1692, 1692, 1692, 1693, 1693, 1693, 1693, 1693, 1693, - 1693, 1693, 1693, 1693, 1693, 1693, 1694, 1694, 1694, 1694, - 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1695, 1695, - 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, 1695, - 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, - 1696, 1696, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, - 1697, 1697, 1697, 1697, 1698, 1698, 1698, 1698, 1698, 1698, - 1698, 1698, 1698, 1698, 1698, 1698, 1699, 1699, 1699, 1699, - 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1700, 1700, - - 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, - 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, - 1701, 1701, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, - 1702, 1702, 1702, 1702, 1703, 1703, 1703, 1703, 1703, 1703, - 1703, 1703, 1703, 1703, 1703, 1703, 1704, 1704, 1704, 1704, - 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1705, 1705, - 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, - 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, - 1706, 1706, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, - 1707, 1707, 1707, 1707, 1708, 1708, 1708, 1708, 1708, 1708, - - 1708, 1708, 1708, 1708, 1708, 1708, 1709, 1709, 1709, 1709, - 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1710, 1710, - 1710, 1710, 1710, 1710, 1710, 1710, 1710, 1710, 1710, 1710, - 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711, - 1711, 1711, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, - 1712, 1712, 1712, 1712, 1713, 1713, 1713, 1713, 1713, 1713, - 1713, 1713, 1713, 1713, 1713, 1713, 1714, 1714, 1714, 1714, - 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1715, 1715, - 1715, 1715, 1715, 1715, 1715, 1715, 1715, 1715, 1715, 1715, - 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, - - 1716, 1716, 1717, 1717, 1717, 1717, 1717, 1717, 1717, 1717, - 1717, 1717, 1717, 1717, 1718, 1718, 1718, 1718, 1718, 1718, - 1718, 1718, 1718, 1718, 1718, 1718, 1719, 1719, 1719, 1719, - 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1720, 1720, - 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1720, - 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, - 1721, 1721, 1722, 1722, 1722, 1722, 1722, 1722, 1722, 1722, - 1722, 1722, 1722, 1722, 1723, 1723, 1723, 1723, 1723, 1723, - 1723, 1723, 1723, 1723, 1723, 1723, 1724, 1724, 1724, 1724, - 1724, 1724, 1724, 1724, 1724, 1724, 1724, 1724, 1725, 1725, - - 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, - 1726, 1726, 1726, 1726, 1726, 1726, 1726, 1726, 1726, 1726, - 1726, 1726, 1727, 1727, 1727, 1727, 1727, 1727, 1727, 1727, - 1727, 1727, 1727, 1727, 1728, 1728, 1728, 1728, 1728, 1728, - 1728, 1728, 1728, 1728, 1728, 1728, 1729, 1729, 1729, 1729, - 1729, 1729, 1729, 1729, 1729, 1729, 1729, 1729, 1730, 1730, - 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, - 1731, 1731, 1731, 1731, 1731, 1731, 1731, 1731, 1731, 1731, - 1731, 1731, 1732, 1732, 1732, 1732, 1732, 1732, 1732, 1732, - 1732, 1732, 1732, 1732, 1733, 1733, 1733, 1733, 1733, 1733, - - 1733, 1733, 1733, 1733, 1733, 1733, 1734, 1734, 1734, 1734, - 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1735, 1735, - 1735, 1735, 1735, 1735, 1735, 1735, 1735, 1735, 1735, 1735, - 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, - 1736, 1736, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1737, - 1737, 1737, 1737, 1737, 1738, 1738, 1738, 1738, 1738, 1738, - 1738, 1738, 1738, 1738, 1738, 1738, 1739, 1739, 1739, 1739, - 1739, 1739, 1739, 1739, 1739, 1739, 1739, 1739, 1740, 1740, - 1740, 1740, 1740, 1740, 1740, 1740, 1740, 1740, 1740, 1740, - 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1741, - - 1741, 1741, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, - 1742, 1742, 1742, 1742, 1743, 1743, 1743, 1743, 1743, 1743, - 1743, 1743, 1743, 1743, 1743, 1743, 1744, 1744, 1744, 1744, - 1744, 1744, 1744, 1744, 1744, 1744, 1744, 1744, 1745, 1745, - 1745, 1745, 1745, 1745, 1745, 1745, 1745, 1745, 1745, 1745, - 1746, 1746, 1746, 1746, 1746, 1746, 1746, 1746, 1746, 1746, - 1746, 1746, 1747, 1747, 1747, 1747, 1747, 1747, 1747, 1747, - 1747, 1747, 1747, 1747, 1748, 1748, 1748, 1748, 1748, 1748, - 1748, 1748, 1748, 1748, 1748, 1748, 1749, 1749, 1749, 1749, - 1749, 1749, 1749, 1749, 1749, 1749, 1749, 1749, 1750, 1750, - - 1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750, - 1751, 1751, 1751, 1751, 1751, 1751, 1751, 1751, 1751, 1751, - 1751, 1751, 1752, 1752, 1752, 1752, 1752, 1752, 1752, 1752, - 1752, 1752, 1752, 1752, 1753, 1753, 1753, 1753, 1753, 1753, - 1753, 1753, 1753, 1753, 1753, 1753, 1754, 1754, 1754, 1754, - 1754, 1754, 1754, 1754, 1754, 1754, 1754, 1754, 1755, 1755, - 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, - 1756, 1756, 1756, 1756, 1756, 1756, 1756, 1756, 1756, 1756, - 1756, 1756, 1757, 1757, 1757, 1757, 1757, 1757, 1757, 1757, - 1757, 1757, 1757, 1757, 1758, 1758, 1758, 1758, 1758, 1758, - - 1758, 1758, 1758, 1758, 1758, 1758, 1759, 1759, 1759, 1759, - 1759, 1759, 1759, 1759, 1759, 1759, 1759, 1759, 1760, 1760, - 1760, 1760, 1760, 1760, 1760, 1760, 1760, 1760, 1760, 1760, - 1761, 1761, 1761, 1761, 1761, 1761, 1761, 1761, 1761, 1761, - 1761, 1761, 1762, 1762, 1762, 1762, 1762, 1762, 1762, 1762, - 1762, 1762, 1762, 1762, 1763, 1763, 1763, 1763, 1763, 1763, - 1763, 1763, 1763, 1763, 1763, 1763, 1764, 1764, 1764, 1764, - 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1765, 1765, - 1765, 1765, 1765, 1765, 1765, 1765, 1765, 1765, 1765, 1765, - 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, - - 1766, 1766, 1767, 1767, 1767, 1767, 1767, 1767, 1767, 1767, - 1767, 1767, 1767, 1767, 1768, 1768, 1768, 1768, 1768, 1768, - 1768, 1768, 1768, 1768, 1768, 1768, 1769, 1769, 1769, 1769, - 1769, 1769, 1769, 1769, 1769, 1769, 1769, 1769, 1770, 1770, - 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770, 1770, - 1771, 1771, 1771, 1771, 1771, 1771, 1771, 1771, 1771, 1771, - 1771, 1771, 1772, 1772, 1772, 1772, 1772, 1772, 1772, 1772, - 1772, 1772, 1772, 1772, 1773, 1773, 1773, 1773, 1773, 1773, - 1773, 1773, 1773, 1773, 1773, 1773, 1774, 1774, 1774, 1774, - 1774, 1774, 1774, 1774, 1774, 1774, 1774, 1774, 1775, 1775, - - 1775, 1775, 1775, 1775, 1775, 1775, 1775, 1775, 1775, 1775, - 1776, 1776, 1776, 1776, 1776, 1776, 1776, 1776, 1776, 1776, - 1776, 1776, 1777, 1777, 1777, 1777, 1777, 1777, 1777, 1777, - 1777, 1777, 1777, 1777, 1778, 1778, 1778, 1778, 1778, 1778, - 1778, 1778, 1778, 1778, 1778, 1778, 1779, 1779, 1779, 1779, - 1779, 1779, 1779, 1779, 1779, 1779, 1779, 1779, 1780, 1780, - 1780, 1780, 1780, 1780, 1780, 1780, 1780, 1780, 1780, 1780, - 1781, 1781, 1781, 1781, 1781, 1781, 1781, 1781, 1781, 1781, - 1781, 1781, 1782, 1782, 1782, 1782, 1782, 1782, 1782, 1782, - 1782, 1782, 1782, 1782, 1783, 1783, 1783, 1783, 1783, 1783, - - 1783, 1783, 1783, 1783, 1783, 1783, 1784, 1784, 1784, 1784, - 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1785, 1785, - 1785, 1785, 1785, 1785, 1785, 1785, 1785, 1785, 1785, 1785, - 1786, 1786, 1786, 1786, 1786, 1786, 1786, 1786, 1786, 1786, - 1786, 1786, 1787, 1787, 1787, 1787, 1787, 1787, 1787, 1787, - 1787, 1787, 1787, 1787, 1788, 1788, 1788, 1788, 1788, 1788, - 1788, 1788, 1788, 1788, 1788, 1788, 1789, 1789, 1789, 1789, - 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1790, 1790, - 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, - 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, - - 1791, 1791, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1793, 1793, 1793, 1793, 1793, 1793, - 1793, 1793, 1793, 1793, 1793, 1793, 1794, 1794, 1794, 1794, - 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1795, 1795, - 1795, 1795, 1795, 1795, 1795, 1795, 1795, 1795, 1795, 1795, - 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, - 1796, 1796, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, - 1797, 1797, 1797, 1797, 1798, 1798, 1798, 1798, 1798, 1798, - 1798, 1798, 1798, 1798, 1798, 1798, 1799, 1799, 1799, 1799, - 1799, 1799, 1799, 1799, 1799, 1799, 1799, 1799, 1800, 1800, - - 1800, 1800, 1800, 1800, 1800, 1800, 1800, 1800, 1800, 1800, - 1801, 1801, 1801, 1801, 1801, 1801, 1801, 1801, 1801, 1801, - 1801, 1801, 1802, 1802, 1802, 1802, 1802, 1802, 1802, 1802, - 1802, 1802, 1802, 1802, 1803, 1803, 1803, 1803, 1803, 1803, - 1803, 1803, 1803, 1803, 1803, 1803, 1804, 1804, 1804, 1804, - 1804, 1804, 1804, 1804, 1804, 1804, 1804, 1804, 1805, 1805, - 1805, 1805, 1805, 1805, 1805, 1805, 1805, 1805, 1805, 1805, - 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - 1806, 1806, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - 1807, 1807, 1807, 1807, 1808, 1808, 1808, 1808, 1808, 1808, - - 1808, 1808, 1808, 1808, 1808, 1808, 1809, 1809, 1809, 1809, - 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1810, 1810, - 1810, 1810, 1810, 1810, 1810, 1810, 1810, 1810, 1810, 1810, - 1811, 1811, 1811, 1811, 1811, 1811, 1811, 1811, 1811, 1811, - 1811, 1811, 1812, 1812, 1812, 1812, 1812, 1812, 1812, 1812, - 1812, 1812, 1812, 1812, 1813, 1813, 1813, 1813, 1813, 1813, - 1813, 1813, 1813, 1813, 1813, 1813, 1814, 1814, 1814, 1814, - 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1815, 1815, - 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, - 1816, 1816, 1816, 1816, 1816, 1816, 1816, 1816, 1816, 1816, - - 1816, 1816, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, - 1817, 1817, 1817, 1817, 1818, 1818, 1818, 1818, 1818, 1818, - 1818, 1818, 1818, 1818, 1818, 1818, 1819, 1819, 1819, 1819, - 1819, 1819, 1819, 1819, 1819, 1819, 1819, 1819, 1820, 1820, - 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, - 1821, 1821, 1821, 1821, 1821, 1821, 1821, 1821, 1821, 1821, - 1821, 1821, 1822, 1822, 1822, 1822, 1822, 1822, 1822, 1822, - 1822, 1822, 1822, 1822, 1823, 1823, 1823, 1823, 1823, 1823, - 1823, 1823, 1823, 1823, 1823, 1823, 1824, 1824, 1824, 1824, - 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1825, 1825, - - 1825, 1825, 1825, 1825, 1825, 1825, 1825, 1825, 1825, 1825, - 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, - 1826, 1826, 1827, 1827, 1827, 1827, 1827, 1827, 1827, 1827, - 1827, 1827, 1827, 1827, 1828, 1828, 1828, 1828, 1828, 1828, - 1828, 1828, 1828, 1828, 1828, 1828, 1829, 1829, 1829, 1829, - 1829, 1829, 1829, 1829, 1829, 1829, 1829, 1829, 1830, 1830, - 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, - 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831, - 1831, 1831, 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832, - 1832, 1832, 1832, 1832, 1833, 1833, 1833, 1833, 1833, 1833, - - 1833, 1833, 1833, 1833, 1833, 1833, 1834, 1834, 1834, 1834, - 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1835, 1835, - 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835, - 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, - 1836, 1836, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - 1837, 1837, 1837, 1837, 1838, 1838, 1838, 1838, 1838, 1838, - 1838, 1838, 1838, 1838, 1838, 1838, 1839, 1839, 1839, 1839, - 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1840, 1840, - 1840, 1840, 1840, 1840, 1840, 1840, 1840, 1840, 1840, 1840, - 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1841, - - 1841, 1841, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, - 1842, 1842, 1842, 1842, 1843, 1843, 1843, 1843, 1843, 1843, - 1843, 1843, 1843, 1843, 1843, 1843, 1844, 1844, 1844, 1844, - 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1845, 1845, - 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1845, - 1846, 1846, 1846, 1846, 1846, 1846, 1846, 1846, 1846, 1846, - 1846, 1846, 1847, 1847, 1847, 1847, 1847, 1847, 1847, 1847, - 1847, 1847, 1847, 1847, 1848, 1848, 1848, 1848, 1848, 1848, - 1848, 1848, 1848, 1848, 1848, 1848, 1849, 1849, 1849, 1849, - 1849, 1849, 1849, 1849, 1849, 1849, 1849, 1849, 1850, 1850, - - 1850, 1850, 1850, 1850, 1850, 1850, 1850, 1850, 1850, 1850, - 1851, 1851, 1851, 1851, 1851, 1851, 1851, 1851, 1851, 1851, - 1851, 1851, 1852, 1852, 1852, 1852, 1852, 1852, 1852, 1852, - 1852, 1852, 1852, 1852, 1853, 1853, 1853, 1853, 1853, 1853, - 1853, 1853, 1853, 1853, 1853, 1853, 1854, 1854, 1854, 1854, - 1854, 1854, 1854, 1854, 1854, 1854, 1854, 1854, 1855, 1855, - 1855, 1855, 1855, 1855, 1855, 1855, 1855, 1855, 1855, 1855, - 1856, 1856, 1856, 1856, 1856, 1856, 1856, 1856, 1856, 1856, - 1856, 1856, 1857, 1857, 1857, 1857, 1857, 1857, 1857, 1857, - 1857, 1857, 1857, 1857, 1858, 1858, 1858, 1858, 1858, 1858, - - 1858, 1858, 1858, 1858, 1858, 1858, 1859, 1859, 1859, 1859, - 1859, 1859, 1859, 1859, 1859, 1859, 1859, 1859, 1860, 1860, - 1860, 1860, 1860, 1860, 1860, 1860, 1860, 1860, 1860, 1860, - 1861, 1861, 1861, 1861, 1861, 1861, 1861, 1861, 1861, 1861, - 1861, 1861, 1862, 1862, 1862, 1862, 1862, 1862, 1862, 1862, - 1862, 1862, 1862, 1862, 1863, 1863, 1863, 1863, 1863, 1863, - 1863, 1863, 1863, 1863, 1863, 1863, 1864, 1864, 1864, 1864, - 1864, 1864, 1864, 1864, 1864, 1864, 1864, 1864, 1865, 1865, - 1865, 1865, 1865, 1865, 1865, 1865, 1865, 1865, 1865, 1865, - 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, - - 1866, 1866, 1867, 1867, 1867, 1867, 1867, 1867, 1867, 1867, - 1867, 1867, 1867, 1867, 1868, 1868, 1868, 1868, 1868, 1868, - 1868, 1868, 1868, 1868, 1868, 1868, 1869, 1869, 1869, 1869, - 1869, 1869, 1869, 1869, 1869, 1869, 1869, 1869, 1870, 1870, - 1870, 1870, 1870, 1870, 1870, 1870, 1870, 1870, 1870, 1870, - 1871, 1871, 1871, 1871, 1871, 1871, 1871, 1871, 1871, 1871, - 1871, 1871, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - 1872, 1872, 1872, 1872, 1873, 1873, 1873, 1873, 1873, 1873, - 1873, 1873, 1873, 1873, 1873, 1873, 1874, 1874, 1874, 1874, - 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1875, 1875, - - 1875, 1875, 1875, 1875, 1875, 1875, 1875, 1875, 1875, 1875, - 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - 1876, 1876, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, - 1877, 1877, 1877, 1877, 1878, 1878, 1878, 1878, 1878, 1878, - 1878, 1878, 1878, 1878, 1878, 1878, 1879, 1879, 1879, 1879, - 1879, 1879, 1879, 1879, 1879, 1879, 1879, 1879, 1880, 1880, - 1880, 1880, 1880, 1880, 1880, 1880, 1880, 1880, 1880, 1880, - 1881, 1881, 1881, 1881, 1881, 1881, 1881, 1881, 1881, 1881, - 1881, 1881, 1882, 1882, 1882, 1882, 1882, 1882, 1882, 1882, - 1882, 1882, 1882, 1882, 1883, 1883, 1883, 1883, 1883, 1883, - - 1883, 1883, 1883, 1883, 1883, 1883, 1884, 1884, 1884, 1884, - 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1885, 1885, - 1885, 1885, 1885, 1885, 1885, 1885, 1885, 1885, 1885, 1885, - 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, - 1886, 1886, 1887, 1887, 1887, 1887, 1887, 1887, 1887, 1887, - 1887, 1887, 1887, 1887, 1888, 1888, 1888, 1888, 1888, 1888, - 1888, 1888, 1888, 1888, 1888, 1888, 1889, 1889, 1889, 1889, - 1889, 1889, 1889, 1889, 1889, 1889, 1889, 1889, 1890, 1890, - 1890, 1890, 1890, 1890, 1890, 1890, 1890, 1890, 1890, 1890, - 1891, 1891, 1891, 1891, 1891, 1891, 1891, 1891, 1891, 1891, - - 1891, 1891, 1892, 1892, 1892, 1892, 1892, 1892, 1892, 1892, - 1892, 1892, 1892, 1892, 1893, 1893, 1893, 1893, 1893, 1893, - 1893, 1893, 1893, 1893, 1893, 1893, 1894, 1894, 1894, 1894, - 1894, 1894, 1894, 1894, 1894, 1894, 1894, 1894, 1895, 1895, - 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, - 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, - 1896, 1896, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897, - 1897, 1897, 1897, 1897, 1898, 1898, 1898, 1898, 1898, 1898, - 1898, 1898, 1898, 1898, 1898, 1898, 1899, 1899, 1899, 1899, - 1899, 1899, 1899, 1899, 1899, 1899, 1899, 1899, 1900, 1900, - - 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900, - 1901, 1901, 1901, 1901, 1901, 1901, 1901, 1901, 1901, 1901, - 1901, 1901, 1902, 1902, 1902, 1902, 1902, 1902, 1902, 1902, - 1902, 1902, 1902, 1902, 1903, 1903, 1903, 1903, 1903, 1903, - 1903, 1903, 1903, 1903, 1903, 1903, 1904, 1904, 1904, 1904, - 1904, 1904, 1904, 1904, 1904, 1904, 1904, 1904, 1905, 1905, - 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, - 1906, 1906, 1906, 1906, 1906, 1906, 1906, 1906, 1906, 1906, - 1906, 1906, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, - 1907, 1907, 1907, 1907, 1908, 1908, 1908, 1908, 1908, 1908, - - 1908, 1908, 1908, 1908, 1908, 1908, 1909, 1909, 1909, 1909, - 1909, 1909, 1909, 1909, 1909, 1909, 1909, 1909, 1910, 1910, - 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - 1911, 1911, 1911, 1911, 1911, 1911, 1911, 1911, 1911, 1911, - 1911, 1911, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, - 1912, 1912, 1912, 1912, 1913, 1913, 1913, 1913, 1913, 1913, - 1913, 1913, 1913, 1913, 1913, 1913, 1914, 1914, 1914, 1914, - 1914, 1914, 1914, 1914, 1914, 1914, 1914, 1914, 1915, 1915, - 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915, - 1916, 1916, 1916, 1916, 1916, 1916, 1916, 1916, 1916, 1916, - - 1916, 1916, 1917, 1917, 1917, 1917, 1917, 1917, 1917, 1917, - 1917, 1917, 1917, 1917, 1918, 1918, 1918, 1918, 1918, 1918, - 1918, 1918, 1918, 1918, 1918, 1918, 1919, 1919, 1919, 1919, - 1919, 1919, 1919, 1919, 1919, 1919, 1919, 1919, 1920, 1920, - 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, - 1921, 1921, 1921, 1921, 1921, 1921, 1921, 1921, 1921, 1921, - 1921, 1921, 641, 640, 639, 636, 634, 633, 631, 619, - 618, 617, 615, 614, 613, 612, 611, 608, 607, 606, - 605, 602, 601, 600, 599, 598, 597, 596, 595, 594, - 589, 588, 582, 578, 576, 575, 574, 573, 572, 571, - - 569, 568, 567, 566, 565, 564, 563, 561, 560, 559, - 558, 557, 556, 555, 554, 553, 552, 551, 549, 546, - 545, 544, 543, 540, 538, 537, 534, 527, 526, 525, - 524, 523, 522, 521, 518, 517, 516, 515, 514, 513, - 512, 510, 509, 508, 506, 505, 503, 502, 501, 500, - 493, 492, 491, 490, 489, 488, 487, 485, 483, 482, - 481, 479, 478, 475, 474, 472, 471, 470, 467, 456, - 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, - 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, - 432, 431, 430, 429, 428, 427, 426, 424, 423, 422, - - 421, 420, 419, 418, 416, 415, 414, 413, 412, 411, - 410, 409, 408, 406, 405, 403, 402, 401, 400, 398, - 397, 396, 395, 394, 393, 392, 390, 367, 364, 361, - 359, 358, 357, 356, 355, 354, 353, 350, 349, 348, - 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, - 336, 335, 334, 332, 331, 329, 328, 327, 326, 325, - 324, 323, 321, 320, 319, 318, 316, 315, 310, 309, - 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, - 293, 287, 286, 283, 246, 237, 225, 220, 219, 218, - 217, 216, 215, 214, 213, 212, 210, 207, 206, 205, - - 203, 201, 200, 199, 198, 196, 195, 194, 193, 192, - 190, 188, 185, 184, 180, 179, 178, 173, 170, 166, - 158, 149, 148, 147, 146, 145, 144, 143, 141, 126, - 124, 122, 121, 119, 118, 116, 115, 112, 111, 100, - 91, 86, 82, 75, 74, 73, 69, 67, 66, 65, - 62, 54, 53, 52, 48, 41, 32, 28, 27, 24, - 23, 22, 21, 2, 1, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492, - 1492, 1492, 1492, 1492, 1492, 1492, 1492, 1492 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -static int yy_more_flag = 0; -static int yy_more_len = 0; -#define yymore() (yy_more_flag = 1) -#define YY_MORE_ADJ yy_more_len -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#define INITIAL 0 - +/* Generated by re2c 0.13.5 on Mon Mar 23 21:40:47 2009 */ /* +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -3026,48 +13,24 @@ char *yytext; | obtain it through the world-wide-web, please send a note to | | license@zend.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | + | Authors: Marcus Boerger | + | Nuno Lopes | + | Scott MacVicar | + | Flex version authors: | + | Andi Gutmans | | Zeev Suraski | +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.11.2.17 2008/05/10 09:18:27 mattwil Exp $ */ - -#define yyleng SCNG(yy_leng) -#define yytext SCNG(yy_text) -#define yytext_ptr SCNG(yy_text) -#define yyin SCNG(yy_in) -#define yyout SCNG(yy_out) -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#define yy_more_flag SCNG(_yy_more_flag) -#define yy_more_len SCNG(_yy_more_len) - -#define ST_IN_SCRIPTING 1 - -#define ST_DOUBLE_QUOTES 2 +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13.2.37 2009/03/16 01:40:13 shire Exp $ */ -#define ST_BACKQUOTE 3 - -#define ST_HEREDOC 4 - -#define ST_START_HEREDOC 5 - -#define ST_END_HEREDOC 6 - -#define ST_LOOKING_FOR_PROPERTY 7 - -#define ST_LOOKING_FOR_VARNAME 8 - -#define ST_VAR_OFFSET 9 - -#define ST_COMMENT 10 - -#define ST_DOC_COMMENT 11 - -#define ST_ONE_LINE_COMMENT 12 +#if 0 +# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c) +#else +# define YYDEBUG(s, c) +#endif -#define YY_STACK_USED 1 +#include "zend_language_scanner_defs.h" #include #include "zend.h" @@ -3082,6 +45,35 @@ char *yytext; #include "zend_API.h" #include "zend_strtod.h" #include "zend_exceptions.h" +#include "tsrm_virtual_cwd.h" +#include "tsrm_config_common.h" + +#define YYCTYPE unsigned char +#define YYFILL(n) { if ((YYCURSOR + n) >= (YYLIMIT + ZEND_MMAP_AHEAD)) { return 0; } } +#define YYCURSOR SCNG(yy_cursor) +#define YYLIMIT SCNG(yy_limit) +#define YYMARKER SCNG(yy_marker) + +#define YYGETCONDITION() SCNG(yy_state) +#define YYSETCONDITION(s) SCNG(yy_state) = s + +#define STATE(name) yyc##name + +/* emulate flex constructs */ +#define BEGIN(state) YYSETCONDITION(STATE(state)) +#define YYSTATE YYGETCONDITION() +#define yytext ((char*)SCNG(yy_text)) +#define yyleng SCNG(yy_leng) +#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ + yyleng = (unsigned int)x; } while(0) +#define yymore() goto yymore_restart + +/* perform sanity check. If this message is triggered you should + increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */ +#define YYMAXFILL 16 +#if ZEND_MMAP_AHEAD < YYMAXFILL +# error ZEND_MMAP_AHEAD should be greater than or equal to YYMAXFILL +#endif #ifdef HAVE_STDARG_H # include @@ -3091,28 +83,14 @@ char *yytext; # include #endif -#define YY_DECL int lex_scan(zval *zendlval TSRMLS_DC) - -#define ECHO { ZEND_WRITE( yytext, yyleng ); } - -#ifdef ZTS -# define MY_INPUT yyinput -#else -# define MY_INPUT input -#endif - - /* Globals Macros */ #define SCNG LANG_SCNG #ifdef ZTS ZEND_API ts_rsrc_id language_scanner_globals_id; #else -ZEND_API zend_scanner_globals language_scanner_globals; +ZEND_API zend_php_scanner_globals language_scanner_globals; #endif - -#define YY_FATAL_ERROR zend_fatal_scanner_error - #define HANDLE_NEWLINES(s, l) \ do { \ char *p = (s), *boundary = p+(l); \ @@ -3132,76 +110,75 @@ do { \ } \ } - #define ZEND_IS_OCT(c) ((c)>='0' && (c)<='7') #define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F')) +BEGIN_EXTERN_C() + +static void _yy_push_state(int new_state TSRMLS_DC) +{ + zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int)); + YYSETCONDITION(new_state); +} + +#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm) -void zend_fatal_scanner_error(char *message) +static void yy_pop_state(TSRMLS_D) { - zend_error(E_COMPILE_ERROR, "%s", message); + int *stack_state; + zend_stack_top(&SCNG(state_stack), (void **) &stack_state); + YYSETCONDITION(*stack_state); + zend_stack_del_top(&SCNG(state_stack)); +} + +static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC) +{ + YYCURSOR = (YYCTYPE*)str; + SCNG(yy_start) = YYCURSOR; + YYLIMIT = YYCURSOR + len; } -BEGIN_EXTERN_C() void startup_scanner(TSRMLS_D) { CG(heredoc) = NULL; CG(heredoc_len) = 0; CG(doc_comment) = NULL; CG(doc_comment_len) = 0; - SCNG(yy_start_stack_ptr) = 0; - SCNG(yy_start_stack_depth) = 0; - SCNG(current_buffer) = NULL; -#ifdef ZEND_MULTIBYTE - SCNG(script_org) = NULL; - SCNG(script_org_size) = 0; - SCNG(script_filtered) = NULL; - SCNG(script_filtered_size) = 0; - SCNG(input_filter) = NULL; - SCNG(output_filter) = NULL; - SCNG(script_encoding) = NULL; - SCNG(internal_encoding) = NULL; -#endif /* ZEND_MULTIBYTE */ + zend_llist_init(&SCNG(used_state_stacks), sizeof(zend_stack), (llist_dtor_func_t) zend_stack_destroy, 0); + zend_stack_init(&SCNG(state_stack)); + zend_llist_add_element(&SCNG(used_state_stacks), &SCNG(state_stack)); } - void shutdown_scanner(TSRMLS_D) { if (CG(heredoc)) { efree(CG(heredoc)); CG(heredoc_len)=0; } - if (SCNG(yy_start_stack)) { - yy_flex_free(SCNG(yy_start_stack)); - SCNG(yy_start_stack) = NULL; - } + zend_llist_destroy(&SCNG(used_state_stacks)); RESET_DOC_COMMENT(); - -#ifdef ZEND_MULTIBYTE - if (SCNG(script_org)) { - efree(SCNG(script_org)); - SCNG(script_org) = NULL; - } - if (SCNG(script_filtered)) { - efree(SCNG(script_filtered)); - SCNG(script_filtered) = NULL; - } - SCNG(script_org_size) = 0; - SCNG(script_filtered_size) = 0; - SCNG(input_filter) = NULL; - SCNG(output_filter) = NULL; - SCNG(script_encoding) = NULL; - SCNG(internal_encoding) = NULL; -#endif /* ZEND_MULTIBYTE */ } -END_EXTERN_C() +static int compare_stacks(zend_stack *stack1, zend_stack *stack2) +{ + return (stack1 == stack2); +} ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC) { - memcpy(&lex_state->buffer_state, &YY_CURRENT_BUFFER, sizeof(YY_BUFFER_STATE)); + lex_state->yy_leng = SCNG(yy_leng); + lex_state->yy_start = SCNG(yy_start); + lex_state->yy_text = SCNG(yy_text); + lex_state->yy_cursor = SCNG(yy_cursor); + lex_state->yy_marker = SCNG(yy_marker); + lex_state->yy_limit = SCNG(yy_limit); + + lex_state->state_stack = SCNG(state_stack); + zend_stack_init(&SCNG(state_stack)); + zend_llist_add_element(&SCNG(used_state_stacks), &SCNG(state_stack)); + lex_state->in = SCNG(yy_in); - lex_state->state = YYSTATE; + lex_state->yy_state = YYSTATE; lex_state->filename = zend_get_compiled_filename(TSRMLS_C); lex_state->lineno = CG(zend_lineno); @@ -3219,20 +196,20 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC) ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC) { - YY_BUFFER_STATE original_buffer_state = YY_CURRENT_BUFFER; + SCNG(yy_leng) = lex_state->yy_leng; + SCNG(yy_start) = lex_state->yy_start; + SCNG(yy_text) = lex_state->yy_text; + SCNG(yy_cursor) = lex_state->yy_cursor; + SCNG(yy_marker) = lex_state->yy_marker; + SCNG(yy_limit) = lex_state->yy_limit; - if (lex_state->buffer_state) { - yy_switch_to_buffer(lex_state->buffer_state TSRMLS_CC); - } else { - YY_CURRENT_BUFFER = NULL; - } + zend_llist_del_element(&SCNG(used_state_stacks), &SCNG(state_stack), (int (*)(void *, void *)) compare_stacks); + SCNG(state_stack) = lex_state->state_stack; - yy_delete_buffer(original_buffer_state TSRMLS_CC); SCNG(yy_in) = lex_state->in; - BEGIN(lex_state->state); + YYSETCONDITION(lex_state->yy_state); CG(zend_lineno) = lex_state->lineno; zend_restore_compiled_filename(lex_state->filename TSRMLS_CC); - #ifdef ZEND_MULTIBYTE if (SCNG(script_org)) { efree(SCNG(script_org)); @@ -3253,57 +230,6 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC) #endif /* ZEND_MULTIBYTE */ } - -BEGIN_EXTERN_C() - - -ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) -{ - TSRMLS_FETCH(); - - switch (fh->type) { - case ZEND_HANDLE_FP: - fclose(fh->handle.fp); - break; - case ZEND_HANDLE_STREAM: - if (fh->handle.stream.closer) { - fh->handle.stream.closer(fh->handle.stream.handle TSRMLS_CC); - } - break; - case ZEND_HANDLE_FILENAME: - /* We're only supposed to get here when destructing the used_files hash, - * which doesn't really contain open files, but references to their names/paths - */ - break; - } - if (fh->opened_path) { - efree(fh->opened_path); - fh->opened_path = NULL; - } - if (fh->free_filename && fh->filename) { - efree(fh->filename); - fh->filename = NULL; - } -} - - -int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) -{ - if (fh1->type != fh2->type) { - return 0; - } - switch (fh1->type) { - case ZEND_HANDLE_FP: - return fh1->handle.fp==fh2->handle.fp; - break; - case ZEND_HANDLE_STREAM: - return fh1->handle.stream.handle == fh2->handle.stream.handle; - break; - } - return 0; -} - - ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC) { zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles); @@ -3317,49 +243,49 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC) ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC) { - char *file_path=NULL; + char *file_path = NULL, *buf; + size_t size; - if (FAILURE == zend_stream_fixup(file_handle TSRMLS_CC)) { + if (zend_stream_fixup(file_handle, &buf, &size TSRMLS_CC) == FAILURE) { return FAILURE; } zend_llist_add_element(&CG(open_files), file_handle); - + if (file_handle->handle.stream.handle >= (void*)file_handle && file_handle->handle.stream.handle <= (void*)(file_handle+1)) { + zend_file_handle *fh = (zend_file_handle*)zend_llist_get_last(&CG(open_files)); + size_t diff = (char*)file_handle->handle.stream.handle - (char*)file_handle; + fh->handle.stream.handle = (void*)(((char*)fh) + diff); + file_handle->handle.stream.handle = fh->handle.stream.handle; + } + /* Reset the scanner for scanning the new file */ SCNG(yy_in) = file_handle; + if (size != -1) { #ifdef ZEND_MULTIBYTE - if (file_handle->handle.stream.interactive == 0) { - if (zend_multibyte_read_script(TSRMLS_C) != 0) { + if (zend_multibyte_read_script((unsigned char *)buf, size TSRMLS_CC) != 0) { return FAILURE; } - /* force flex to use buffer only */ SCNG(yy_in) = NULL; - SCNG(init) = 0; - SCNG(start) = 1; zend_multibyte_set_filter(NULL TSRMLS_CC); if (!SCNG(input_filter)) { - SCNG(script_filtered) = (char*)emalloc(SCNG(script_org_size)+1); + SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+1); memcpy(SCNG(script_filtered), SCNG(script_org), SCNG(script_org_size)+1); SCNG(script_filtered_size) = SCNG(script_org_size); } else { SCNG(input_filter)(&SCNG(script_filtered), &SCNG(script_filtered_size), SCNG(script_org), SCNG(script_org_size) TSRMLS_CC); } - /* flex requires doubled null */ - SCNG(script_filtered) = (char*)erealloc(SCNG(script_filtered), SCNG(script_filtered_size)+2); - *(SCNG(script_filtered)+SCNG(script_filtered_size)) = (char)NULL; - *(SCNG(script_filtered)+SCNG(script_filtered_size)+1) = (char)NULL; - yy_scan_buffer(SCNG(script_filtered), SCNG(script_filtered_size)+2 TSRMLS_CC); + yy_scan_buffer((char *)SCNG(script_filtered), SCNG(script_filtered_size) TSRMLS_CC); +#else /* !ZEND_MULTIBYTE */ + yy_scan_buffer(buf, size TSRMLS_CC); +#endif /* ZEND_MULTIBYTE */ } else { - yy_switch_to_buffer(yy_create_buffer(SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC); + zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed"); } -#else /* !ZEND_MULTIBYTE */ - yy_switch_to_buffer(yy_create_buffer(SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC); -#endif /* ZEND_MULTIBYTE */ BEGIN(INITIAL); @@ -3398,8 +324,8 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR retval_znode.op_type = IS_CONST; retval_znode.u.constant.type = IS_LONG; retval_znode.u.constant.value.lval = 1; - retval_znode.u.constant.is_ref = 0; - retval_znode.u.constant.refcount = 1; + Z_UNSET_ISREF(retval_znode.u.constant); + Z_SET_REFCOUNT(retval_znode.u.constant, 1); zend_save_lexical_state(&original_lex_state TSRMLS_CC); @@ -3407,10 +333,10 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) { if (type==ZEND_REQUIRE) { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC); zend_bailout(); } else { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC); } compilation_successful=0; } else { @@ -3419,7 +345,6 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR CG(active_op_array) = op_array; compiler_result = zendparse(TSRMLS_C); zend_do_return(&retval_znode, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); CG(in_compilation) = original_in_compilation; if (compiler_result==1) { /* parser error */ zend_bailout(); @@ -3431,6 +356,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR CG(active_op_array) = original_active_op_array; if (compilation_successful) { pass_two(op_array TSRMLS_CC); + zend_release_labels(TSRMLS_C); } else { efree(op_array); retval = NULL; @@ -3487,33 +413,29 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC) { /* enforce two trailing NULLs for flex... */ - STR_REALLOC(str->value.str.val, str->value.str.len+2); + str->value.str.val = safe_erealloc(str->value.str.val, 1, str->value.str.len, ZEND_MMAP_AHEAD); - str->value.str.val[str->value.str.len+1]=0; + memset(str->value.str.val + str->value.str.len, 0, ZEND_MMAP_AHEAD); SCNG(yy_in)=NULL; #ifdef ZEND_MULTIBYTE - SCNG(script_org) = estrdup(str->value.str.val); + SCNG(script_org) = (unsigned char *)estrdup(str->value.str.val); SCNG(script_org_size) = str->value.str.len; zend_multibyte_set_filter(CG(internal_encoding) TSRMLS_CC); if (!SCNG(input_filter)) { - SCNG(script_filtered) = (char*)emalloc(SCNG(script_org_size)+1); + SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+1); memcpy(SCNG(script_filtered), SCNG(script_org), SCNG(script_org_size)+1); SCNG(script_filtered_size) = SCNG(script_org_size); } else { SCNG(input_filter)(&SCNG(script_filtered), &SCNG(script_filtered_size), SCNG(script_org), SCNG(script_org_size) TSRMLS_CC); } - /* flex requires doubled null */ - SCNG(script_filtered) = (char*)erealloc(SCNG(script_filtered), SCNG(script_filtered_size)+2); - *(SCNG(script_filtered)+SCNG(script_filtered_size)) = (char)NULL; - *(SCNG(script_filtered)+SCNG(script_filtered_size)+1) = (char)NULL; - yy_scan_buffer(SCNG(script_filtered), SCNG(script_filtered_size)+2 TSRMLS_CC); + yy_scan_buffer((char *)SCNG(script_filtered), SCNG(script_filtered_size) TSRMLS_CC); #else /* !ZEND_MULTIBYTE */ - yy_scan_buffer(str->value.str.val, str->value.str.len+2 TSRMLS_CC); + yy_scan_buffer(str->value.str.val, str->value.str.len TSRMLS_CC); #endif /* ZEND_MULTIBYTE */ zend_set_compiled_filename(filename TSRMLS_CC); @@ -3523,19 +445,27 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D } -ZEND_API int zend_get_scanned_file_offset(TSRMLS_D) +ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D) { - if (yyin) { - int offset_in_buffer = (yy_c_buf_p - (YY_CURRENT_BUFFER)->yy_ch_buf); - int read_bytes = SCNG(yy_n_chars); - int offset_from_the_end = read_bytes - offset_in_buffer; - - return zend_stream_ftell(yyin TSRMLS_CC) - offset_from_the_end; - } else { - /* The entire file is in the buffer; probably zend multibyte - is enabled */ - return (yy_c_buf_p - (YY_CURRENT_BUFFER)->yy_ch_buf); + size_t offset = SCNG(yy_cursor) - SCNG(yy_start); +#ifdef ZEND_MULTIBYTE + if (SCNG(input_filter)) { + size_t original_offset = offset, length = 0; do { + unsigned char *p = NULL; + SCNG(input_filter)(&p, &length, SCNG(script_org), offset TSRMLS_CC); + if (!p) { + break; + } + efree(p); + if (length > original_offset) { + offset--; + } else if (length < original_offset) { + offset++; + } + } while (original_offset != length); } +#endif + return offset; } @@ -3567,7 +497,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) retval = NULL; } else { zend_bool orig_interactive = CG(interactive); - + CG(interactive) = 0; init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC); CG(interactive) = orig_interactive; @@ -3592,9 +522,9 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) retval = NULL; } else { zend_do_return(NULL, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); CG(active_op_array) = original_active_op_array; pass_two(op_array TSRMLS_CC); + zend_release_labels(TSRMLS_C); retval = op_array; } zend_restore_lexical_state(&original_lex_state TSRMLS_CC); @@ -3617,7 +547,7 @@ int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlight file_handle.opened_path = NULL; zend_save_lexical_state(&original_lex_state TSRMLS_CC); if (open_file_for_scanning(&file_handle TSRMLS_CC)==FAILURE) { - zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename); + zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename TSRMLS_CC); return FAILURE; } zend_highlight(syntax_highlighter_ini TSRMLS_CC); @@ -3666,56 +596,49 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ END_EXTERN_C() #ifdef ZEND_MULTIBYTE + BEGIN_EXTERN_C() ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, zend_encoding *old_encoding TSRMLS_DC) { - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - int offset, original_offset, length, free_flag; - char *p; - zend_encoding *new_encoding; + size_t original_offset, offset, free_flag, new_len, length; + unsigned char *p; /* calculate current position */ - offset = original_offset = yy_c_buf_p - b->yy_ch_buf; - if (old_input_filter && original_offset > 0) { - new_encoding = SCNG(script_encoding); + offset = original_offset = YYCURSOR - SCNG(yy_start); + if (old_input_filter && offset > 0) { + zend_encoding *new_encoding = SCNG(script_encoding); + zend_encoding_filter new_filter = SCNG(input_filter); SCNG(script_encoding) = old_encoding; - do { - (old_input_filter)(&p, &length, SCNG(script_org), offset TSRMLS_CC); - if (!p) { - SCNG(script_encoding) = new_encoding; - return; - } - efree(p); - if (length > original_offset) { - offset--; - } else if (length < original_offset) { - offset++; - } - } while (original_offset != length); + SCNG(input_filter) = old_input_filter; + offset = zend_get_scanned_file_offset(TSRMLS_C); SCNG(script_encoding) = new_encoding; + SCNG(input_filter) = new_filter; } /* convert and set */ if (!SCNG(input_filter)) { - length = SCNG(script_org_size)-offset-1; - p = SCNG(script_org)+offset+1; + length = SCNG(script_org_size) - offset; + p = SCNG(script_org) + offset; free_flag = 0; } else { - SCNG(input_filter)(&p, &length, SCNG(script_org)+offset+1, SCNG(script_org_size)-offset-1 TSRMLS_CC); + SCNG(input_filter)(&p, &length, SCNG(script_org) + offset, SCNG(script_org_size) - offset TSRMLS_CC); free_flag = 1; } - if (original_offset+length+1 > (int)b->yy_buf_size) { - b->yy_buf_size = original_offset+length+1; - b->yy_ch_buf = (char*)erealloc(b->yy_ch_buf, b->yy_buf_size+2); - SCNG(script_filtered) = b->yy_ch_buf; - SCNG(script_filtered_size) = b->yy_buf_size; + + new_len = original_offset + length; + + if (new_len > YYLIMIT - SCNG(yy_start)) { + unsigned char *new_yy_start = erealloc(SCNG(yy_start), new_len); + SCNG(yy_cursor) = new_yy_start + (SCNG(yy_cursor) - SCNG(yy_start)); + SCNG(yy_marker) = new_yy_start + (SCNG(yy_marker) - SCNG(yy_start)); + SCNG(yy_text) = new_yy_start + (SCNG(yy_text) - SCNG(yy_start)); + SCNG(yy_start) = new_yy_start; + SCNG(script_filtered) = new_yy_start; + SCNG(script_filtered_size) = new_len; } - yy_c_buf_p = b->yy_ch_buf + original_offset; - strncpy(yy_c_buf_p+1, p, length); - b->yy_n_chars = original_offset + length + 1; - SCNG(yy_n_chars) = b->yy_n_chars; - b->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[SCNG(yy_n_chars)+1] = YY_END_OF_BUFFER_CHAR; + + SCNG(yy_limit) = SCNG(yy_start) + new_len; + memmove(SCNG(yy_start) + original_offset, p, length); if (free_flag) { efree(p); @@ -3725,10 +648,14 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter ZEND_API int zend_multibyte_yyinput(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC) { - int c = '*', n; + size_t n; - if (file_handle->handle.stream.interactive == 0) { - return zend_stream_read(file_handle, buf, len TSRMLS_CC); + if (CG(interactive) == 0) { + if (zend_stream_fixup(file_handle, &buf, &len TSRMLS_CC) == FAILURE) { + return FAILURE; + } + n = len; + return n; } /* interactive */ @@ -3742,44 +669,29 @@ ZEND_API int zend_multibyte_yyinput(zend_file_handle *file_handle, char *buf, si SCNG(script_org_size) = 0; /* TODO: support widechars */ - - for (n = 0; n < len && (c = zend_stream_getc(yyin TSRMLS_CC)) != EOF && c != '\n'; ++n) { - buf[n] = (char)c; - } - if (c == '\n') { - buf[n++] = (char) c; + if (zend_stream_fixup(file_handle, &buf, &len TSRMLS_CC) == FAILURE) { + return FAILURE; } + n = len; SCNG(script_org_size) = n; - SCNG(script_org) = (char*)emalloc(SCNG(script_org_size) + 1); + SCNG(script_org) = (unsigned char*)emalloc(SCNG(script_org_size) + 1); memcpy(SCNG(script_org), buf, n); return n; } -ZEND_API int zend_multibyte_read_script(TSRMLS_D) +ZEND_API int zend_multibyte_read_script(unsigned char *buf, size_t n TSRMLS_DC) { - char buf[8192]; - int n; - if (SCNG(script_org)) { efree(SCNG(script_org)); } - SCNG(script_org) = NULL; - SCNG(script_org_size) = 0; - - for (; (n = zend_stream_read(yyin, buf, sizeof(buf) TSRMLS_CC)) > 0; ) { - SCNG(script_org_size) += n; - SCNG(script_org) = (char*)erealloc(SCNG(script_org), SCNG(script_org_size)); - memcpy(SCNG(script_org) + SCNG(script_org_size) - n, buf, n); - } - - if (n < 0) { - return -1; - } - - SCNG(script_org) = (char*)erealloc(SCNG(script_org), SCNG(script_org_size) + 1); + SCNG(script_org_size) = n; + SCNG(script_org) = (unsigned char*)erealloc(SCNG(script_org), SCNG(script_org_size)); + memcpy(SCNG(script_org) + SCNG(script_org_size) - n, buf, n); + + SCNG(script_org) = (unsigned char*)erealloc(SCNG(script_org), SCNG(script_org_size) + 1); *(SCNG(script_org)+SCNG(script_org_size)) = '\0'; return 0; @@ -3788,7 +700,9 @@ ZEND_API int zend_multibyte_read_script(TSRMLS_D) # define zend_copy_value(zendlval, yytext, yyleng) \ if (SCNG(output_filter)) { \ - SCNG(output_filter)(&(zendlval->value.str.val), &(zendlval->value.str.len), yytext, yyleng TSRMLS_CC); \ + size_t sz = 0; \ + SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \ + zendlval->value.str.len = sz; \ } else { \ zendlval->value.str.val = (char *) estrndup(yytext, yyleng); \ zendlval->value.str.len = yyleng; \ @@ -3901,1081 +815,4193 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo s++; } *t = 0; - #ifdef ZEND_MULTIBYTE if (SCNG(output_filter)) { + size_t sz = 0; s = zendlval->value.str.val; - SCNG(output_filter)(&(zendlval->value.str.val), &(zendlval->value.str.len), s, zendlval->value.str.len TSRMLS_CC); + SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)s, (size_t)zendlval->value.str.len TSRMLS_CC); + zendlval->value.str.len = sz; efree(s); } #endif /* ZEND_MULTIBYTE */ } -/* - * LITERAL_DOLLAR matches unescaped $ that aren't followed by a label character - * or a { and therefore will be taken literally. The case of literal $ before - * a variable or "${" is handled in a rule for each string type - */ -/* - * Usually, HEREDOC_NEWLINE will just function like a simple NEWLINE, but some - * special cases need to be handled. HEREDOC_CHARS doesn't allow a line to - * match when { or $, and/or \ is at the end. (("{"*|"$"*)"\\"?) handles that, - * along with cases where { or $, and/or \ is the ONLY thing on a line - * - * The other case is when a line contains a label, followed by ONLY - * { or $, and/or \ Handled by ({LABEL}";"?((("{"+|"$"+)"\\"?)|"\\")) - */ -/* - * This pattern is just used in the next 2 for matching { or literal $, and/or - * \ escape sequence immediately at the beginning of a line or after a label - */ -/* - * These 2 label-related patterns allow HEREDOC_CHARS to continue "regular" - * matching after a newline that starts with either a non-label character or a - * label that isn't followed by a newline. Like HEREDOC_CHARS, they won't match - * a variable or "{$" Matching a newline, and possibly label, up TO a variable - * or "{$", is handled in the heredoc rules - * - * The HEREDOC_LABEL_NO_NEWLINE pattern (";"[^$\n\r\\{]) handles cases where ; - * follows a label. [^a-zA-Z0-9_\x7f-\xff;$\n\r\\{] is needed to prevent a label - * character or ; from matching on a possible (real) ending label - */ -/* - * CHARS matches everything up to a variable or "{$" - * {'s are matched as long as they aren't followed by a $ - * The case of { before "{$" is handled in a rule for each string type - * - * For heredocs, matching continues across/after newlines if/when it's known - * that the next line doesn't contain a possible ending label - */ - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr TSRMLS_DC )); -#endif -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif +int lex_scan(zval *zendlval TSRMLS_DC) +{ +restart: + SCNG(yy_text) = YYCURSOR; -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif +yymore_restart: -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int 3 YY_PROTO(( TSRMLS_D )); -#else -static int input YY_PROTO(( TSRMLS_D )); -#endif -#endif -#if YY_STACK_USED -#define yy_start_stack_ptr SCNG(yy_start_stack_ptr) -#define yy_start_stack_depth SCNG(yy_start_stack_depth) -#define yy_start_stack SCNG(yy_start_stack) -/* -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -*/ -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state TSRMLS_DC )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( TSRMLS_D )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( TSRMLS_D )); -#endif +{ + YYCTYPE yych; + unsigned int yyaccept = 0; + if (YYGETCONDITION() < 6) { + if (YYGETCONDITION() < 3) { + if (YYGETCONDITION() < 1) { + goto yyc_ST_IN_SCRIPTING; + } else { + if (YYGETCONDITION() < 2) { + goto yyc_ST_LOOKING_FOR_PROPERTY; + } else { + goto yyc_ST_BACKQUOTE; + } + } + } else { + if (YYGETCONDITION() < 4) { + goto yyc_ST_DOUBLE_QUOTES; + } else { + if (YYGETCONDITION() < 5) { + goto yyc_ST_HEREDOC; + } else { + goto yyc_ST_LOOKING_FOR_VARNAME; + } + } + } + } else { + if (YYGETCONDITION() < 9) { + if (YYGETCONDITION() < 7) { + goto yyc_ST_VAR_OFFSET; + } else { + if (YYGETCONDITION() < 8) { + goto yyc_INITIAL; + } else { + goto yyc_ST_ONE_LINE_COMMENT; + } + } + } else { + if (YYGETCONDITION() < 11) { + if (YYGETCONDITION() < 10) { + goto yyc_ST_COMMENT; + } else { + goto yyc_ST_DOC_COMMENT; + } + } else { + if (YYGETCONDITION() < 12) { + goto yyc_ST_END_HEREDOC; + } else { + goto yyc_ST_NOWDOC; + } + } + } + } +/* *********************************** */ +yyc_INITIAL: + { + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 0, 0, 128, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 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, 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, 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, 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, + }; + + YYDEBUG(0, *YYCURSOR); + YYFILL(8); + yych = *YYCURSOR; + if (yych <= 0x00) goto yy2; + if (yych == '<') goto yy4; + goto yy6; +yy2: + YYDEBUG(2, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(3, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return 0; } +yy4: + YYDEBUG(4, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '?') { + if (yych == '%') goto yy9; + if (yych >= '?') goto yy7; + } else { + if (yych <= 'S') { + if (yych >= 'S') goto yy11; + } else { + if (yych == 's') goto yy11; + } + } +yy5: + YYDEBUG(5, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif +inline_char_handler: -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif + while (1) { + YYCTYPE *ptr = memchr(YYCURSOR, '<', YYLIMIT - YYCURSOR); -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif + if (ptr == NULL) { + YYCURSOR = YYLIMIT; + yyleng = YYCURSOR - SCNG(yy_text); + break; -/* Copy whatever the last rule matched to the standard output. */ + } else { + YYCURSOR = ptr + 1; -/* Zend file handle reading */ -#ifndef ECHO -#define ECHO /* There is no output */ -#endif + /* stop if it may be an opening tag (). this condition is not optimal though */ + if (YYCURSOR < YYLIMIT && (*YYCURSOR == '?' || *YYCURSOR == '%' || *YYCURSOR == 's')) { + --YYCURSOR; + yyleng = YYCURSOR - SCNG(yy_text); + break; + } + } + } #ifdef ZEND_MULTIBYTE -# define YY_INPUT(buf, result, max_size) \ - if ( ((result = zend_multibyte_yyinput(yyin, buf, max_size TSRMLS_CC)) == 0) \ - && zend_stream_ferror( yyin TSRMLS_CC) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#else -# define YY_INPUT(buf, result, max_size) \ - if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \ - && zend_stream_ferror( yyin TSRMLS_CC) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yy_out) ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ + if (SCNG(output_filter)) { + int readsize; + size_t sz = 0; + readsize = SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); + zendlval->value.str.len = sz; + if (readsize < yyleng) { + yyless(readsize); } + } else { + zendlval->value.str.val = (char *) estrndup(yytext, yyleng); + zendlval->value.str.len = yyleng; + } +#else /* !ZEND_MULTIBYTE */ + zendlval->value.str.val = (char *) estrndup(yytext, yyleng); + zendlval->value.str.len = yyleng; #endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - - - - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - -#if 0 - if ( ! SCNG(yy_in) ) - SCNG(yy_in) = stdin; - - if ( ! SCNG(yy_out) ) - SCNG(yy_out) = stdout; -#endif - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); - - yy_load_buffer_state(TSRMLS_C); + zendlval->type = IS_STRING; + HANDLE_NEWLINES(yytext, yyleng); + return T_INLINE_HTML; +} +yy6: + YYDEBUG(6, *YYCURSOR); + yych = *++YYCURSOR; + goto yy5; +yy7: + YYDEBUG(7, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'O') { + if (yych == '=') goto yy47; + } else { + if (yych <= 'P') goto yy49; + if (yych == 'p') goto yy49; } - - while ( 1 ) /* loops until end-of-file is reached */ +yy8: + YYDEBUG(8, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + if (CG(short_tags)) { + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; + } else { + goto inline_char_handler; + } +} +yy9: + YYDEBUG(9, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy45; + YYDEBUG(10, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); { - yy_more_len = 0; - if ( yy_more_flag ) - { - yy_more_len = yy_c_buf_p - yytext_ptr; - yy_more_flag = 0; + if (CG(asp_tags)) { + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; + } else { + goto inline_char_handler; + } +} +yy11: + YYDEBUG(11, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy13; + if (yych == 'c') goto yy13; +yy12: + YYDEBUG(12, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 0) { + goto yy5; + } else { + goto yy8; + } +yy13: + YYDEBUG(13, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy14; + if (yych != 'r') goto yy12; +yy14: + YYDEBUG(14, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy15; + if (yych != 'i') goto yy12; +yy15: + YYDEBUG(15, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy16; + if (yych != 'p') goto yy12; +yy16: + YYDEBUG(16, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy17; + if (yych != 't') goto yy12; +yy17: + YYDEBUG(17, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy12; + if (yych == 'l') goto yy12; + goto yy19; +yy18: + YYDEBUG(18, *YYCURSOR); + ++YYCURSOR; + YYFILL(8); + yych = *YYCURSOR; +yy19: + YYDEBUG(19, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy18; + } + if (yych == 'L') goto yy20; + if (yych != 'l') goto yy12; +yy20: + YYDEBUG(20, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy21; + if (yych != 'a') goto yy12; +yy21: + YYDEBUG(21, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy22; + if (yych != 'n') goto yy12; +yy22: + YYDEBUG(22, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'G') goto yy23; + if (yych != 'g') goto yy12; +yy23: + YYDEBUG(23, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy24; + if (yych != 'u') goto yy12; +yy24: + YYDEBUG(24, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy25; + if (yych != 'a') goto yy12; +yy25: + YYDEBUG(25, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'G') goto yy26; + if (yych != 'g') goto yy12; +yy26: + YYDEBUG(26, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy27; + if (yych != 'e') goto yy12; +yy27: + YYDEBUG(27, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(28, *YYCURSOR); + if (yych <= '\r') { + if (yych <= 0x08) goto yy12; + if (yych <= '\n') goto yy27; + if (yych <= '\f') goto yy12; + goto yy27; + } else { + if (yych <= ' ') { + if (yych <= 0x1F) goto yy12; + goto yy27; + } else { + if (yych != '=') goto yy12; } - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1493 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; + } +yy29: + YYDEBUG(29, *YYCURSOR); + ++YYCURSOR; + YYFILL(5); + yych = *YYCURSOR; + YYDEBUG(30, *YYCURSOR); + if (yych <= '!') { + if (yych <= '\f') { + if (yych <= 0x08) goto yy12; + if (yych <= '\n') goto yy29; + goto yy12; + } else { + if (yych <= '\r') goto yy29; + if (yych == ' ') goto yy29; + goto yy12; } - while ( yy_base[yy_current_state] != 8966 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; + } else { + if (yych <= 'O') { + if (yych <= '"') goto yy32; + if (yych == '\'') goto yy33; + goto yy12; + } else { + if (yych <= 'P') goto yy31; + if (yych != 'p') goto yy12; } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -{ - return T_EXIT; -} - YY_BREAK -case 2: -YY_RULE_SETUP -{ - return T_EXIT; + } +yy31: + YYDEBUG(31, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy44; + if (yych == 'h') goto yy44; + goto yy12; +yy32: + YYDEBUG(32, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy41; + if (yych == 'p') goto yy41; + goto yy12; +yy33: + YYDEBUG(33, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy34; + if (yych != 'p') goto yy12; +yy34: + YYDEBUG(34, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy35; + if (yych != 'h') goto yy12; +yy35: + YYDEBUG(35, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy36; + if (yych != 'p') goto yy12; +yy36: + YYDEBUG(36, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '\'') goto yy12; +yy37: + YYDEBUG(37, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(38, *YYCURSOR); + if (yych <= '\r') { + if (yych <= 0x08) goto yy12; + if (yych <= '\n') goto yy37; + if (yych <= '\f') goto yy12; + goto yy37; + } else { + if (yych <= ' ') { + if (yych <= 0x1F) goto yy12; + goto yy37; + } else { + if (yych != '>') goto yy12; + } + } + YYDEBUG(39, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(40, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + HANDLE_NEWLINES(yytext, yyleng); + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; } - YY_BREAK -case 3: -YY_RULE_SETUP -{ - return T_FUNCTION; +yy41: + YYDEBUG(41, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy42; + if (yych != 'h') goto yy12; +yy42: + YYDEBUG(42, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy43; + if (yych != 'p') goto yy12; +yy43: + YYDEBUG(43, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '"') goto yy37; + goto yy12; +yy44: + YYDEBUG(44, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy37; + if (yych == 'p') goto yy37; + goto yy12; +yy45: + YYDEBUG(45, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(46, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + if (CG(asp_tags)) { + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG_WITH_ECHO; + } else { + goto inline_char_handler; + } } - YY_BREAK -case 4: -YY_RULE_SETUP -{ - return T_CONST; +yy47: + YYDEBUG(47, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(48, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + if (CG(short_tags)) { + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG_WITH_ECHO; + } else { + goto inline_char_handler; + } } - YY_BREAK -case 5: -YY_RULE_SETUP -{ - return T_RETURN; +yy49: + YYDEBUG(49, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy50; + if (yych != 'h') goto yy12; +yy50: + YYDEBUG(50, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy51; + if (yych != 'p') goto yy12; +yy51: + YYDEBUG(51, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '\f') { + if (yych <= 0x08) goto yy12; + if (yych >= '\v') goto yy12; + } else { + if (yych <= '\r') goto yy54; + if (yych != ' ') goto yy12; + } +yy52: + YYDEBUG(52, *YYCURSOR); + ++YYCURSOR; +yy53: + YYDEBUG(53, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + HANDLE_NEWLINE(yytext[yyleng-1]); + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; } - YY_BREAK -case 6: -YY_RULE_SETUP -{ - return T_TRY; +yy54: + YYDEBUG(54, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy52; + goto yy53; + } +/* *********************************** */ +yyc_ST_BACKQUOTE: + { + static const unsigned char yybm[] = { + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 32, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 16, 16, 16, 16, 16, 16, + 16, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 16, 0, 16, 16, 144, + 0, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 64, 16, 16, 16, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + }; + YYDEBUG(55, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= '\\') { + if (yych <= '#') { + if (yych >= 0x01) goto yy62; + } else { + if (yych <= '$') goto yy59; + if (yych <= '[') goto yy62; + goto yy64; + } + } else { + if (yych <= '`') { + if (yych <= '_') goto yy62; + goto yy66; + } else { + if (yych == '{') goto yy60; + goto yy62; + } + } + YYDEBUG(57, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy63; +yy58: + YYDEBUG(58, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC); + return T_ENCAPSED_AND_WHITESPACE; } - YY_BREAK -case 7: -YY_RULE_SETUP -{ - return T_CATCH; +yy59: + YYDEBUG(59, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy71; + } + if (yych <= '^') { + if (yych <= 'Z') { + if (yych <= '@') goto yy62; + goto yy77; + } else { + if (yych == '\\') goto yy70; + goto yy62; + } + } else { + if (yych <= 'z') { + if (yych == '`') goto yy74; + goto yy77; + } else { + if (yych <= '{') goto yy80; + if (yych <= '~') goto yy62; + goto yy77; + } + } +yy60: + YYDEBUG(60, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy75; + } + if (yych == '$') goto yy61; + if (yych == '`') goto yy74; + goto yy63; +yy61: + YYDEBUG(61, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zendlval->value.lval = (long) '{'; + yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); + return T_CURLY_OPEN; } - YY_BREAK -case 8: -YY_RULE_SETUP -{ - return T_THROW; +yy62: + YYDEBUG(62, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy63: + YYDEBUG(63, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy62; + } + if (yych <= '[') goto yy69; + if (yych <= '\\') goto yy64; + if (yych <= 'z') goto yy58; + goto yy68; +yy64: + YYDEBUG(64, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych >= 0x01) goto yy62; +yy65: + YYDEBUG(65, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy58; + } else { + goto yy61; + } + } else { + if (yyaccept <= 2) { + goto yy73; + } else { + goto yy79; + } + } +yy66: + YYDEBUG(66, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(67, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + BEGIN(ST_IN_SCRIPTING); + return '`'; } - YY_BREAK -case 9: -YY_RULE_SETUP -{ - return T_IF; +yy68: + YYDEBUG(68, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy62; + } + if (yych <= '[') goto yy65; + if (yych <= '\\') goto yy64; + if (yych <= 'z') goto yy74; + goto yy75; +yy69: + YYDEBUG(69, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy71; + } + if (yych <= '^') { + if (yych <= 'Z') { + if (yych <= '@') goto yy62; + goto yy65; + } else { + if (yych != '\\') goto yy62; + } + } else { + if (yych <= '`') { + if (yych <= '_') goto yy65; + goto yy74; + } else { + if (yych <= '{') goto yy65; + if (yych <= '~') goto yy62; + goto yy65; + } + } +yy70: + YYDEBUG(70, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x00) goto yy65; + goto yy62; +yy71: + YYDEBUG(71, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(72, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy71; + } + if (yych <= '^') { + if (yych <= 'Z') { + if (yych <= '@') goto yy62; + } else { + if (yych == '\\') goto yy70; + goto yy62; + } + } else { + if (yych <= '`') { + if (yych >= '`') goto yy74; + } else { + if (yych <= '{') goto yy73; + if (yych <= '~') goto yy62; + } + } +yy73: + YYDEBUG(73, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(yyleng - 1); + zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC); + return T_ENCAPSED_AND_WHITESPACE; } - YY_BREAK -case 10: -YY_RULE_SETUP -{ - return T_ELSEIF; +yy74: + YYDEBUG(74, *YYCURSOR); + yych = *++YYCURSOR; + goto yy73; +yy75: + YYDEBUG(75, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(76, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy62; + } + if (yych <= '[') goto yy73; + if (yych <= '\\') goto yy64; + if (yych <= 'z') goto yy74; + goto yy75; +yy77: + YYDEBUG(77, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; + YYDEBUG(78, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy77; + } + if (yych == '-') goto yy82; + if (yych == '[') goto yy83; +yy79: + YYDEBUG(79, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; } - YY_BREAK -case 11: -YY_RULE_SETUP -{ - return T_ENDIF; +yy80: + YYDEBUG(80, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(81, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); + return T_DOLLAR_OPEN_CURLY_BRACES; } - YY_BREAK -case 12: -YY_RULE_SETUP -{ - return T_ELSE; +yy82: + YYDEBUG(82, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '>') goto yy85; + goto yy65; +yy83: + YYDEBUG(83, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(84, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(yyleng - 1); + yy_push_state(ST_VAR_OFFSET TSRMLS_CC); + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; } - YY_BREAK -case 13: -YY_RULE_SETUP -{ - return T_WHILE; +yy85: + YYDEBUG(85, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '_') { + if (yych <= '@') goto yy65; + if (yych <= 'Z') goto yy86; + if (yych <= '^') goto yy65; + } else { + if (yych <= '`') goto yy65; + if (yych <= 'z') goto yy86; + if (yych <= '~') goto yy65; + } +yy86: + YYDEBUG(86, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(87, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(yyleng - 3); + yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; } - YY_BREAK -case 14: -YY_RULE_SETUP -{ - return T_ENDWHILE; + } +/* *********************************** */ +yyc_ST_COMMENT: + { + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + YYDEBUG(88, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= 0x00) goto yy90; + if (yych == '*') goto yy95; + goto yy92; +yy90: + YYDEBUG(90, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 128) { + goto yy92; + } + YYDEBUG(91, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno)); + return 0; } - YY_BREAK -case 15: -YY_RULE_SETUP -{ - return T_DO; +yy92: + YYDEBUG(92, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(93, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy92; + } + YYDEBUG(94, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yymore(); } - YY_BREAK -case 16: -YY_RULE_SETUP -{ - return T_FOR; +yy95: + YYDEBUG(95, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '/') goto yy97; + YYDEBUG(96, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yymore(); } - YY_BREAK -case 17: -YY_RULE_SETUP -{ - return T_ENDFOR; +yy97: + YYDEBUG(97, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(98, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + HANDLE_NEWLINES(yytext, yyleng); + BEGIN(ST_IN_SCRIPTING); + return T_COMMENT; } - YY_BREAK -case 18: -YY_RULE_SETUP -{ - return T_FOREACH; + } +/* *********************************** */ +yyc_ST_DOC_COMMENT: + { + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + YYDEBUG(99, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= 0x00) goto yy101; + if (yych == '*') goto yy106; + goto yy103; +yy101: + YYDEBUG(101, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 128) { + goto yy103; + } + YYDEBUG(102, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno)); + return 0; } - YY_BREAK -case 19: -YY_RULE_SETUP -{ - return T_ENDFOREACH; +yy103: + YYDEBUG(103, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(104, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy103; + } + YYDEBUG(105, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yymore(); } - YY_BREAK -case 20: -YY_RULE_SETUP -{ - return T_DECLARE; +yy106: + YYDEBUG(106, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '/') goto yy108; + YYDEBUG(107, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yymore(); } - YY_BREAK -case 21: -YY_RULE_SETUP -{ - return T_ENDDECLARE; -} - YY_BREAK -case 22: -YY_RULE_SETUP -{ - return T_INSTANCEOF; -} - YY_BREAK -case 23: -YY_RULE_SETUP -{ - return T_AS; -} - YY_BREAK -case 24: -YY_RULE_SETUP -{ - return T_SWITCH; -} - YY_BREAK -case 25: -YY_RULE_SETUP -{ - return T_ENDSWITCH; -} - YY_BREAK -case 26: -YY_RULE_SETUP -{ - return T_CASE; -} - YY_BREAK -case 27: -YY_RULE_SETUP -{ - return T_DEFAULT; -} - YY_BREAK -case 28: -YY_RULE_SETUP -{ - return T_BREAK; +yy108: + YYDEBUG(108, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(109, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + CG(doc_comment) = estrndup(yytext, yyleng); + CG(doc_comment_len) = yyleng; + HANDLE_NEWLINES(yytext, yyleng); + BEGIN(ST_IN_SCRIPTING); + return T_DOC_COMMENT; } - YY_BREAK -case 29: -YY_RULE_SETUP -{ - return T_CONTINUE; + } +/* *********************************** */ +yyc_ST_DOUBLE_QUOTES: + { + static const unsigned char yybm[] = { + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 0, 16, 32, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 16, 16, 16, 16, 16, 16, + 16, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 16, 0, 16, 16, 144, + 16, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 64, 16, 16, 16, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + }; + YYDEBUG(110, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= '$') { + if (yych <= '!') { + if (yych >= 0x01) goto yy117; + } else { + if (yych <= '"') goto yy121; + if (yych <= '#') goto yy117; + goto yy114; + } + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy117; + goto yy119; + } else { + if (yych == '{') goto yy115; + goto yy117; + } + } + YYDEBUG(112, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy118; +yy113: + YYDEBUG(113, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC); + return T_ENCAPSED_AND_WHITESPACE; } - YY_BREAK -case 30: -YY_RULE_SETUP -{ - return T_ECHO; +yy114: + YYDEBUG(114, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy126; + } + if (yych <= '\\') { + if (yych <= '@') { + if (yych == '"') goto yy129; + goto yy117; + } else { + if (yych <= 'Z') goto yy132; + if (yych <= '[') goto yy117; + goto yy125; + } + } else { + if (yych <= '`') { + if (yych == '_') goto yy132; + goto yy117; + } else { + if (yych <= 'z') goto yy132; + if (yych <= '{') goto yy135; + if (yych <= '~') goto yy117; + goto yy132; + } + } +yy115: + YYDEBUG(115, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy130; + } + if (yych == '"') goto yy129; + if (yych != '$') goto yy118; +yy116: + YYDEBUG(116, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zendlval->value.lval = (long) '{'; + yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); + return T_CURLY_OPEN; } - YY_BREAK -case 31: -YY_RULE_SETUP -{ - return T_PRINT; +yy117: + YYDEBUG(117, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy118: + YYDEBUG(118, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy117; + } + if (yych <= '#') goto yy113; + if (yych <= '$') goto yy124; + if (yych >= '{') goto yy123; +yy119: + YYDEBUG(119, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych >= 0x01) goto yy117; +yy120: + YYDEBUG(120, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy113; + } else { + goto yy116; + } + } else { + if (yyaccept <= 2) { + goto yy128; + } else { + goto yy134; + } + } +yy121: + YYDEBUG(121, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(122, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + BEGIN(ST_IN_SCRIPTING); + return '"'; } - YY_BREAK -case 32: -YY_RULE_SETUP -{ - return T_CLASS; +yy123: + YYDEBUG(123, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy117; + } + if (yych <= '#') goto yy129; + if (yych <= '$') goto yy120; + if (yych <= 'z') goto yy119; + goto yy130; +yy124: + YYDEBUG(124, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy126; + } + if (yych <= '\\') { + if (yych <= '@') { + if (yych == '"') goto yy129; + goto yy117; + } else { + if (yych <= 'Z') goto yy120; + if (yych <= '[') goto yy117; + } + } else { + if (yych <= '`') { + if (yych == '_') goto yy120; + goto yy117; + } else { + if (yych <= '{') goto yy120; + if (yych <= '~') goto yy117; + goto yy120; + } + } +yy125: + YYDEBUG(125, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x00) goto yy120; + goto yy117; +yy126: + YYDEBUG(126, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(127, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy126; + } + if (yych <= '\\') { + if (yych <= '@') { + if (yych == '"') goto yy129; + goto yy117; + } else { + if (yych <= 'Z') goto yy128; + if (yych <= '[') goto yy117; + goto yy125; + } + } else { + if (yych <= '`') { + if (yych != '_') goto yy117; + } else { + if (yych <= '{') goto yy128; + if (yych <= '~') goto yy117; + } + } +yy128: + YYDEBUG(128, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(yyleng - 1); + zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC); + return T_ENCAPSED_AND_WHITESPACE; } - YY_BREAK -case 33: -YY_RULE_SETUP -{ - return T_INTERFACE; +yy129: + YYDEBUG(129, *YYCURSOR); + yych = *++YYCURSOR; + goto yy128; +yy130: + YYDEBUG(130, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(131, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy117; + } + if (yych <= '#') goto yy129; + if (yych <= '$') goto yy128; + if (yych <= 'z') goto yy119; + goto yy130; +yy132: + YYDEBUG(132, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; + YYDEBUG(133, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy132; + } + if (yych == '-') goto yy137; + if (yych == '[') goto yy138; +yy134: + YYDEBUG(134, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; } - YY_BREAK -case 34: -YY_RULE_SETUP -{ - return T_EXTENDS; +yy135: + YYDEBUG(135, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(136, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); + return T_DOLLAR_OPEN_CURLY_BRACES; } - YY_BREAK -case 35: -YY_RULE_SETUP -{ - return T_IMPLEMENTS; +yy137: + YYDEBUG(137, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '>') goto yy140; + goto yy120; +yy138: + YYDEBUG(138, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(139, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(yyleng - 1); + yy_push_state(ST_VAR_OFFSET TSRMLS_CC); + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; } - YY_BREAK -case 36: -YY_RULE_SETUP -{ +yy140: + YYDEBUG(140, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '_') { + if (yych <= '@') goto yy120; + if (yych <= 'Z') goto yy141; + if (yych <= '^') goto yy120; + } else { + if (yych <= '`') goto yy120; + if (yych <= 'z') goto yy141; + if (yych <= '~') goto yy120; + } +yy141: + YYDEBUG(141, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(142, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); - return T_OBJECT_OPERATOR; -} - YY_BREAK -case 37: -YY_RULE_SETUP -{ - return T_OBJECT_OPERATOR; -} - YY_BREAK -case 38: -YY_RULE_SETUP -{ - yy_pop_state(TSRMLS_C); - zend_copy_value(zendlval, yytext, yyleng); + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; - return T_STRING; -} - YY_BREAK -case 39: -YY_RULE_SETUP -{ - yyless(0); - yy_pop_state(TSRMLS_C); -} - YY_BREAK -case 40: -YY_RULE_SETUP -{ - return T_PAAMAYIM_NEKUDOTAYIM; -} - YY_BREAK -case 41: -YY_RULE_SETUP -{ - return T_NEW; -} - YY_BREAK -case 42: -YY_RULE_SETUP -{ - return T_CLONE; -} - YY_BREAK -case 43: -YY_RULE_SETUP -{ - return T_VAR; -} - YY_BREAK -case 44: -YY_RULE_SETUP -{ - return T_INT_CAST; -} - YY_BREAK -case 45: -YY_RULE_SETUP -{ - return T_DOUBLE_CAST; -} - YY_BREAK -case 46: -YY_RULE_SETUP -{ - return T_STRING_CAST; -} - YY_BREAK -case 47: -YY_RULE_SETUP -{ - return T_STRING_CAST; -} - YY_BREAK -case 48: -YY_RULE_SETUP -{ - return T_ARRAY_CAST; -} - YY_BREAK -case 49: -YY_RULE_SETUP -{ - return T_OBJECT_CAST; -} - YY_BREAK -case 50: -YY_RULE_SETUP -{ - return T_BOOL_CAST; + return T_VARIABLE; } - YY_BREAK -case 51: -YY_RULE_SETUP -{ - return T_UNSET_CAST; + } +/* *********************************** */ +yyc_ST_END_HEREDOC: + YYDEBUG(143, *YYCURSOR); + YYFILL(1); + yych = *YYCURSOR; + if (yych >= 0x01) goto yy147; + YYDEBUG(145, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(146, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return 0; } +yy147: + YYDEBUG(147, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(148, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + YYCURSOR += CG(heredoc_len) - 1; + yyleng = CG(heredoc_len); + + Z_STRVAL_P(zendlval) = CG(heredoc); + Z_STRLEN_P(zendlval) = CG(heredoc_len); + CG(heredoc) = NULL; + CG(heredoc_len) = 0; + BEGIN(ST_IN_SCRIPTING); + return T_END_HEREDOC; } - YY_BREAK -case 52: -YY_RULE_SETUP -{ - return T_EVAL; +/* *********************************** */ +yyc_ST_HEREDOC: + { + static const unsigned char yybm[] = { + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 16, 4, 4, 32, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 64, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 4, 4, 4, 4, 4, 4, + 4, 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, 4, 0, 4, 4, 8, + 4, 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, 128, 4, 4, 4, 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, 8, + }; + YYDEBUG(149, *YYCURSOR); + YYFILL(2); + yych = *(YYMARKER = YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '[') { + if (yych <= '#') { + if (yych <= 0x00) goto yy152; + if (yych == '\r') goto yy163; + goto yy156; + } else { + if (yych <= '$') goto yy153; + if (yych <= '@') goto yy156; + if (yych <= 'Z') goto yy158; + goto yy156; + } + } else { + if (yych <= '`') { + if (yych <= '\\') goto yy160; + if (yych == '_') goto yy158; + goto yy156; + } else { + if (yych <= 'z') goto yy158; + if (yych <= '{') goto yy154; + if (yych <= '~') goto yy156; + goto yy158; + } + } +yy151: + YYDEBUG(151, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_scan_escape_string(zendlval, yytext, yyleng, 0 TSRMLS_CC); + return T_ENCAPSED_AND_WHITESPACE; } - YY_BREAK -case 53: -YY_RULE_SETUP -{ - return T_INCLUDE; +yy152: + YYDEBUG(152, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy157; +yy153: + YYDEBUG(153, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '\\') { + if (yych <= '@') { + if (yych == '$') goto yy198; + goto yy157; + } else { + if (yych <= 'Z') goto yy202; + if (yych <= '[') goto yy157; + goto yy191; + } + } else { + if (yych <= '`') { + if (yych == '_') goto yy202; + goto yy157; + } else { + if (yych <= 'z') goto yy202; + if (yych <= '{') goto yy205; + if (yych <= '~') goto yy157; + goto yy202; + } + } +yy154: + YYDEBUG(154, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy156; + goto yy160; + } else { + if (yych == '{') goto yy200; + goto yy156; + } + } +yy155: + YYDEBUG(155, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zendlval->value.lval = (long) '{'; + yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); + return T_CURLY_OPEN; } - YY_BREAK -case 54: -YY_RULE_SETUP -{ - return T_INCLUDE_ONCE; +yy156: + YYDEBUG(156, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy157: + YYDEBUG(157, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '[') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + if (yych <= '@') goto yy197; + } else { + if (yych <= '\\') goto yy160; + if (yych == '{') goto yy196; + } +yy158: + YYDEBUG(158, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(159, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '@') { + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + goto yy190; + } else { + if (yych <= '9') { + if (yych <= '/') goto yy156; + goto yy158; + } else { + if (yych == ';') goto yy188; + goto yy156; + } + } + } else { + if (yych <= '_') { + if (yych <= '[') { + if (yych <= 'Z') goto yy158; + goto yy156; + } else { + if (yych <= '\\') goto yy160; + if (yych <= '^') goto yy156; + goto yy158; + } + } else { + if (yych <= 'z') { + if (yych <= '`') goto yy156; + goto yy158; + } else { + if (yych <= '{') goto yy189; + if (yych <= '~') goto yy156; + goto yy158; + } + } + } +yy160: + YYDEBUG(160, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych == '\r') goto yy163; + goto yy156; +yy161: + YYDEBUG(161, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(162, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '[') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + if (yych <= '@') goto yy169; + goto yy165; + } else { + if (yych <= '\\') goto yy170; + if (yych == '{') goto yy167; + goto yy165; + } +yy163: + YYDEBUG(163, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(164, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '[') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + if (yych <= '@') goto yy169; + } else { + if (yych <= '\\') goto yy170; + if (yych == '{') goto yy167; + } +yy165: + YYDEBUG(165, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(166, *YYCURSOR); + if (yych <= ';') { + if (yych <= '#') { + if (yych <= '\n') { + if (yych <= '\t') goto yy156; + goto yy181; + } else { + if (yych == '\r') goto yy181; + goto yy156; + } + } else { + if (yych <= '/') { + if (yych <= '$') goto yy180; + goto yy156; + } else { + if (yych <= '9') goto yy165; + if (yych <= ':') goto yy156; + goto yy177; + } + } + } else { + if (yych <= '^') { + if (yych <= 'Z') { + if (yych <= '@') goto yy156; + goto yy165; + } else { + if (yych == '\\') goto yy178; + goto yy156; + } + } else { + if (yych <= 'z') { + if (yych == '`') goto yy156; + goto yy165; + } else { + if (yych <= '{') goto yy179; + if (yych <= '~') goto yy156; + goto yy165; + } + } + } +yy167: + YYDEBUG(167, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy156; + goto yy170; + } else { + if (yych == '{') goto yy175; + goto yy156; + } + } +yy168: + YYDEBUG(168, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy151; + } else { + goto yy155; + } + } else { + if (yyaccept <= 2) { + goto yy174; + } else { + goto yy204; + } + } +yy169: + YYDEBUG(169, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '@') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + goto yy172; + } else { + if (yych == '\\') goto yy171; + goto yy168; + } +yy170: + YYDEBUG(170, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych == '\r') goto yy163; + goto yy156; +yy171: + YYDEBUG(171, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych == '\r') goto yy163; + goto yy156; +yy172: + YYDEBUG(172, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(173, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '@') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + goto yy172; + } else { + if (yych == '\\') goto yy171; + } +yy174: + YYDEBUG(174, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(yyleng - 1); + zend_scan_escape_string(zendlval, yytext, yyleng, 0 TSRMLS_CC); + return T_ENCAPSED_AND_WHITESPACE; } - YY_BREAK -case 55: -YY_RULE_SETUP -{ - return T_REQUIRE; +yy175: + YYDEBUG(175, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(176, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + goto yy174; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy156; + goto yy170; + } else { + if (yych == '{') goto yy175; + goto yy156; + } + } +yy177: + YYDEBUG(177, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= '#') { + if (yych <= '\n') { + if (yych <= '\t') goto yy156; + goto yy181; + } else { + if (yych == '\r') goto yy181; + goto yy156; + } + } else { + if (yych <= '\\') { + if (yych <= '$') goto yy180; + if (yych <= '[') goto yy156; + } else { + if (yych == '{') goto yy179; + goto yy156; + } + } +yy178: + YYDEBUG(178, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych == '\r') goto yy163; + goto yy156; +yy179: + YYDEBUG(179, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + goto yy168; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy156; + goto yy178; + } else { + if (yych == '{') goto yy186; + goto yy156; + } + } +yy180: + YYDEBUG(180, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '@') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + goto yy183; + } else { + if (yych == '\\') goto yy185; + goto yy168; + } +yy181: + YYDEBUG(181, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(182, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + char *end = yytext + yyleng - 1; + + if (end[-1] == ';') { + end--; + yyleng--; + } + + if (yyleng > CG(heredoc_len) && !memcmp(end - CG(heredoc_len), CG(heredoc), CG(heredoc_len))) { + int len = yyleng - CG(heredoc_len) - 2; /* 2 for newline before and after label */ + + /* May have matched fooLABEL; make sure there's a newline before it */ + if (yytext[len] != '\n') { + if (yytext[len] != '\r') { + yyless(yyleng - 1); + yymore(); + } + } else if (len > 0 && yytext[len - 1] == '\r') { + len--; /* Windows newline */ + } + + /* Go back before label, to match in ST_END_HEREDOC state. yytext will include + * newline before label, for zend_highlight/strip, tokenizer, etc. */ + yyless(yyleng - CG(heredoc_len) - 1); /* 1 for newline after label */ + + CG(increment_lineno) = 1; /* For newline before label */ + BEGIN(ST_END_HEREDOC); + zend_scan_escape_string(zendlval, yytext, len, 0 TSRMLS_CC); + return T_ENCAPSED_AND_WHITESPACE; + } else { + /* Go back to end of label, so the next match works correctly in case of + * a variable or another label at the beginning of the next line */ + yyless(yyleng - 1); + yymore(); + } } - YY_BREAK -case 56: -YY_RULE_SETUP -{ - return T_REQUIRE_ONCE; +yy183: + YYDEBUG(183, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(184, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '@') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + goto yy183; + } else { + if (yych != '\\') goto yy174; + } +yy185: + YYDEBUG(185, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych == '\r') goto yy163; + goto yy156; +yy186: + YYDEBUG(186, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(187, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + goto yy174; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy156; + goto yy178; + } else { + if (yych == '{') goto yy186; + goto yy156; + } + } +yy188: + YYDEBUG(188, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '[') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + if (yych <= '@') goto yy190; + goto yy158; + } else { + if (yych <= '\\') goto yy160; + if (yych != '{') goto yy158; + } +yy189: + YYDEBUG(189, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + goto yy168; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy156; + goto yy160; + } else { + if (yych == '{') goto yy194; + goto yy156; + } + } +yy190: + YYDEBUG(190, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '@') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + goto yy192; + } else { + if (yych != '\\') goto yy168; + } +yy191: + YYDEBUG(191, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych == '\r') goto yy163; + goto yy156; +yy192: + YYDEBUG(192, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(193, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '@') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + goto yy192; + } else { + if (yych == '\\') goto yy191; + goto yy174; + } +yy194: + YYDEBUG(194, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(195, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + goto yy174; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy156; + goto yy160; + } else { + if (yych == '{') goto yy194; + goto yy156; + } + } +yy196: + YYDEBUG(196, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + goto yy168; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy156; + goto yy160; + } else { + if (yych == '{') goto yy200; + goto yy156; + } + } +yy197: + YYDEBUG(197, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '@') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + } else { + if (yych == '\\') goto yy191; + goto yy168; + } +yy198: + YYDEBUG(198, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(199, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy156; + } + if (yych <= '@') { + if (yych <= '\f') goto yy161; + if (yych <= '\r') goto yy163; + goto yy198; + } else { + if (yych == '\\') goto yy191; + goto yy174; + } +yy200: + YYDEBUG(200, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(201, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy161; + } + if (yych <= '$') { + if (yych == '\r') goto yy163; + if (yych <= '#') goto yy156; + goto yy174; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy156; + goto yy160; + } else { + if (yych == '{') goto yy200; + goto yy156; + } + } +yy202: + YYDEBUG(202, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; + YYDEBUG(203, *YYCURSOR); + if (yych <= 'Z') { + if (yych <= '/') { + if (yych == '-') goto yy207; + } else { + if (yych <= '9') goto yy202; + if (yych >= 'A') goto yy202; + } + } else { + if (yych <= '_') { + if (yych <= '[') goto yy208; + if (yych >= '_') goto yy202; + } else { + if (yych <= '`') goto yy204; + if (yych <= 'z') goto yy202; + if (yych >= 0x7F) goto yy202; + } + } +yy204: + YYDEBUG(204, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; } - YY_BREAK -case 57: -YY_RULE_SETUP -{ - return T_USE; +yy205: + YYDEBUG(205, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(206, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); + return T_DOLLAR_OPEN_CURLY_BRACES; } - YY_BREAK -case 58: -YY_RULE_SETUP -{ - return T_GLOBAL; +yy207: + YYDEBUG(207, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '>') goto yy210; + goto yy168; +yy208: + YYDEBUG(208, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(209, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(yyleng - 1); + yy_push_state(ST_VAR_OFFSET TSRMLS_CC); + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; } - YY_BREAK -case 59: -YY_RULE_SETUP -{ - return T_ISSET; +yy210: + YYDEBUG(210, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '_') { + if (yych <= '@') goto yy168; + if (yych <= 'Z') goto yy211; + if (yych <= '^') goto yy168; + } else { + if (yych <= '`') goto yy168; + if (yych <= 'z') goto yy211; + if (yych <= '~') goto yy168; + } +yy211: + YYDEBUG(211, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(212, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(yyleng - 3); + yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; } - YY_BREAK -case 60: -YY_RULE_SETUP -{ - return T_EMPTY; + } +/* *********************************** */ +yyc_ST_IN_SCRIPTING: + { + static const unsigned char yybm[] = { + /* table 1 .. 8: 0 */ + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 194, 66, 2, 2, 66, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 194, 2, 0, 2, 4, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 2, 2, 2, 2, 2, 2, + 2, 42, 42, 42, 42, 42, 42, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 2, 0, 2, 2, 10, + 2, 42, 42, 42, 42, 42, 42, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 1, 2, 2, 2, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + /* table 9 .. 9: 256 */ + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 0, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 0, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + YYDEBUG(213, *YYCURSOR); + YYFILL(16); + yych = *YYCURSOR; + YYDEBUG(-1, yych); + switch (yych) { + case 0x00: goto yy215; + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\v': + case '\f': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: goto yy277; + case '\t': + case '\n': + case '\r': + case ' ': goto yy233; + case '!': goto yy246; + case '"': goto yy271; + case '#': goto yy269; + case '$': goto yy258; + case '%': goto yy252; + case '&': goto yy253; + case '\'': goto yy273; + case '(': goto yy240; + case ')': + case ',': + case ';': + case '@': + case '[': + case ']': + case '~': goto yy259; + case '*': goto yy249; + case '+': goto yy245; + case '-': goto yy231; + case '.': goto yy251; + case '/': goto yy250; + case '0': goto yy265; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy267; + case ':': goto yy235; + case '<': goto yy247; + case '=': goto yy243; + case '>': goto yy248; + case '?': goto yy260; + case 'A': + case 'a': goto yy226; + case 'B': + case 'b': goto yy228; + case 'C': + case 'c': goto yy221; + case 'D': + case 'd': goto yy219; + case 'E': + case 'e': goto yy217; + case 'F': + case 'f': goto yy220; + case 'G': + case 'g': goto yy229; + case 'I': + case 'i': goto yy224; + case 'L': + case 'l': goto yy244; + case 'N': + case 'n': goto yy238; + case 'O': + case 'o': goto yy256; + case 'P': + case 'p': goto yy230; + case 'R': + case 'r': goto yy222; + case 'S': + case 's': goto yy227; + case 'T': + case 't': goto yy223; + case 'U': + case 'u': goto yy241; + case 'V': + case 'v': goto yy239; + case 'W': + case 'w': goto yy225; + case 'X': + case 'x': goto yy257; + case '\\': goto yy236; + case '^': goto yy255; + case '_': goto yy242; + case '`': goto yy275; + case '{': goto yy261; + case '|': goto yy254; + case '}': goto yy263; + default: goto yy268; + } +yy215: + YYDEBUG(215, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(216, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return 0; } +yy217: + YYDEBUG(217, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(-1, yych); + switch ((yych = *YYCURSOR)) { + case 'C': + case 'c': goto yy809; + case 'L': + case 'l': goto yy810; + case 'M': + case 'm': goto yy811; + case 'N': + case 'n': goto yy812; + case 'V': + case 'v': goto yy813; + case 'X': + case 'x': goto yy814; + default: goto yy295; + } +yy218: + YYDEBUG(218, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_copy_value(zendlval, yytext, yyleng); + zendlval->type = IS_STRING; + return T_STRING; } - YY_BREAK -case 61: -YY_RULE_SETUP -{ - return T_HALT_COMPILER; +yy219: + YYDEBUG(219, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'O') { + if (yych <= 'H') { + if (yych == 'E') goto yy791; + goto yy295; + } else { + if (yych <= 'I') goto yy792; + if (yych <= 'N') goto yy295; + goto yy793; + } + } else { + if (yych <= 'h') { + if (yych == 'e') goto yy791; + goto yy295; + } else { + if (yych <= 'i') goto yy792; + if (yych == 'o') goto yy793; + goto yy295; + } + } +yy220: + YYDEBUG(220, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'U') { + if (yych <= 'N') { + if (yych == 'I') goto yy770; + goto yy295; + } else { + if (yych <= 'O') goto yy771; + if (yych <= 'T') goto yy295; + goto yy772; + } + } else { + if (yych <= 'n') { + if (yych == 'i') goto yy770; + goto yy295; + } else { + if (yych <= 'o') goto yy771; + if (yych == 'u') goto yy772; + goto yy295; + } + } +yy221: + YYDEBUG(221, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'O') { + if (yych <= 'K') { + if (yych == 'A') goto yy742; + goto yy295; + } else { + if (yych <= 'L') goto yy743; + if (yych <= 'N') goto yy295; + goto yy744; + } + } else { + if (yych <= 'k') { + if (yych == 'a') goto yy742; + goto yy295; + } else { + if (yych <= 'l') goto yy743; + if (yych == 'o') goto yy744; + goto yy295; + } + } +yy222: + YYDEBUG(222, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy724; + if (yych == 'e') goto yy724; + goto yy295; +yy223: + YYDEBUG(223, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'R') { + if (yych == 'H') goto yy716; + if (yych <= 'Q') goto yy295; + goto yy717; + } else { + if (yych <= 'h') { + if (yych <= 'g') goto yy295; + goto yy716; + } else { + if (yych == 'r') goto yy717; + goto yy295; + } + } +yy224: + YYDEBUG(224, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'S') { + if (yych <= 'L') { + if (yych == 'F') goto yy669; + goto yy295; + } else { + if (yych <= 'M') goto yy671; + if (yych <= 'N') goto yy672; + if (yych <= 'R') goto yy295; + goto yy673; + } + } else { + if (yych <= 'm') { + if (yych == 'f') goto yy669; + if (yych <= 'l') goto yy295; + goto yy671; + } else { + if (yych <= 'n') goto yy672; + if (yych == 's') goto yy673; + goto yy295; + } + } +yy225: + YYDEBUG(225, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy664; + if (yych == 'h') goto yy664; + goto yy295; +yy226: + YYDEBUG(226, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'S') { + if (yych <= 'M') { + if (yych == 'B') goto yy646; + goto yy295; + } else { + if (yych <= 'N') goto yy647; + if (yych <= 'Q') goto yy295; + if (yych <= 'R') goto yy648; + goto yy649; + } + } else { + if (yych <= 'n') { + if (yych == 'b') goto yy646; + if (yych <= 'm') goto yy295; + goto yy647; + } else { + if (yych <= 'q') goto yy295; + if (yych <= 'r') goto yy648; + if (yych <= 's') goto yy649; + goto yy295; + } + } +yy227: + YYDEBUG(227, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'W') { + if (yych == 'T') goto yy634; + if (yych <= 'V') goto yy295; + goto yy635; + } else { + if (yych <= 't') { + if (yych <= 's') goto yy295; + goto yy634; + } else { + if (yych == 'w') goto yy635; + goto yy295; + } + } +yy228: + YYDEBUG(228, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'Q') { + if (yych <= '/') { + if (yych <= '"') { + if (yych <= '!') goto yy218; + goto yy627; + } else { + if (yych == '\'') goto yy278; + goto yy218; + } + } else { + if (yych <= ';') { + if (yych <= '9') goto yy294; + goto yy218; + } else { + if (yych <= '<') goto yy626; + if (yych <= '@') goto yy218; + goto yy294; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= 'R') goto yy628; + goto yy294; + } else { + if (yych == '_') goto yy294; + goto yy218; + } + } else { + if (yych <= 'r') { + if (yych <= 'q') goto yy294; + goto yy628; + } else { + if (yych <= 'z') goto yy294; + if (yych <= '~') goto yy218; + goto yy294; + } + } + } +yy229: + YYDEBUG(229, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'O') { + if (yych == 'L') goto yy616; + if (yych <= 'N') goto yy295; + goto yy617; + } else { + if (yych <= 'l') { + if (yych <= 'k') goto yy295; + goto yy616; + } else { + if (yych == 'o') goto yy617; + goto yy295; + } + } +yy230: + YYDEBUG(230, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'U') { + if (yych == 'R') goto yy592; + if (yych <= 'T') goto yy295; + goto yy593; + } else { + if (yych <= 'r') { + if (yych <= 'q') goto yy295; + goto yy592; + } else { + if (yych == 'u') goto yy593; + goto yy295; + } + } +yy231: + YYDEBUG(231, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '<') { + if (yych == '-') goto yy588; + } else { + if (yych <= '=') goto yy586; + if (yych <= '>') goto yy590; + } +yy232: + YYDEBUG(232, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return yytext[0]; } - YY_BREAK -case 62: -YY_RULE_SETUP -{ - return T_STATIC; +yy233: + YYDEBUG(233, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy585; +yy234: + YYDEBUG(234, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + HANDLE_NEWLINES(yytext, yyleng); + return T_WHITESPACE; } - YY_BREAK -case 63: -YY_RULE_SETUP -{ - return T_ABSTRACT; +yy235: + YYDEBUG(235, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == ':') goto yy582; + goto yy232; +yy236: + YYDEBUG(236, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(237, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_NS_SEPARATOR; +} +yy238: + YYDEBUG(238, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'E') { + if (yych == 'A') goto yy570; + if (yych <= 'D') goto yy295; + goto yy571; + } else { + if (yych <= 'a') { + if (yych <= '`') goto yy295; + goto yy570; + } else { + if (yych == 'e') goto yy571; + goto yy295; + } + } +yy239: + YYDEBUG(239, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy567; + if (yych == 'a') goto yy567; + goto yy295; +yy240: + YYDEBUG(240, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'S') { + if (yych <= 'D') { + if (yych <= ' ') { + if (yych == '\t') goto yy488; + if (yych <= 0x1F) goto yy232; + goto yy488; + } else { + if (yych <= '@') goto yy232; + if (yych == 'C') goto yy232; + goto yy488; + } + } else { + if (yych <= 'I') { + if (yych == 'F') goto yy488; + if (yych <= 'H') goto yy232; + goto yy488; + } else { + if (yych == 'O') goto yy488; + if (yych <= 'Q') goto yy232; + goto yy488; + } + } + } else { + if (yych <= 'f') { + if (yych <= 'b') { + if (yych == 'U') goto yy488; + if (yych <= '`') goto yy232; + goto yy488; + } else { + if (yych == 'd') goto yy488; + if (yych <= 'e') goto yy232; + goto yy488; + } + } else { + if (yych <= 'o') { + if (yych == 'i') goto yy488; + if (yych <= 'n') goto yy232; + goto yy488; + } else { + if (yych <= 's') { + if (yych <= 'q') goto yy232; + goto yy488; + } else { + if (yych == 'u') goto yy488; + goto yy232; + } + } + } + } +yy241: + YYDEBUG(241, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'S') { + if (yych == 'N') goto yy479; + if (yych <= 'R') goto yy295; + goto yy480; + } else { + if (yych <= 'n') { + if (yych <= 'm') goto yy295; + goto yy479; + } else { + if (yych == 's') goto yy480; + goto yy295; + } + } +yy242: + YYDEBUG(242, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '_') goto yy405; + goto yy295; +yy243: + YYDEBUG(243, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '<') goto yy232; + if (yych <= '=') goto yy399; + if (yych <= '>') goto yy401; + goto yy232; +yy244: + YYDEBUG(244, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy395; + if (yych == 'i') goto yy395; + goto yy295; +yy245: + YYDEBUG(245, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '+') goto yy393; + if (yych == '=') goto yy391; + goto yy232; +yy246: + YYDEBUG(246, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '=') goto yy388; + goto yy232; +yy247: + YYDEBUG(247, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= ';') { + if (yych == '/') goto yy360; + goto yy232; + } else { + if (yych <= '<') goto yy358; + if (yych <= '=') goto yy361; + if (yych <= '>') goto yy363; + goto yy232; + } +yy248: + YYDEBUG(248, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '<') goto yy232; + if (yych <= '=') goto yy354; + if (yych <= '>') goto yy352; + goto yy232; +yy249: + YYDEBUG(249, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '=') goto yy350; + goto yy232; +yy250: + YYDEBUG(250, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '.') { + if (yych == '*') goto yy341; + goto yy232; + } else { + if (yych <= '/') goto yy343; + if (yych == '=') goto yy344; + goto yy232; + } +yy251: + YYDEBUG(251, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '/') goto yy232; + if (yych <= '9') goto yy337; + if (yych == '=') goto yy339; + goto yy232; +yy252: + YYDEBUG(252, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '<') goto yy232; + if (yych <= '=') goto yy333; + if (yych <= '>') goto yy331; + goto yy232; +yy253: + YYDEBUG(253, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '&') goto yy327; + if (yych == '=') goto yy329; + goto yy232; +yy254: + YYDEBUG(254, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '=') goto yy325; + if (yych == '|') goto yy323; + goto yy232; +yy255: + YYDEBUG(255, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '=') goto yy321; + goto yy232; +yy256: + YYDEBUG(256, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy319; + if (yych == 'r') goto yy319; + goto yy295; +yy257: + YYDEBUG(257, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy316; + if (yych == 'o') goto yy316; + goto yy295; +yy258: + YYDEBUG(258, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '_') { + if (yych <= '@') goto yy232; + if (yych <= 'Z') goto yy313; + if (yych <= '^') goto yy232; + goto yy313; + } else { + if (yych <= '`') goto yy232; + if (yych <= 'z') goto yy313; + if (yych <= '~') goto yy232; + goto yy313; + } +yy259: + YYDEBUG(259, *YYCURSOR); + yych = *++YYCURSOR; + goto yy232; +yy260: + YYDEBUG(260, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '>') goto yy309; + goto yy232; +yy261: + YYDEBUG(261, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(262, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); + return '{'; +} +yy263: + YYDEBUG(263, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(264, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + RESET_DOC_COMMENT(); + if (!zend_stack_is_empty(&SCNG(state_stack))) { + yy_pop_state(TSRMLS_C); + } + return '}'; +} +yy265: + YYDEBUG(265, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'E') { + if (yych <= '/') { + if (yych == '.') goto yy296; + } else { + if (yych <= '9') goto yy299; + if (yych >= 'E') goto yy301; + } + } else { + if (yych <= 'd') { + if (yych == 'X') goto yy305; + } else { + if (yych <= 'e') goto yy301; + if (yych == 'x') goto yy305; + } + } +yy266: + YYDEBUG(266, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ + zendlval->value.lval = strtol(yytext, NULL, 0); + } else { + errno = 0; + zendlval->value.lval = strtol(yytext, NULL, 0); + if (errno == ERANGE) { /* Overflow */ + if (yytext[0] == '0') { /* octal overflow */ + zendlval->value.dval = zend_oct_strtod(yytext, NULL); + } else { + zendlval->value.dval = zend_strtod(yytext, NULL); + } + zendlval->type = IS_DOUBLE; + return T_DNUMBER; + } + } + + zendlval->type = IS_LONG; + return T_LNUMBER; +} +yy267: + YYDEBUG(267, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '9') { + if (yych == '.') goto yy296; + if (yych <= '/') goto yy266; + goto yy299; + } else { + if (yych <= 'E') { + if (yych <= 'D') goto yy266; + goto yy301; + } else { + if (yych == 'e') goto yy301; + goto yy266; + } + } +yy268: + YYDEBUG(268, *YYCURSOR); + yych = *++YYCURSOR; + goto yy295; +yy269: + YYDEBUG(269, *YYCURSOR); + ++YYCURSOR; +yy270: + YYDEBUG(270, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + BEGIN(ST_ONE_LINE_COMMENT); + yymore(); +} +yy271: + YYDEBUG(271, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + goto yy287; +yy272: + YYDEBUG(272, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + BEGIN(ST_DOUBLE_QUOTES); + return '"'; +} +yy273: + YYDEBUG(273, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + goto yy279; +yy274: + YYDEBUG(274, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); + goto restart; +} +yy275: + YYDEBUG(275, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(276, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + BEGIN(ST_BACKQUOTE); + return '`'; +} +yy277: + YYDEBUG(277, *YYCURSOR); + yych = *++YYCURSOR; + goto yy274; +yy278: + YYDEBUG(278, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy279: + YYDEBUG(279, *YYCURSOR); + if (yybm[256+yych] & 128) { + goto yy278; + } + if (yych <= '[') goto yy282; + YYDEBUG(280, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych >= 0x01) goto yy278; +yy281: + YYDEBUG(281, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 3) { + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy218; + } else { + goto yy232; + } + } else { + if (yyaccept <= 2) { + goto yy266; + } else { + goto yy272; + } + } + } else { + if (yyaccept <= 5) { + if (yyaccept <= 4) { + goto yy274; + } else { + goto yy298; + } + } else { + if (yyaccept <= 6) { + goto yy342; + } else { + goto yy359; + } + } + } +yy282: + YYDEBUG(282, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(283, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + register char *s, *t; + char *end; + int bprefix = (yytext[0] != '\'') ? 1 : 0; + + zendlval->value.str.val = estrndup(yytext+bprefix+1, yyleng-bprefix-2); + zendlval->value.str.len = yyleng-bprefix-2; + zendlval->type = IS_STRING; + + /* convert escape sequences */ + s = t = zendlval->value.str.val; + end = s+zendlval->value.str.len; + while (svalue.str.len--; + break; + default: + *t++ = '\\'; + *t++ = *s; + break; + } + } else { + *t++ = *s; + } + + if (*s == '\n' || (*s == '\r' && (*(s+1) != '\n'))) { + CG(zend_lineno)++; + } + s++; + } + *t = 0; + +#ifdef ZEND_MULTIBYTE + if (SCNG(output_filter)) { + size_t sz = 0; + s = zendlval->value.str.val; + SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)s, (size_t)zendlval->value.str.len TSRMLS_CC); + zendlval->value.str.len = sz; + efree(s); + } +#endif /* ZEND_MULTIBYTE */ + return T_CONSTANT_ENCAPSED_STRING; } - YY_BREAK -case 64: -YY_RULE_SETUP -{ - return T_FINAL; +yy284: + YYDEBUG(284, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(285, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy286; + } + if (yych <= '#') goto yy291; + if (yych <= '$') goto yy281; + if (yych <= 'z') goto yy288; + goto yy284; +yy286: + YYDEBUG(286, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy287: + YYDEBUG(287, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy286; + } + if (yych <= '#') goto yy291; + if (yych <= '$') goto yy289; + if (yych >= '{') goto yy284; +yy288: + YYDEBUG(288, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x00) goto yy281; + goto yy286; +yy289: + YYDEBUG(289, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(290, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy289; + } + if (yych <= '\\') { + if (yych <= '@') { + if (yych != '"') goto yy286; + } else { + if (yych <= 'Z') goto yy281; + if (yych <= '[') goto yy286; + goto yy293; + } + } else { + if (yych <= '`') { + if (yych == '_') goto yy281; + goto yy286; + } else { + if (yych <= '{') goto yy281; + if (yych <= '~') goto yy286; + goto yy281; + } + } +yy291: + YYDEBUG(291, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(292, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + int bprefix = (yytext[0] != '"') ? 1 : 0; + + zend_scan_escape_string(zendlval, yytext+bprefix+1, yyleng-bprefix-2, '"' TSRMLS_CC); + return T_CONSTANT_ENCAPSED_STRING; } - YY_BREAK -case 65: -YY_RULE_SETUP -{ - return T_PRIVATE; +yy293: + YYDEBUG(293, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x00) goto yy281; + goto yy286; +yy294: + YYDEBUG(294, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy295: + YYDEBUG(295, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy294; + } + goto yy218; +yy296: + YYDEBUG(296, *YYCURSOR); + yyaccept = 5; + YYMARKER = ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; + YYDEBUG(297, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy296; + } + if (yych == 'E') goto yy301; + if (yych == 'e') goto yy301; +yy298: + YYDEBUG(298, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zendlval->value.dval = zend_strtod(yytext, NULL); + zendlval->type = IS_DOUBLE; + return T_DNUMBER; } - YY_BREAK -case 66: -YY_RULE_SETUP -{ - return T_PROTECTED; +yy299: + YYDEBUG(299, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; + YYDEBUG(300, *YYCURSOR); + if (yych <= '9') { + if (yych == '.') goto yy296; + if (yych <= '/') goto yy266; + goto yy299; + } else { + if (yych <= 'E') { + if (yych <= 'D') goto yy266; + } else { + if (yych != 'e') goto yy266; + } + } +yy301: + YYDEBUG(301, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych != '+') goto yy281; + } else { + if (yych <= '-') goto yy302; + if (yych <= '/') goto yy281; + if (yych <= '9') goto yy303; + goto yy281; + } +yy302: + YYDEBUG(302, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '/') goto yy281; + if (yych >= ':') goto yy281; +yy303: + YYDEBUG(303, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(304, *YYCURSOR); + if (yych <= '/') goto yy298; + if (yych <= '9') goto yy303; + goto yy298; +yy305: + YYDEBUG(305, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy306; + } + goto yy281; +yy306: + YYDEBUG(306, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(307, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy306; + } + YYDEBUG(308, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + char *hex = yytext + 2; /* Skip "0x" */ + int len = yyleng - 2; + + /* Skip any leading 0s */ + while (*hex == '0') { + hex++; + len--; + } + + if (len < SIZEOF_LONG * 2 || (len == SIZEOF_LONG * 2 && *hex <= '7')) { + zendlval->value.lval = strtol(hex, NULL, 16); + zendlval->type = IS_LONG; + return T_LNUMBER; + } else { + zendlval->value.dval = zend_hex_strtod(hex, NULL); + zendlval->type = IS_DOUBLE; + return T_DNUMBER; + } } - YY_BREAK -case 67: -YY_RULE_SETUP -{ - return T_PUBLIC; +yy309: + YYDEBUG(309, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy311; + if (yych == '\r') goto yy312; +yy310: + YYDEBUG(310, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + BEGIN(INITIAL); + return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } - YY_BREAK -case 68: -YY_RULE_SETUP -{ - return T_UNSET; +yy311: + YYDEBUG(311, *YYCURSOR); + yych = *++YYCURSOR; + goto yy310; +yy312: + YYDEBUG(312, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy311; + goto yy310; +yy313: + YYDEBUG(313, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(314, *YYCURSOR); + if (yych <= '^') { + if (yych <= '9') { + if (yych >= '0') goto yy313; + } else { + if (yych <= '@') goto yy315; + if (yych <= 'Z') goto yy313; + } + } else { + if (yych <= '`') { + if (yych <= '_') goto yy313; + } else { + if (yych <= 'z') goto yy313; + if (yych >= 0x7F) goto yy313; + } + } +yy315: + YYDEBUG(315, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; } - YY_BREAK -case 69: -YY_RULE_SETUP -{ - return T_DOUBLE_ARROW; +yy316: + YYDEBUG(316, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy317; + if (yych != 'r') goto yy295; +yy317: + YYDEBUG(317, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(318, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_LOGICAL_XOR; } - YY_BREAK -case 70: -YY_RULE_SETUP -{ - return T_LIST; +yy319: + YYDEBUG(319, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(320, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_LOGICAL_OR; } - YY_BREAK -case 71: -YY_RULE_SETUP -{ - return T_ARRAY; +yy321: + YYDEBUG(321, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(322, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_XOR_EQUAL; } - YY_BREAK -case 72: -YY_RULE_SETUP -{ - return T_INC; +yy323: + YYDEBUG(323, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(324, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_BOOLEAN_OR; } - YY_BREAK -case 73: -YY_RULE_SETUP -{ - return T_DEC; +yy325: + YYDEBUG(325, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(326, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_OR_EQUAL; } - YY_BREAK -case 74: -YY_RULE_SETUP -{ - return T_IS_IDENTICAL; +yy327: + YYDEBUG(327, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(328, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_BOOLEAN_AND; } - YY_BREAK -case 75: -YY_RULE_SETUP -{ - return T_IS_NOT_IDENTICAL; +yy329: + YYDEBUG(329, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(330, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_AND_EQUAL; } - YY_BREAK -case 76: -YY_RULE_SETUP -{ - return T_IS_EQUAL; +yy331: + YYDEBUG(331, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy335; + if (yych == '\r') goto yy336; +yy332: + YYDEBUG(332, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + if (CG(asp_tags)) { + BEGIN(INITIAL); + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + zendlval->value.str.val = yytext; /* no copying - intentional */ + return T_CLOSE_TAG; /* implicit ';' at php-end tag */ + } else { + yyless(1); + return yytext[0]; + } } - YY_BREAK -case 77: -YY_RULE_SETUP -{ - return T_IS_NOT_EQUAL; +yy333: + YYDEBUG(333, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(334, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_MOD_EQUAL; } - YY_BREAK -case 78: -YY_RULE_SETUP -{ - return T_IS_SMALLER_OR_EQUAL; +yy335: + YYDEBUG(335, *YYCURSOR); + yych = *++YYCURSOR; + goto yy332; +yy336: + YYDEBUG(336, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy335; + goto yy332; +yy337: + YYDEBUG(337, *YYCURSOR); + yyaccept = 5; + YYMARKER = ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; + YYDEBUG(338, *YYCURSOR); + if (yych <= 'D') { + if (yych <= '/') goto yy298; + if (yych <= '9') goto yy337; + goto yy298; + } else { + if (yych <= 'E') goto yy301; + if (yych == 'e') goto yy301; + goto yy298; + } +yy339: + YYDEBUG(339, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(340, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_CONCAT_EQUAL; } - YY_BREAK -case 79: -YY_RULE_SETUP -{ - return T_IS_GREATER_OR_EQUAL; +yy341: + YYDEBUG(341, *YYCURSOR); + yyaccept = 6; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '*') goto yy346; +yy342: + YYDEBUG(342, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + BEGIN(ST_COMMENT); + yymore(); } - YY_BREAK -case 80: -YY_RULE_SETUP -{ - return T_PLUS_EQUAL; +yy343: + YYDEBUG(343, *YYCURSOR); + yych = *++YYCURSOR; + goto yy270; +yy344: + YYDEBUG(344, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(345, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_DIV_EQUAL; } - YY_BREAK -case 81: -YY_RULE_SETUP -{ - return T_MINUS_EQUAL; +yy346: + YYDEBUG(346, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy347; + } + goto yy281; +yy347: + YYDEBUG(347, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(348, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy347; + } + YYDEBUG(349, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + RESET_DOC_COMMENT(); + BEGIN(ST_DOC_COMMENT); + yymore(); } - YY_BREAK -case 82: -YY_RULE_SETUP -{ +yy350: + YYDEBUG(350, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(351, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return T_MUL_EQUAL; } - YY_BREAK -case 83: -YY_RULE_SETUP -{ - return T_DIV_EQUAL; -} - YY_BREAK -case 84: -YY_RULE_SETUP -{ - return T_CONCAT_EQUAL; -} - YY_BREAK -case 85: -YY_RULE_SETUP -{ - return T_MOD_EQUAL; +yy352: + YYDEBUG(352, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy356; + YYDEBUG(353, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_SR; } - YY_BREAK -case 86: -YY_RULE_SETUP -{ - return T_SL_EQUAL; +yy354: + YYDEBUG(354, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(355, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_IS_GREATER_OR_EQUAL; } - YY_BREAK -case 87: -YY_RULE_SETUP -{ +yy356: + YYDEBUG(356, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(357, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return T_SR_EQUAL; } - YY_BREAK -case 88: -YY_RULE_SETUP -{ - return T_AND_EQUAL; -} - YY_BREAK -case 89: -YY_RULE_SETUP -{ - return T_OR_EQUAL; -} - YY_BREAK -case 90: -YY_RULE_SETUP -{ - return T_XOR_EQUAL; -} - YY_BREAK -case 91: -YY_RULE_SETUP -{ - return T_BOOLEAN_OR; -} - YY_BREAK -case 92: -YY_RULE_SETUP -{ - return T_BOOLEAN_AND; -} - YY_BREAK -case 93: -YY_RULE_SETUP -{ - return T_LOGICAL_OR; -} - YY_BREAK -case 94: -YY_RULE_SETUP -{ - return T_LOGICAL_AND; -} - YY_BREAK -case 95: -YY_RULE_SETUP -{ - return T_LOGICAL_XOR; -} - YY_BREAK -case 96: -YY_RULE_SETUP -{ +yy358: + YYDEBUG(358, *YYCURSOR); + yyaccept = 7; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= ';') goto yy359; + if (yych <= '<') goto yy374; + if (yych <= '=') goto yy372; +yy359: + YYDEBUG(359, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return T_SL; } - YY_BREAK -case 97: -YY_RULE_SETUP -{ - return T_SR; -} - YY_BREAK -case 98: -YY_RULE_SETUP -{ - return yytext[0]; -} - YY_BREAK -case 99: -YY_RULE_SETUP -{ - yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); - return '{'; -} - YY_BREAK -case 100: -YY_RULE_SETUP -{ - yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); - return T_DOLLAR_OPEN_CURLY_BRACES; -} - YY_BREAK -case 101: -YY_RULE_SETUP -{ - RESET_DOC_COMMENT(); - /* This is a temporary fix which is dependant on flex and it's implementation */ - if (yy_start_stack_ptr) { - yy_pop_state(TSRMLS_C); - } - return '}'; +yy360: + YYDEBUG(360, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy365; + if (yych == 's') goto yy365; + goto yy281; +yy361: + YYDEBUG(361, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(362, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_IS_SMALLER_OR_EQUAL; } - YY_BREAK -case 102: -YY_RULE_SETUP -{ - zend_copy_value(zendlval, yytext, yyleng); - zendlval->type = IS_STRING; - yy_pop_state(TSRMLS_C); - yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); - return T_STRING_VARNAME; +yy363: + YYDEBUG(363, *YYCURSOR); + ++YYCURSOR; +yy364: + YYDEBUG(364, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_IS_NOT_EQUAL; } - YY_BREAK -case 103: -YY_RULE_SETUP -{ - yyless(0); - yy_pop_state(TSRMLS_C); - yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); +yy365: + YYDEBUG(365, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy366; + if (yych != 'c') goto yy281; +yy366: + YYDEBUG(366, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy367; + if (yych != 'r') goto yy281; +yy367: + YYDEBUG(367, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy368; + if (yych != 'i') goto yy281; +yy368: + YYDEBUG(368, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy369; + if (yych != 'p') goto yy281; +yy369: + YYDEBUG(369, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy370; + if (yych != 't') goto yy281; +yy370: + YYDEBUG(370, *YYCURSOR); + ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; + YYDEBUG(371, *YYCURSOR); + if (yych <= '\r') { + if (yych <= 0x08) goto yy281; + if (yych <= '\n') goto yy370; + if (yych <= '\f') goto yy281; + goto yy370; + } else { + if (yych <= ' ') { + if (yych <= 0x1F) goto yy281; + goto yy370; + } else { + if (yych == '>') goto yy309; + goto yy281; + } + } +yy372: + YYDEBUG(372, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(373, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_SL_EQUAL; } - YY_BREAK -case 104: -YY_RULE_SETUP -{ - if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ - zendlval->value.lval = strtol(yytext, NULL, 0); - } else { - errno = 0; - zendlval->value.lval = strtol(yytext, NULL, 0); - if (errno == ERANGE) { /* Overflow */ - if (yytext[0] == '0') { /* octal overflow */ - zendlval->value.dval = zend_oct_strtod(yytext, NULL); +yy374: + YYDEBUG(374, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; + YYDEBUG(375, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy374; + } + if (yych <= 'Z') { + if (yych <= '&') { + if (yych == '"') goto yy379; + goto yy281; + } else { + if (yych <= '\'') goto yy378; + if (yych <= '@') goto yy281; + } + } else { + if (yych <= '`') { + if (yych != '_') goto yy281; + } else { + if (yych <= 'z') goto yy376; + if (yych <= '~') goto yy281; + } + } +yy376: + YYDEBUG(376, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; + YYDEBUG(377, *YYCURSOR); + if (yych <= '@') { + if (yych <= '\f') { + if (yych == '\n') goto yy383; + goto yy281; + } else { + if (yych <= '\r') goto yy385; + if (yych <= '/') goto yy281; + if (yych <= '9') goto yy376; + goto yy281; + } + } else { + if (yych <= '_') { + if (yych <= 'Z') goto yy376; + if (yych <= '^') goto yy281; + goto yy376; + } else { + if (yych <= '`') goto yy281; + if (yych <= 'z') goto yy376; + if (yych <= '~') goto yy281; + goto yy376; + } + } +yy378: + YYDEBUG(378, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\'') goto yy281; + if (yych <= '/') goto yy387; + if (yych <= '9') goto yy281; + goto yy387; +yy379: + YYDEBUG(379, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '"') goto yy281; + if (yych <= '/') goto yy381; + if (yych <= '9') goto yy281; + goto yy381; +yy380: + YYDEBUG(380, *YYCURSOR); + ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; +yy381: + YYDEBUG(381, *YYCURSOR); + if (yych <= 'Z') { + if (yych <= '/') { + if (yych != '"') goto yy281; + } else { + if (yych <= '9') goto yy380; + if (yych <= '@') goto yy281; + goto yy380; + } + } else { + if (yych <= '`') { + if (yych == '_') goto yy380; + goto yy281; } else { - zendlval->value.dval = zend_strtod(yytext, NULL); + if (yych <= 'z') goto yy380; + if (yych <= '~') goto yy281; + goto yy380; } - zendlval->type = IS_DOUBLE; - return T_DNUMBER; } +yy382: + YYDEBUG(382, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy383; + if (yych == '\r') goto yy385; + goto yy281; +yy383: + YYDEBUG(383, *YYCURSOR); + ++YYCURSOR; +yy384: + YYDEBUG(384, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + char *s; + int bprefix = (yytext[0] != '<') ? 1 : 0; + + CG(zend_lineno)++; + CG(heredoc_len) = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0); + s = yytext+bprefix+3; + while ((*s == ' ') || (*s == '\t')) { + s++; + CG(heredoc_len)--; } - zendlval->type = IS_LONG; - return T_LNUMBER; -} - YY_BREAK -case 105: -YY_RULE_SETUP -{ - char *hex = yytext + 2; /* Skip "0x" */ - int len = yyleng - 2; + if (*s == '\'') { + s++; + CG(heredoc_len) -= 2; - /* Skip any leading 0s */ - while (*hex == '0') { - hex++; - len--; + BEGIN(ST_NOWDOC); + } else { + if (*s == '"') { + s++; + CG(heredoc_len) -= 2; + } + + BEGIN(ST_HEREDOC); } - if (len < SIZEOF_LONG * 2 || (len == SIZEOF_LONG * 2 && *hex <= '7')) { - zendlval->value.lval = strtol(hex, NULL, 16); - zendlval->type = IS_LONG; - return T_LNUMBER; - } else { - zendlval->value.dval = zend_hex_strtod(hex, NULL); - zendlval->type = IS_DOUBLE; - return T_DNUMBER; + CG(heredoc) = estrndup(s, CG(heredoc_len)); + + /* Check for ending label on the next line */ + if (CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, CG(heredoc_len))) { + unsigned char *end = YYCURSOR + CG(heredoc_len); + + if (*end == ';') { + end++; + } + + if (*end == '\n' || *end == '\r') { + BEGIN(ST_END_HEREDOC); + } } + + return T_START_HEREDOC; } - YY_BREAK -case 106: -YY_RULE_SETUP -{ /* Offset could be treated as a long */ - if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { - zendlval->value.lval = strtol(yytext, NULL, 10); - zendlval->type = IS_LONG; - } else { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - } - return T_NUM_STRING; +yy385: + YYDEBUG(385, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy383; + goto yy384; +yy386: + YYDEBUG(386, *YYCURSOR); + ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; +yy387: + YYDEBUG(387, *YYCURSOR); + if (yych <= 'Z') { + if (yych <= '/') { + if (yych == '\'') goto yy382; + goto yy281; + } else { + if (yych <= '9') goto yy386; + if (yych <= '@') goto yy281; + goto yy386; + } + } else { + if (yych <= '`') { + if (yych == '_') goto yy386; + goto yy281; + } else { + if (yych <= 'z') goto yy386; + if (yych <= '~') goto yy281; + goto yy386; + } + } +yy388: + YYDEBUG(388, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '=') goto yy364; + YYDEBUG(389, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(390, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_IS_NOT_IDENTICAL; } - YY_BREAK -case 107: -YY_RULE_SETUP -{ /* Offset must be treated as a string */ - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_NUM_STRING; +yy391: + YYDEBUG(391, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(392, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_PLUS_EQUAL; } - YY_BREAK -case 108: -YY_RULE_SETUP -{ - zendlval->value.dval = zend_strtod(yytext, NULL); - zendlval->type = IS_DOUBLE; - return T_DNUMBER; +yy393: + YYDEBUG(393, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(394, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_INC; } - YY_BREAK -case 109: -YY_RULE_SETUP -{ - char *class_name = NULL; - - if (CG(active_class_entry)) { - class_name = CG(active_class_entry)->name; +yy395: + YYDEBUG(395, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy396; + if (yych != 's') goto yy295; +yy396: + YYDEBUG(396, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy397; + if (yych != 't') goto yy295; +yy397: + YYDEBUG(397, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(398, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_LIST; +} +yy399: + YYDEBUG(399, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy403; + YYDEBUG(400, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_IS_EQUAL; +} +yy401: + YYDEBUG(401, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(402, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_DOUBLE_ARROW; +} +yy403: + YYDEBUG(403, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(404, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_IS_IDENTICAL; +} +yy405: + YYDEBUG(405, *YYCURSOR); + yych = *++YYCURSOR; + YYDEBUG(-1, yych); + switch (yych) { + case 'C': + case 'c': goto yy407; + case 'D': + case 'd': goto yy411; + case 'F': + case 'f': goto yy408; + case 'H': + case 'h': goto yy406; + case 'L': + case 'l': goto yy410; + case 'M': + case 'm': goto yy409; + case 'N': + case 'n': goto yy412; + default: goto yy295; + } +yy406: + YYDEBUG(406, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy466; + if (yych == 'a') goto yy466; + goto yy295; +yy407: + YYDEBUG(407, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy459; + if (yych == 'l') goto yy459; + goto yy295; +yy408: + YYDEBUG(408, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'U') { + if (yych == 'I') goto yy443; + if (yych <= 'T') goto yy295; + goto yy444; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy295; + goto yy443; + } else { + if (yych == 'u') goto yy444; + goto yy295; + } + } +yy409: + YYDEBUG(409, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy435; + if (yych == 'e') goto yy435; + goto yy295; +yy410: + YYDEBUG(410, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy429; + if (yych == 'i') goto yy429; + goto yy295; +yy411: + YYDEBUG(411, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy424; + if (yych == 'i') goto yy424; + goto yy295; +yy412: + YYDEBUG(412, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy413; + if (yych != 'a') goto yy295; +yy413: + YYDEBUG(413, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'M') goto yy414; + if (yych != 'm') goto yy295; +yy414: + YYDEBUG(414, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy415; + if (yych != 'e') goto yy295; +yy415: + YYDEBUG(415, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy416; + if (yych != 's') goto yy295; +yy416: + YYDEBUG(416, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy417; + if (yych != 'p') goto yy295; +yy417: + YYDEBUG(417, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy418; + if (yych != 'a') goto yy295; +yy418: + YYDEBUG(418, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy419; + if (yych != 'c') goto yy295; +yy419: + YYDEBUG(419, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy420; + if (yych != 'e') goto yy295; +yy420: + YYDEBUG(420, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(421, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(422, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(423, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + if (CG(current_namespace)) { + *zendlval = *CG(current_namespace); + zval_copy_ctor(zendlval); + } else { + ZVAL_EMPTY_STRING(zendlval); } + return T_NS_C; +} +yy424: + YYDEBUG(424, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy425; + if (yych != 'r') goto yy295; +yy425: + YYDEBUG(425, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(426, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(427, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(428, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + char *filename = zend_get_compiled_filename(TSRMLS_C); + const size_t filename_len = strlen(filename); + char *dirname; - if (!class_name) { - class_name = ""; + if (!filename) { + filename = ""; } - zendlval->value.str.len = strlen(class_name); - zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len); - zendlval->type = IS_STRING; - return T_CLASS_C; -} - YY_BREAK -case 110: -YY_RULE_SETUP -{ - char *func_name = NULL; - if (CG(active_op_array)) { - func_name = CG(active_op_array)->function_name; - } + dirname = estrndup(filename, filename_len); + zend_dirname(dirname, filename_len); - if (!func_name) { - func_name = ""; + if (strcmp(dirname, ".") == 0) { + dirname = erealloc(dirname, MAXPATHLEN); +#if HAVE_GETCWD + VCWD_GETCWD(dirname, MAXPATHLEN); +#elif HAVE_GETWD + VCWD_GETWD(dirname); +#endif } - zendlval->value.str.len = strlen(func_name); - zendlval->value.str.val = estrndup(func_name, zendlval->value.str.len); + + zendlval->value.str.len = strlen(dirname); + zendlval->value.str.val = dirname; zendlval->type = IS_STRING; - return T_FUNC_C; + return T_DIR; +} +yy429: + YYDEBUG(429, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy430; + if (yych != 'n') goto yy295; +yy430: + YYDEBUG(430, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy431; + if (yych != 'e') goto yy295; +yy431: + YYDEBUG(431, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(432, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(433, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(434, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zendlval->value.lval = CG(zend_lineno); + zendlval->type = IS_LONG; + return T_LINE; } - YY_BREAK -case 111: -YY_RULE_SETUP -{ +yy435: + YYDEBUG(435, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy436; + if (yych != 't') goto yy295; +yy436: + YYDEBUG(436, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy437; + if (yych != 'h') goto yy295; +yy437: + YYDEBUG(437, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy438; + if (yych != 'o') goto yy295; +yy438: + YYDEBUG(438, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy439; + if (yych != 'd') goto yy295; +yy439: + YYDEBUG(439, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(440, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(441, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(442, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL; char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL; size_t len = 0; @@ -4995,18 +5021,91 @@ YY_RULE_SETUP zendlval->type = IS_STRING; return T_METHOD_C; } - YY_BREAK -case 112: -YY_RULE_SETUP -{ - zendlval->value.lval = CG(zend_lineno); - zendlval->type = IS_LONG; - return T_LINE; +yy443: + YYDEBUG(443, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy454; + if (yych == 'l') goto yy454; + goto yy295; +yy444: + YYDEBUG(444, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy445; + if (yych != 'n') goto yy295; +yy445: + YYDEBUG(445, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy446; + if (yych != 'c') goto yy295; +yy446: + YYDEBUG(446, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy447; + if (yych != 't') goto yy295; +yy447: + YYDEBUG(447, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy448; + if (yych != 'i') goto yy295; +yy448: + YYDEBUG(448, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy449; + if (yych != 'o') goto yy295; +yy449: + YYDEBUG(449, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy450; + if (yych != 'n') goto yy295; +yy450: + YYDEBUG(450, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(451, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(452, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(453, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + char *func_name = NULL; + + if (CG(active_op_array)) { + func_name = CG(active_op_array)->function_name; + } + + if (!func_name) { + func_name = ""; + } + zendlval->value.str.len = strlen(func_name); + zendlval->value.str.val = estrndup(func_name, zendlval->value.str.len); + zendlval->type = IS_STRING; + return T_FUNC_C; } - YY_BREAK -case 113: -YY_RULE_SETUP -{ +yy454: + YYDEBUG(454, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy455; + if (yych != 'e') goto yy295; +yy455: + YYDEBUG(455, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(456, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(457, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(458, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { char *filename = zend_get_compiled_filename(TSRMLS_C); if (!filename) { @@ -5017,1514 +5116,3393 @@ YY_RULE_SETUP zendlval->type = IS_STRING; return T_FILE; } - YY_BREAK -case 114: -YY_RULE_SETUP -{ -#ifdef ZEND_MULTIBYTE - if (SCNG(output_filter)) { - int readsize; - readsize = SCNG(output_filter)(&(zendlval->value.str.val), &(zendlval->value.str.len), yytext, yyleng TSRMLS_CC); - if (readsize < yyleng) { - yyless(readsize); +yy459: + YYDEBUG(459, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy460; + if (yych != 'a') goto yy295; +yy460: + YYDEBUG(460, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy461; + if (yych != 's') goto yy295; +yy461: + YYDEBUG(461, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy462; + if (yych != 's') goto yy295; +yy462: + YYDEBUG(462, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(463, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(464, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; } - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; + YYDEBUG(465, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + char *class_name = NULL; + + if (CG(active_class_entry)) { + class_name = CG(active_class_entry)->name; } -#else /* !ZEND_MULTIBYTE */ - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; -#endif /* ZEND_MULTIBYTE */ + + if (!class_name) { + class_name = ""; + } + zendlval->value.str.len = strlen(class_name); + zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len); zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext, yyleng); - return T_INLINE_HTML; + return T_CLASS_C; +} +yy466: + YYDEBUG(466, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy467; + if (yych != 'l') goto yy295; +yy467: + YYDEBUG(467, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy468; + if (yych != 't') goto yy295; +yy468: + YYDEBUG(468, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy295; + YYDEBUG(469, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy470; + if (yych != 'c') goto yy295; +yy470: + YYDEBUG(470, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy471; + if (yych != 'o') goto yy295; +yy471: + YYDEBUG(471, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'M') goto yy472; + if (yych != 'm') goto yy295; +yy472: + YYDEBUG(472, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy473; + if (yych != 'p') goto yy295; +yy473: + YYDEBUG(473, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy474; + if (yych != 'i') goto yy295; +yy474: + YYDEBUG(474, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy475; + if (yych != 'l') goto yy295; +yy475: + YYDEBUG(475, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy476; + if (yych != 'e') goto yy295; +yy476: + YYDEBUG(476, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy477; + if (yych != 'r') goto yy295; +yy477: + YYDEBUG(477, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(478, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_HALT_COMPILER; +} +yy479: + YYDEBUG(479, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy483; + if (yych == 's') goto yy483; + goto yy295; +yy480: + YYDEBUG(480, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy481; + if (yych != 'e') goto yy295; +yy481: + YYDEBUG(481, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(482, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_USE; +} +yy483: + YYDEBUG(483, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy484; + if (yych != 'e') goto yy295; +yy484: + YYDEBUG(484, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy485; + if (yych != 't') goto yy295; +yy485: + YYDEBUG(485, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(486, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_UNSET; +} +yy487: + YYDEBUG(487, *YYCURSOR); + ++YYCURSOR; + YYFILL(7); + yych = *YYCURSOR; +yy488: + YYDEBUG(488, *YYCURSOR); + if (yych <= 'S') { + if (yych <= 'D') { + if (yych <= ' ') { + if (yych == '\t') goto yy487; + if (yych <= 0x1F) goto yy281; + goto yy487; + } else { + if (yych <= 'A') { + if (yych <= '@') goto yy281; + goto yy492; + } else { + if (yych <= 'B') goto yy490; + if (yych <= 'C') goto yy281; + goto yy495; + } + } + } else { + if (yych <= 'I') { + if (yych == 'F') goto yy496; + if (yych <= 'H') goto yy281; + goto yy497; + } else { + if (yych <= 'O') { + if (yych <= 'N') goto yy281; + goto yy491; + } else { + if (yych <= 'Q') goto yy281; + if (yych <= 'R') goto yy494; + goto yy493; + } + } + } + } else { + if (yych <= 'f') { + if (yych <= 'a') { + if (yych == 'U') goto yy489; + if (yych <= '`') goto yy281; + goto yy492; + } else { + if (yych <= 'c') { + if (yych <= 'b') goto yy490; + goto yy281; + } else { + if (yych <= 'd') goto yy495; + if (yych <= 'e') goto yy281; + goto yy496; + } + } + } else { + if (yych <= 'q') { + if (yych <= 'i') { + if (yych <= 'h') goto yy281; + goto yy497; + } else { + if (yych == 'o') goto yy491; + goto yy281; + } + } else { + if (yych <= 's') { + if (yych <= 'r') goto yy494; + goto yy493; + } else { + if (yych != 'u') goto yy281; + } + } + } + } +yy489: + YYDEBUG(489, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy560; + if (yych == 'n') goto yy560; + goto yy281; +yy490: + YYDEBUG(490, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'O') { + if (yych == 'I') goto yy543; + if (yych <= 'N') goto yy281; + goto yy544; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy281; + goto yy543; + } else { + if (yych == 'o') goto yy544; + goto yy281; + } + } +yy491: + YYDEBUG(491, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'B') goto yy535; + if (yych == 'b') goto yy535; + goto yy281; +yy492: + YYDEBUG(492, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy528; + if (yych == 'r') goto yy528; + goto yy281; +yy493: + YYDEBUG(493, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy520; + if (yych == 't') goto yy520; + goto yy281; +yy494: + YYDEBUG(494, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy518; + if (yych == 'e') goto yy518; + goto yy281; +yy495: + YYDEBUG(495, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy514; + if (yych == 'o') goto yy514; + goto yy281; +yy496: + YYDEBUG(496, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy507; + if (yych == 'l') goto yy507; + goto yy281; +yy497: + YYDEBUG(497, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy498; + if (yych != 'n') goto yy281; +yy498: + YYDEBUG(498, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy499; + if (yych != 't') goto yy281; +yy499: + YYDEBUG(499, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy500; + if (yych != 'e') goto yy502; +yy500: + YYDEBUG(500, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'G') goto yy505; + if (yych == 'g') goto yy505; + goto yy281; +yy501: + YYDEBUG(501, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy502: + YYDEBUG(502, *YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy501; + goto yy281; + } else { + if (yych <= ' ') goto yy501; + if (yych != ')') goto yy281; + } + YYDEBUG(503, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(504, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_INT_CAST; +} +yy505: + YYDEBUG(505, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy506; + if (yych != 'e') goto yy281; +yy506: + YYDEBUG(506, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy501; + if (yych == 'r') goto yy501; + goto yy281; +yy507: + YYDEBUG(507, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy508; + if (yych != 'o') goto yy281; +yy508: + YYDEBUG(508, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy509; + if (yych != 'a') goto yy281; +yy509: + YYDEBUG(509, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy510; + if (yych != 't') goto yy281; +yy510: + YYDEBUG(510, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(511, *YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy510; + goto yy281; + } else { + if (yych <= ' ') goto yy510; + if (yych != ')') goto yy281; + } + YYDEBUG(512, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(513, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_DOUBLE_CAST; +} +yy514: + YYDEBUG(514, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy515; + if (yych != 'u') goto yy281; +yy515: + YYDEBUG(515, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'B') goto yy516; + if (yych != 'b') goto yy281; +yy516: + YYDEBUG(516, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy517; + if (yych != 'l') goto yy281; +yy517: + YYDEBUG(517, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy510; + if (yych == 'e') goto yy510; + goto yy281; +yy518: + YYDEBUG(518, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy519; + if (yych != 'a') goto yy281; +yy519: + YYDEBUG(519, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy510; + if (yych == 'l') goto yy510; + goto yy281; +yy520: + YYDEBUG(520, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy521; + if (yych != 'r') goto yy281; +yy521: + YYDEBUG(521, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy522; + if (yych != 'i') goto yy281; +yy522: + YYDEBUG(522, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy523; + if (yych != 'n') goto yy281; +yy523: + YYDEBUG(523, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'G') goto yy524; + if (yych != 'g') goto yy281; +yy524: + YYDEBUG(524, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(525, *YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy524; + goto yy281; + } else { + if (yych <= ' ') goto yy524; + if (yych != ')') goto yy281; + } + YYDEBUG(526, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(527, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_STRING_CAST; +} +yy528: + YYDEBUG(528, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy529; + if (yych != 'r') goto yy281; +yy529: + YYDEBUG(529, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy530; + if (yych != 'a') goto yy281; +yy530: + YYDEBUG(530, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'Y') goto yy531; + if (yych != 'y') goto yy281; +yy531: + YYDEBUG(531, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(532, *YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy531; + goto yy281; + } else { + if (yych <= ' ') goto yy531; + if (yych != ')') goto yy281; + } + YYDEBUG(533, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(534, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_ARRAY_CAST; +} +yy535: + YYDEBUG(535, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'J') goto yy536; + if (yych != 'j') goto yy281; +yy536: + YYDEBUG(536, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy537; + if (yych != 'e') goto yy281; +yy537: + YYDEBUG(537, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy538; + if (yych != 'c') goto yy281; +yy538: + YYDEBUG(538, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy539; + if (yych != 't') goto yy281; +yy539: + YYDEBUG(539, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(540, *YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy539; + goto yy281; + } else { + if (yych <= ' ') goto yy539; + if (yych != ')') goto yy281; + } + YYDEBUG(541, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(542, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_OBJECT_CAST; +} +yy543: + YYDEBUG(543, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy553; + if (yych == 'n') goto yy553; + goto yy281; +yy544: + YYDEBUG(544, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy545; + if (yych != 'o') goto yy281; +yy545: + YYDEBUG(545, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy546; + if (yych != 'l') goto yy281; +yy546: + YYDEBUG(546, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy551; + if (yych == 'e') goto yy551; + goto yy548; +yy547: + YYDEBUG(547, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy548: + YYDEBUG(548, *YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy547; + goto yy281; + } else { + if (yych <= ' ') goto yy547; + if (yych != ')') goto yy281; + } + YYDEBUG(549, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(550, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_BOOL_CAST; +} +yy551: + YYDEBUG(551, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy552; + if (yych != 'a') goto yy281; +yy552: + YYDEBUG(552, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy547; + if (yych == 'n') goto yy547; + goto yy281; +yy553: + YYDEBUG(553, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy554; + if (yych != 'a') goto yy281; +yy554: + YYDEBUG(554, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy555; + if (yych != 'r') goto yy281; +yy555: + YYDEBUG(555, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'Y') goto yy556; + if (yych != 'y') goto yy281; +yy556: + YYDEBUG(556, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(557, *YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy556; + goto yy281; + } else { + if (yych <= ' ') goto yy556; + if (yych != ')') goto yy281; + } + YYDEBUG(558, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(559, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_STRING_CAST; +} +yy560: + YYDEBUG(560, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy561; + if (yych != 's') goto yy281; +yy561: + YYDEBUG(561, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy562; + if (yych != 'e') goto yy281; +yy562: + YYDEBUG(562, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy563; + if (yych != 't') goto yy281; +yy563: + YYDEBUG(563, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(564, *YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy563; + goto yy281; + } else { + if (yych <= ' ') goto yy563; + if (yych != ')') goto yy281; + } + YYDEBUG(565, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(566, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_UNSET_CAST; } - YY_BREAK -case 115: -YY_RULE_SETUP -{ - HANDLE_NEWLINES(yytext, yyleng); - if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not */ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG; - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; - } +yy567: + YYDEBUG(567, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy568; + if (yych != 'r') goto yy295; +yy568: + YYDEBUG(568, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(569, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_VAR; } - YY_BREAK -case 116: -YY_RULE_SETUP -{ - if ((yytext[1]=='%' && CG(asp_tags)) || (yytext[1]=='?' && CG(short_tags))) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG_WITH_ECHO; - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; - } +yy570: + YYDEBUG(570, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'M') goto yy574; + if (yych == 'm') goto yy574; + goto yy295; +yy571: + YYDEBUG(571, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'W') goto yy572; + if (yych != 'w') goto yy295; +yy572: + YYDEBUG(572, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(573, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_NEW; } - YY_BREAK -case 117: -YY_RULE_SETUP -{ - if (CG(asp_tags)) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG; - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; - } +yy574: + YYDEBUG(574, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy575; + if (yych != 'e') goto yy295; +yy575: + YYDEBUG(575, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy576; + if (yych != 's') goto yy295; +yy576: + YYDEBUG(576, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy577; + if (yych != 'p') goto yy295; +yy577: + YYDEBUG(577, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy578; + if (yych != 'a') goto yy295; +yy578: + YYDEBUG(578, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy579; + if (yych != 'c') goto yy295; +yy579: + YYDEBUG(579, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy580; + if (yych != 'e') goto yy295; +yy580: + YYDEBUG(580, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(581, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_NAMESPACE; } - YY_BREAK -case 118: -YY_RULE_SETUP -{ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINE(yytext[yyleng-1]); - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG; +yy582: + YYDEBUG(582, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(583, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_PAAMAYIM_NEKUDOTAYIM; } - YY_BREAK -case 119: -YY_RULE_SETUP -{ - zend_copy_value(zendlval, (yytext+1), (yyleng-1)); - zendlval->type = IS_STRING; - return T_VARIABLE; +yy584: + YYDEBUG(584, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy585: + YYDEBUG(585, *YYCURSOR); + if (yych <= '\f') { + if (yych <= 0x08) goto yy234; + if (yych <= '\n') goto yy584; + goto yy234; + } else { + if (yych <= '\r') goto yy584; + if (yych == ' ') goto yy584; + goto yy234; + } +yy586: + YYDEBUG(586, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(587, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_MINUS_EQUAL; } - YY_BREAK - -/* Make sure a label character follows "->", otherwise there is no property - * and "->" will be taken literally - */ -case 120: -YY_RULE_SETUP -{ - yyless(yyleng - 3); +yy588: + YYDEBUG(588, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(589, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_DEC; +} +yy590: + YYDEBUG(590, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(591, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); - zend_copy_value(zendlval, (yytext+1), (yyleng-1)); - zendlval->type = IS_STRING; - return T_VARIABLE; + return T_OBJECT_OPERATOR; } - YY_BREAK - -/* A [ always designates a variable offset, regardless of what follows - */ -case 121: -YY_RULE_SETUP -{ - yyless(yyleng - 1); - yy_push_state(ST_VAR_OFFSET TSRMLS_CC); - zend_copy_value(zendlval, (yytext+1), (yyleng-1)); - zendlval->type = IS_STRING; - return T_VARIABLE; +yy592: + YYDEBUG(592, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'O') { + if (yych == 'I') goto yy599; + if (yych <= 'N') goto yy295; + goto yy600; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy295; + goto yy599; + } else { + if (yych == 'o') goto yy600; + goto yy295; + } + } +yy593: + YYDEBUG(593, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'B') goto yy594; + if (yych != 'b') goto yy295; +yy594: + YYDEBUG(594, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy595; + if (yych != 'l') goto yy295; +yy595: + YYDEBUG(595, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy596; + if (yych != 'i') goto yy295; +yy596: + YYDEBUG(596, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy597; + if (yych != 'c') goto yy295; +yy597: + YYDEBUG(597, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(598, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_PUBLIC; } - YY_BREAK -case 122: -YY_RULE_SETUP -{ - yy_pop_state(TSRMLS_C); - return ']'; +yy599: + YYDEBUG(599, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'V') { + if (yych == 'N') goto yy608; + if (yych <= 'U') goto yy295; + goto yy609; + } else { + if (yych <= 'n') { + if (yych <= 'm') goto yy295; + goto yy608; + } else { + if (yych == 'v') goto yy609; + goto yy295; + } + } +yy600: + YYDEBUG(600, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy601; + if (yych != 't') goto yy295; +yy601: + YYDEBUG(601, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy602; + if (yych != 'e') goto yy295; +yy602: + YYDEBUG(602, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy603; + if (yych != 'c') goto yy295; +yy603: + YYDEBUG(603, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy604; + if (yych != 't') goto yy295; +yy604: + YYDEBUG(604, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy605; + if (yych != 'e') goto yy295; +yy605: + YYDEBUG(605, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy606; + if (yych != 'd') goto yy295; +yy606: + YYDEBUG(606, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(607, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_PROTECTED; } - YY_BREAK -case 123: -YY_RULE_SETUP -{ - /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ - return yytext[0]; +yy608: + YYDEBUG(608, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy614; + if (yych == 't') goto yy614; + goto yy295; +yy609: + YYDEBUG(609, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy610; + if (yych != 'a') goto yy295; +yy610: + YYDEBUG(610, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy611; + if (yych != 't') goto yy295; +yy611: + YYDEBUG(611, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy612; + if (yych != 'e') goto yy295; +yy612: + YYDEBUG(612, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(613, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_PRIVATE; } - YY_BREAK -case 124: -YY_RULE_SETUP -{ - /* Invalid rule to return a more explicit parse error with proper line number */ - yyless(0); - yy_pop_state(TSRMLS_C); - ZVAL_EMPTY_STRING(zendlval); /* Empty since it won't be used */ - return T_ENCAPSED_AND_WHITESPACE; +yy614: + YYDEBUG(614, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(615, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_PRINT; } - YY_BREAK -case 125: -YY_RULE_SETUP -{ - zend_copy_value(zendlval, yytext, yyleng); - zendlval->type = IS_STRING; - return T_STRING; +yy616: + YYDEBUG(616, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy621; + if (yych == 'o') goto yy621; + goto yy295; +yy617: + YYDEBUG(617, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy618; + if (yych != 't') goto yy295; +yy618: + YYDEBUG(618, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy619; + if (yych != 'o') goto yy295; +yy619: + YYDEBUG(619, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(620, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_GOTO; +} +yy621: + YYDEBUG(621, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'B') goto yy622; + if (yych != 'b') goto yy295; +yy622: + YYDEBUG(622, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy623; + if (yych != 'a') goto yy295; +yy623: + YYDEBUG(623, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy624; + if (yych != 'l') goto yy295; +yy624: + YYDEBUG(624, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(625, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_GLOBAL; } - YY_BREAK -case 126: -YY_RULE_SETUP -{ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext, yyleng); - return T_WHITESPACE; +yy626: + YYDEBUG(626, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '<') goto yy633; + goto yy281; +yy627: + YYDEBUG(627, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + goto yy287; +yy628: + YYDEBUG(628, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy629; + if (yych != 'e') goto yy295; +yy629: + YYDEBUG(629, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy630; + if (yych != 'a') goto yy295; +yy630: + YYDEBUG(630, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'K') goto yy631; + if (yych != 'k') goto yy295; +yy631: + YYDEBUG(631, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(632, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_BREAK; } - YY_BREAK -case 127: -YY_RULE_SETUP -{ - BEGIN(ST_ONE_LINE_COMMENT); - yymore(); +yy633: + YYDEBUG(633, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '<') goto yy374; + goto yy281; +yy634: + YYDEBUG(634, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy641; + if (yych == 'a') goto yy641; + goto yy295; +yy635: + YYDEBUG(635, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy636; + if (yych != 'i') goto yy295; +yy636: + YYDEBUG(636, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy637; + if (yych != 't') goto yy295; +yy637: + YYDEBUG(637, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy638; + if (yych != 'c') goto yy295; +yy638: + YYDEBUG(638, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy639; + if (yych != 'h') goto yy295; +yy639: + YYDEBUG(639, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(640, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_SWITCH; } - YY_BREAK -case 128: -YY_RULE_SETUP -{ - yymore(); +yy641: + YYDEBUG(641, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy642; + if (yych != 't') goto yy295; +yy642: + YYDEBUG(642, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy643; + if (yych != 'i') goto yy295; +yy643: + YYDEBUG(643, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy644; + if (yych != 'c') goto yy295; +yy644: + YYDEBUG(644, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(645, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_STATIC; } - YY_BREAK -case 129: -YY_RULE_SETUP -{ - switch (yytext[yyleng-1]) { - case '?': case '%': case '>': - yyless(yyleng-1); - yymore(); - break; - case '\n': - CG(zend_lineno)++; - /* intentional fall through */ - default: - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - return T_COMMENT; - } +yy646: + YYDEBUG(646, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy657; + if (yych == 's') goto yy657; + goto yy295; +yy647: + YYDEBUG(647, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy655; + if (yych == 'd') goto yy655; + goto yy295; +yy648: + YYDEBUG(648, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy651; + if (yych == 'r') goto yy651; + goto yy295; +yy649: + YYDEBUG(649, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(650, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_AS; } - YY_BREAK -case 130: -YY_RULE_SETUP -{ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - CG(zend_lineno)++; - return T_COMMENT; +yy651: + YYDEBUG(651, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy652; + if (yych != 'a') goto yy295; +yy652: + YYDEBUG(652, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'Y') goto yy653; + if (yych != 'y') goto yy295; +yy653: + YYDEBUG(653, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(654, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_ARRAY; } - YY_BREAK -case 131: -YY_RULE_SETUP -{ - if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng-2; - zendlval->type = IS_STRING; - yyless(yyleng-2); - BEGIN(ST_IN_SCRIPTING); - return T_COMMENT; - } else { - yymore(); - } +yy655: + YYDEBUG(655, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(656, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_LOGICAL_AND; } - YY_BREAK -case 132: -YY_RULE_SETUP -{ - CG(comment_start_line) = CG(zend_lineno); - RESET_DOC_COMMENT(); - BEGIN(ST_DOC_COMMENT); - yymore(); +yy657: + YYDEBUG(657, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy658; + if (yych != 't') goto yy295; +yy658: + YYDEBUG(658, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy659; + if (yych != 'r') goto yy295; +yy659: + YYDEBUG(659, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy660; + if (yych != 'a') goto yy295; +yy660: + YYDEBUG(660, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy661; + if (yych != 'c') goto yy295; +yy661: + YYDEBUG(661, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy662; + if (yych != 't') goto yy295; +yy662: + YYDEBUG(662, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(663, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_ABSTRACT; } - YY_BREAK -case 133: -YY_RULE_SETUP -{ - CG(comment_start_line) = CG(zend_lineno); - BEGIN(ST_COMMENT); - yymore(); +yy664: + YYDEBUG(664, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy665; + if (yych != 'i') goto yy295; +yy665: + YYDEBUG(665, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy666; + if (yych != 'l') goto yy295; +yy666: + YYDEBUG(666, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy667; + if (yych != 'e') goto yy295; +yy667: + YYDEBUG(667, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(668, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_WHILE; } - YY_BREAK -case 134: -YY_RULE_SETUP -{ - yymore(); +yy669: + YYDEBUG(669, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(670, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_IF; } - YY_BREAK -case 135: -YY_RULE_SETUP -{ - CG(doc_comment) = estrndup(yytext, yyleng); - CG(doc_comment_len) = yyleng; - HANDLE_NEWLINES(yytext, yyleng); - BEGIN(ST_IN_SCRIPTING); - return T_DOC_COMMENT; +yy671: + YYDEBUG(671, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy707; + if (yych == 'p') goto yy707; + goto yy295; +yy672: + YYDEBUG(672, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'T') { + if (yych <= 'C') { + if (yych <= 'B') goto yy295; + goto yy680; + } else { + if (yych <= 'R') goto yy295; + if (yych <= 'S') goto yy678; + goto yy679; + } + } else { + if (yych <= 'r') { + if (yych == 'c') goto yy680; + goto yy295; + } else { + if (yych <= 's') goto yy678; + if (yych <= 't') goto yy679; + goto yy295; + } + } +yy673: + YYDEBUG(673, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy674; + if (yych != 's') goto yy295; +yy674: + YYDEBUG(674, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy675; + if (yych != 'e') goto yy295; +yy675: + YYDEBUG(675, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy676; + if (yych != 't') goto yy295; +yy676: + YYDEBUG(676, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(677, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_ISSET; } - YY_BREAK -case 136: -YY_RULE_SETUP -{ - HANDLE_NEWLINES(yytext, yyleng); - BEGIN(ST_IN_SCRIPTING); - return T_COMMENT; +yy678: + YYDEBUG(678, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy699; + if (yych == 't') goto yy699; + goto yy295; +yy679: + YYDEBUG(679, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy692; + if (yych == 'e') goto yy692; + goto yy295; +yy680: + YYDEBUG(680, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy681; + if (yych != 'l') goto yy295; +yy681: + YYDEBUG(681, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy682; + if (yych != 'u') goto yy295; +yy682: + YYDEBUG(682, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy683; + if (yych != 'd') goto yy295; +yy683: + YYDEBUG(683, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy684; + if (yych != 'e') goto yy295; +yy684: + YYDEBUG(684, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '9') { + if (yych >= '0') goto yy294; + } else { + if (yych <= '@') goto yy685; + if (yych <= 'Z') goto yy294; + } + } else { + if (yych <= '`') { + if (yych <= '_') goto yy686; + } else { + if (yych <= 'z') goto yy294; + if (yych >= 0x7F) goto yy294; + } + } +yy685: + YYDEBUG(685, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_INCLUDE; } - YY_BREAK -case 137: -YY_RULE_SETUP -{ - yymore(); +yy686: + YYDEBUG(686, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy687; + if (yych != 'o') goto yy295; +yy687: + YYDEBUG(687, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy688; + if (yych != 'n') goto yy295; +yy688: + YYDEBUG(688, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy689; + if (yych != 'c') goto yy295; +yy689: + YYDEBUG(689, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy690; + if (yych != 'e') goto yy295; +yy690: + YYDEBUG(690, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(691, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_INCLUDE_ONCE; } - YY_BREAK -case 138: -YY_RULE_SETUP -{ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(INITIAL); - return T_CLOSE_TAG; /* implicit ';' at php-end tag */ +yy692: + YYDEBUG(692, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy693; + if (yych != 'r') goto yy295; +yy693: + YYDEBUG(693, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy694; + if (yych != 'f') goto yy295; +yy694: + YYDEBUG(694, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy695; + if (yych != 'a') goto yy295; +yy695: + YYDEBUG(695, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy696; + if (yych != 'c') goto yy295; +yy696: + YYDEBUG(696, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy697; + if (yych != 'e') goto yy295; +yy697: + YYDEBUG(697, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(698, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_INTERFACE; +} +yy699: + YYDEBUG(699, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy700; + if (yych != 'a') goto yy295; +yy700: + YYDEBUG(700, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy701; + if (yych != 'n') goto yy295; +yy701: + YYDEBUG(701, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy702; + if (yych != 'c') goto yy295; +yy702: + YYDEBUG(702, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy703; + if (yych != 'e') goto yy295; +yy703: + YYDEBUG(703, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy704; + if (yych != 'o') goto yy295; +yy704: + YYDEBUG(704, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy705; + if (yych != 'f') goto yy295; +yy705: + YYDEBUG(705, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(706, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_INSTANCEOF; +} +yy707: + YYDEBUG(707, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy708; + if (yych != 'l') goto yy295; +yy708: + YYDEBUG(708, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy709; + if (yych != 'e') goto yy295; +yy709: + YYDEBUG(709, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'M') goto yy710; + if (yych != 'm') goto yy295; +yy710: + YYDEBUG(710, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy711; + if (yych != 'e') goto yy295; +yy711: + YYDEBUG(711, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy712; + if (yych != 'n') goto yy295; +yy712: + YYDEBUG(712, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy713; + if (yych != 't') goto yy295; +yy713: + YYDEBUG(713, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy714; + if (yych != 's') goto yy295; +yy714: + YYDEBUG(714, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(715, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_IMPLEMENTS; +} +yy716: + YYDEBUG(716, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy720; + if (yych == 'r') goto yy720; + goto yy295; +yy717: + YYDEBUG(717, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'Y') goto yy718; + if (yych != 'y') goto yy295; +yy718: + YYDEBUG(718, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(719, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_TRY; +} +yy720: + YYDEBUG(720, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy721; + if (yych != 'o') goto yy295; +yy721: + YYDEBUG(721, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'W') goto yy722; + if (yych != 'w') goto yy295; +yy722: + YYDEBUG(722, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(723, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_THROW; +} +yy724: + YYDEBUG(724, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'T') { + if (yych == 'Q') goto yy726; + if (yych <= 'S') goto yy295; + } else { + if (yych <= 'q') { + if (yych <= 'p') goto yy295; + goto yy726; + } else { + if (yych != 't') goto yy295; + } + } + YYDEBUG(725, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy738; + if (yych == 'u') goto yy738; + goto yy295; +yy726: + YYDEBUG(726, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy727; + if (yych != 'u') goto yy295; +yy727: + YYDEBUG(727, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy728; + if (yych != 'i') goto yy295; +yy728: + YYDEBUG(728, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy729; + if (yych != 'r') goto yy295; +yy729: + YYDEBUG(729, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy730; + if (yych != 'e') goto yy295; +yy730: + YYDEBUG(730, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '9') { + if (yych >= '0') goto yy294; + } else { + if (yych <= '@') goto yy731; + if (yych <= 'Z') goto yy294; + } + } else { + if (yych <= '`') { + if (yych <= '_') goto yy732; + } else { + if (yych <= 'z') goto yy294; + if (yych >= 0x7F) goto yy294; + } + } +yy731: + YYDEBUG(731, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_REQUIRE; } - YY_BREAK -case 139: -YY_RULE_SETUP -{ - if (CG(asp_tags)) { - BEGIN(INITIAL); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - zendlval->value.str.val = yytext; /* no copying - intentional */ - return T_CLOSE_TAG; /* implicit ';' at php-end tag */ - } else { - yyless(1); - return yytext[0]; - } +yy732: + YYDEBUG(732, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy733; + if (yych != 'o') goto yy295; +yy733: + YYDEBUG(733, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy734; + if (yych != 'n') goto yy295; +yy734: + YYDEBUG(734, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy735; + if (yych != 'c') goto yy295; +yy735: + YYDEBUG(735, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy736; + if (yych != 'e') goto yy295; +yy736: + YYDEBUG(736, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(737, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_REQUIRE_ONCE; } - YY_BREAK - -/* ("{"*|"$"*) handles { or $ at the end of a string (or the entire contents) - */ -case 140: -YY_RULE_SETUP -{ - int bprefix = (yytext[0] != '"') ? 1 : 0; - - zend_scan_escape_string(zendlval, yytext+bprefix+1, yyleng-bprefix-2, '"' TSRMLS_CC); - return T_CONSTANT_ENCAPSED_STRING; +yy738: + YYDEBUG(738, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy739; + if (yych != 'r') goto yy295; +yy739: + YYDEBUG(739, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy740; + if (yych != 'n') goto yy295; +yy740: + YYDEBUG(740, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(741, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_RETURN; } - YY_BREAK -case 141: -YY_RULE_SETUP -{ - register char *s, *t; - char *end; - int bprefix = (yytext[0] != '\'') ? 1 : 0; - - zendlval->value.str.val = estrndup(yytext+bprefix+1, yyleng-bprefix-2); - zendlval->value.str.len = yyleng-bprefix-2; - zendlval->type = IS_STRING; - - /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; - while (svalue.str.len--; - break; - default: - *t++ = '\\'; - *t++ = *s; - break; +yy742: + YYDEBUG(742, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'T') { + if (yych <= 'R') goto yy295; + if (yych <= 'S') goto yy764; + goto yy763; + } else { + if (yych <= 'r') goto yy295; + if (yych <= 's') goto yy764; + if (yych <= 't') goto yy763; + goto yy295; + } +yy743: + YYDEBUG(743, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'O') { + if (yych == 'A') goto yy755; + if (yych <= 'N') goto yy295; + goto yy756; + } else { + if (yych <= 'a') { + if (yych <= '`') goto yy295; + goto yy755; + } else { + if (yych == 'o') goto yy756; + goto yy295; } + } +yy744: + YYDEBUG(744, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy745; + if (yych != 'n') goto yy295; +yy745: + YYDEBUG(745, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'T') { + if (yych <= 'R') goto yy295; + if (yych >= 'T') goto yy747; } else { - *t++ = *s; + if (yych <= 'r') goto yy295; + if (yych <= 's') goto yy746; + if (yych <= 't') goto yy747; + goto yy295; } - - if (*s == '\n' || (*s == '\r' && (*(s+1) != '\n'))) { - CG(zend_lineno)++; +yy746: + YYDEBUG(746, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy753; + if (yych == 't') goto yy753; + goto yy295; +yy747: + YYDEBUG(747, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy748; + if (yych != 'i') goto yy295; +yy748: + YYDEBUG(748, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy749; + if (yych != 'n') goto yy295; +yy749: + YYDEBUG(749, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy750; + if (yych != 'u') goto yy295; +yy750: + YYDEBUG(750, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy751; + if (yych != 'e') goto yy295; +yy751: + YYDEBUG(751, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; } - s++; - } - *t = 0; - -#ifdef ZEND_MULTIBYTE - if (SCNG(output_filter)) { - s = zendlval->value.str.val; - SCNG(output_filter)(&(zendlval->value.str.val), &(zendlval->value.str.len), s, zendlval->value.str.len TSRMLS_CC); - efree(s); - } -#endif /* ZEND_MULTIBYTE */ - - return T_CONSTANT_ENCAPSED_STRING; + YYDEBUG(752, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_CONTINUE; } - YY_BREAK -case 142: -YY_RULE_SETUP -{ - BEGIN(ST_DOUBLE_QUOTES); - return '"'; +yy753: + YYDEBUG(753, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(754, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_CONST; } - YY_BREAK -case 143: -YY_RULE_SETUP -{ - char *s; - int bprefix = (yytext[0] != '<') ? 1 : 0; - - CG(zend_lineno)++; - CG(heredoc_len) = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0); - s = yytext+bprefix+3; - while ((*s == ' ') || (*s == '\t')) { - s++; - CG(heredoc_len)--; - } - CG(heredoc) = estrndup(s, CG(heredoc_len)); - BEGIN(ST_START_HEREDOC); - return T_START_HEREDOC; +yy755: + YYDEBUG(755, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy760; + if (yych == 's') goto yy760; + goto yy295; +yy756: + YYDEBUG(756, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy757; + if (yych != 'n') goto yy295; +yy757: + YYDEBUG(757, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy758; + if (yych != 'e') goto yy295; +yy758: + YYDEBUG(758, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(759, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_CLONE; } - YY_BREAK -case 144: -YY_RULE_SETUP -{ - BEGIN(ST_BACKQUOTE); - return '`'; +yy760: + YYDEBUG(760, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy761; + if (yych != 's') goto yy295; +yy761: + YYDEBUG(761, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(762, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_CLASS; } - YY_BREAK -case 145: -YY_RULE_SETUP -{ - yyless(0); - BEGIN(ST_HEREDOC); +yy763: + YYDEBUG(763, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy767; + if (yych == 'c') goto yy767; + goto yy295; +yy764: + YYDEBUG(764, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy765; + if (yych != 'e') goto yy295; +yy765: + YYDEBUG(765, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(766, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_CASE; } - YY_BREAK -case 146: -YY_RULE_SETUP -{ - int label_len = yyleng - 1; - - if (yytext[label_len-1]==';') { - label_len--; - } - - yyless(label_len); - - if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) { - zendlval->value.str.val = CG(heredoc); - zendlval->value.str.len = label_len; - CG(heredoc)=NULL; - CG(heredoc_len)=0; - BEGIN(ST_IN_SCRIPTING); - return T_END_HEREDOC; - } else { - yymore(); - BEGIN(ST_HEREDOC); - } +yy767: + YYDEBUG(767, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy768; + if (yych != 'h') goto yy295; +yy768: + YYDEBUG(768, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(769, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_CATCH; } - YY_BREAK - -/* Match everything up to and including a possible ending label, so if the label - * doesn't match, it's kept with the rest of the string - * - * {HEREDOC_NEWLINE}+ handles the case of more than one newline sequence that - * couldn't be matched with HEREDOC_CHARS, because of the following label - */ -case 147: -YY_RULE_SETUP -{ - char *end = yytext + yyleng - 1; - - if (end[-1] == ';') { - end--; - yyleng--; - } - - if (yyleng > CG(heredoc_len) && !memcmp(end - CG(heredoc_len), CG(heredoc), CG(heredoc_len))) { - int len = yyleng - CG(heredoc_len) - 2; /* 2 for newline before and after label */ - - /* May have matched fooLABEL; make sure there's a newline before it */ - if (yytext[len] != '\n') { - if (yytext[len] != '\r') { - goto wrong_label; +yy770: + YYDEBUG(770, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy787; + if (yych == 'n') goto yy787; + goto yy295; +yy771: + YYDEBUG(771, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy780; + if (yych == 'r') goto yy780; + goto yy295; +yy772: + YYDEBUG(772, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy773; + if (yych != 'n') goto yy295; +yy773: + YYDEBUG(773, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy774; + if (yych != 'c') goto yy295; +yy774: + YYDEBUG(774, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy775; + if (yych != 't') goto yy295; +yy775: + YYDEBUG(775, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy776; + if (yych != 'i') goto yy295; +yy776: + YYDEBUG(776, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy777; + if (yych != 'o') goto yy295; +yy777: + YYDEBUG(777, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy778; + if (yych != 'n') goto yy295; +yy778: + YYDEBUG(778, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(779, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_FUNCTION; +} +yy780: + YYDEBUG(780, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '@') { + if (yych <= '/') goto yy781; + if (yych <= '9') goto yy294; + } else { + if (yych == 'E') goto yy782; + if (yych <= 'Z') goto yy294; + } + } else { + if (yych <= 'd') { + if (yych != '`') goto yy294; + } else { + if (yych <= 'e') goto yy782; + if (yych <= 'z') goto yy294; + if (yych >= 0x7F) goto yy294; } - } else if (len > 0 && yytext[len - 1] == '\r') { - len--; /* Windows newline */ } - - /* Go back before last label char, to match in ST_END_HEREDOC state */ - yyless(yyleng - 2); - - /* Subtract the remaining label length. yyleng must include newline - * before label, for zend_highlight/strip, tokenizer, etc. */ - yyleng -= CG(heredoc_len) - 1; - - CG(increment_lineno) = 1; /* For newline before label */ - BEGIN(ST_END_HEREDOC); - zend_scan_escape_string(zendlval, yytext, len, 0 TSRMLS_CC); - return T_ENCAPSED_AND_WHITESPACE; - } else { - /* Go back to end of label, so the next match works correctly in case of - * a variable or another label at the beginning of the next line */ -wrong_label: - yyless(yyleng - 1); - yymore(); - } +yy781: + YYDEBUG(781, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_FOR; } - YY_BREAK -case 148: -YY_RULE_SETUP -{ - zendlval->value.str.val = CG(heredoc); - zendlval->value.str.len = CG(heredoc_len); - yytext = zendlval->value.str.val; - yyleng = zendlval->value.str.len; - CG(heredoc) = NULL; - CG(heredoc_len) = 0; - BEGIN(ST_IN_SCRIPTING); - return T_END_HEREDOC; +yy782: + YYDEBUG(782, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy783; + if (yych != 'a') goto yy295; +yy783: + YYDEBUG(783, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy784; + if (yych != 'c') goto yy295; +yy784: + YYDEBUG(784, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy785; + if (yych != 'h') goto yy295; +yy785: + YYDEBUG(785, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(786, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_FOREACH; } - YY_BREAK -case 149: -YY_RULE_SETUP -{ - zendlval->value.lval = (long) '{'; - yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); - yyless(1); - return T_CURLY_OPEN; +yy787: + YYDEBUG(787, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy788; + if (yych != 'a') goto yy295; +yy788: + YYDEBUG(788, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy789; + if (yych != 'l') goto yy295; +yy789: + YYDEBUG(789, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(790, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_FINAL; } - YY_BREAK -case 150: -YY_RULE_SETUP -{ - zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC); - return T_ENCAPSED_AND_WHITESPACE; +yy791: + YYDEBUG(791, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'F') { + if (yych == 'C') goto yy797; + if (yych <= 'E') goto yy295; + goto yy798; + } else { + if (yych <= 'c') { + if (yych <= 'b') goto yy295; + goto yy797; + } else { + if (yych == 'f') goto yy798; + goto yy295; + } + } +yy792: + YYDEBUG(792, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy795; + if (yych == 'e') goto yy795; + goto yy295; +yy793: + YYDEBUG(793, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(794, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_DO; } - YY_BREAK - -/* "{"{2,}|"$"{2,} handles { before "{$" or literal $ before a variable or "${" - * (("{"+|"$"+)["]) handles { or $ at the end of a string - * - * Same for backquotes and heredocs, except the second case doesn't apply to - * heredocs. yyless(yyleng - 1) is used to correct taking one character too many - */ -case 151: -YY_RULE_SETUP -{ - yyless(yyleng - 1); - zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC); - return T_ENCAPSED_AND_WHITESPACE; +yy795: + YYDEBUG(795, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(796, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_EXIT; } - YY_BREAK -case 152: -YY_RULE_SETUP -{ - zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC); - return T_ENCAPSED_AND_WHITESPACE; +yy797: + YYDEBUG(797, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy804; + if (yych == 'l') goto yy804; + goto yy295; +yy798: + YYDEBUG(798, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy799; + if (yych != 'a') goto yy295; +yy799: + YYDEBUG(799, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy800; + if (yych != 'u') goto yy295; +yy800: + YYDEBUG(800, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy801; + if (yych != 'l') goto yy295; +yy801: + YYDEBUG(801, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy802; + if (yych != 't') goto yy295; +yy802: + YYDEBUG(802, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(803, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_DEFAULT; } - YY_BREAK -case 153: -YY_RULE_SETUP -{ - yyless(yyleng - 1); - zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC); - return T_ENCAPSED_AND_WHITESPACE; +yy804: + YYDEBUG(804, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy805; + if (yych != 'a') goto yy295; +yy805: + YYDEBUG(805, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy806; + if (yych != 'r') goto yy295; +yy806: + YYDEBUG(806, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy807; + if (yych != 'e') goto yy295; +yy807: + YYDEBUG(807, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(808, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_DECLARE; } - YY_BREAK - -/* ({HEREDOC_NEWLINE}+({LABEL}";"?)?)? handles the possible case of newline - * sequences, possibly followed by a label, that couldn't be matched with - * HEREDOC_CHARS because of a following variable or "{$" - * - * This doesn't affect real ending labels, as they are followed by a newline, - * which will result in a longer match for the correct rule if present - */ -case 154: -YY_RULE_SETUP -{ - zend_scan_escape_string(zendlval, yytext, yyleng, 0 TSRMLS_CC); - return T_ENCAPSED_AND_WHITESPACE; +yy809: + YYDEBUG(809, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy871; + if (yych == 'h') goto yy871; + goto yy295; +yy810: + YYDEBUG(810, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy865; + if (yych == 's') goto yy865; + goto yy295; +yy811: + YYDEBUG(811, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy861; + if (yych == 'p') goto yy861; + goto yy295; +yy812: + YYDEBUG(812, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy827; + if (yych == 'd') goto yy827; + goto yy295; +yy813: + YYDEBUG(813, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy824; + if (yych == 'a') goto yy824; + goto yy295; +yy814: + YYDEBUG(814, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'T') { + if (yych == 'I') goto yy815; + if (yych <= 'S') goto yy295; + goto yy816; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy295; + } else { + if (yych == 't') goto yy816; + goto yy295; + } + } +yy815: + YYDEBUG(815, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy822; + if (yych == 't') goto yy822; + goto yy295; +yy816: + YYDEBUG(816, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy817; + if (yych != 'e') goto yy295; +yy817: + YYDEBUG(817, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy818; + if (yych != 'n') goto yy295; +yy818: + YYDEBUG(818, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy819; + if (yych != 'd') goto yy295; +yy819: + YYDEBUG(819, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy820; + if (yych != 's') goto yy295; +yy820: + YYDEBUG(820, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(821, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_EXTENDS; } - YY_BREAK -case 155: -YY_RULE_SETUP -{ - yyless(yyleng - 1); - zend_scan_escape_string(zendlval, yytext, yyleng, 0 TSRMLS_CC); - return T_ENCAPSED_AND_WHITESPACE; +yy822: + YYDEBUG(822, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(823, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_EXIT; } - YY_BREAK -case 156: -YY_RULE_SETUP -{ - BEGIN(ST_IN_SCRIPTING); - return '"'; +yy824: + YYDEBUG(824, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy825; + if (yych != 'l') goto yy295; +yy825: + YYDEBUG(825, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(826, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_EVAL; } - YY_BREAK -case 157: -YY_RULE_SETUP -{ - BEGIN(ST_IN_SCRIPTING); - return '`'; +yy827: + YYDEBUG(827, *YYCURSOR); + yych = *++YYCURSOR; + YYDEBUG(-1, yych); + switch (yych) { + case 'D': + case 'd': goto yy828; + case 'F': + case 'f': goto yy829; + case 'I': + case 'i': goto yy830; + case 'S': + case 's': goto yy831; + case 'W': + case 'w': goto yy832; + default: goto yy295; + } +yy828: + YYDEBUG(828, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy854; + if (yych == 'e') goto yy854; + goto yy295; +yy829: + YYDEBUG(829, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy846; + if (yych == 'o') goto yy846; + goto yy295; +yy830: + YYDEBUG(830, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy844; + if (yych == 'f') goto yy844; + goto yy295; +yy831: + YYDEBUG(831, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'W') goto yy838; + if (yych == 'w') goto yy838; + goto yy295; +yy832: + YYDEBUG(832, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy833; + if (yych != 'h') goto yy295; +yy833: + YYDEBUG(833, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy834; + if (yych != 'i') goto yy295; +yy834: + YYDEBUG(834, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy835; + if (yych != 'l') goto yy295; +yy835: + YYDEBUG(835, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy836; + if (yych != 'e') goto yy295; +yy836: + YYDEBUG(836, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(837, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_ENDWHILE; } - YY_BREAK -case YY_STATE_EOF(ST_COMMENT): -case YY_STATE_EOF(ST_DOC_COMMENT): -{ - zend_error(E_COMPILE_WARNING,"Unterminated comment starting line %d", CG(comment_start_line)); - return 0; +yy838: + YYDEBUG(838, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy839; + if (yych != 'i') goto yy295; +yy839: + YYDEBUG(839, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy840; + if (yych != 't') goto yy295; +yy840: + YYDEBUG(840, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy841; + if (yych != 'c') goto yy295; +yy841: + YYDEBUG(841, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy842; + if (yych != 'h') goto yy295; +yy842: + YYDEBUG(842, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(843, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_ENDSWITCH; } - YY_BREAK -case 158: -YY_RULE_SETUP -{ - zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); +yy844: + YYDEBUG(844, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; + } + YYDEBUG(845, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_ENDIF; } - YY_BREAK -case 159: -YY_RULE_SETUP -ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(ST_IN_SCRIPTING): -case YY_STATE_EOF(ST_DOUBLE_QUOTES): -case YY_STATE_EOF(ST_BACKQUOTE): -case YY_STATE_EOF(ST_HEREDOC): -case YY_STATE_EOF(ST_START_HEREDOC): -case YY_STATE_EOF(ST_END_HEREDOC): -case YY_STATE_EOF(ST_LOOKING_FOR_PROPERTY): -case YY_STATE_EOF(ST_LOOKING_FOR_VARNAME): -case YY_STATE_EOF(ST_VAR_OFFSET): -case YY_STATE_EOF(ST_ONE_LINE_COMMENT): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = SCNG(yy_in); - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state TSRMLS_CC ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } +yy846: + YYDEBUG(846, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy847; + if (yych != 'r') goto yy295; +yy847: + YYDEBUG(847, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '@') { + if (yych <= '/') goto yy848; + if (yych <= '9') goto yy294; + } else { + if (yych == 'E') goto yy849; + if (yych <= 'Z') goto yy294; } - - else switch ( yy_get_next_buffer(TSRMLS_C) ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)]; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; + } else { + if (yych <= 'd') { + if (yych != '`') goto yy294; + } else { + if (yych <= 'e') goto yy849; + if (yych <= 'z') goto yy294; + if (yych >= 0x7F) goto yy294; } - break; } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer(TSRMLS_D) - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } +yy848: + YYDEBUG(848, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_ENDFOR; +} +yy849: + YYDEBUG(849, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy850; + if (yych != 'a') goto yy295; +yy850: + YYDEBUG(850, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy851; + if (yych != 'c') goto yy295; +yy851: + YYDEBUG(851, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy852; + if (yych != 'h') goto yy295; +yy852: + YYDEBUG(852, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars) = 0; - - else + YYDEBUG(853, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - SCNG(yy_n_chars), num_to_read ); - - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars); + return T_ENDFOREACH; +} +yy854: + YYDEBUG(854, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy855; + if (yych != 'c') goto yy295; +yy855: + YYDEBUG(855, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy856; + if (yych != 'l') goto yy295; +yy856: + YYDEBUG(856, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy857; + if (yych != 'a') goto yy295; +yy857: + YYDEBUG(857, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy858; + if (yych != 'r') goto yy295; +yy858: + YYDEBUG(858, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy859; + if (yych != 'e') goto yy295; +yy859: + YYDEBUG(859, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; } - - if ( SCNG(yy_n_chars) == 0 ) + YYDEBUG(860, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( SCNG(yy_in) TSRMLS_CC ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } + return T_ENDDECLARE; +} +yy861: + YYDEBUG(861, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy862; + if (yych != 't') goto yy295; +yy862: + YYDEBUG(862, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'Y') goto yy863; + if (yych != 'y') goto yy295; +yy863: + YYDEBUG(863, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - SCNG(yy_n_chars) += number_to_move; - yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state(TSRMLS_D) - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + YYDEBUG(864, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + return T_EMPTY; +} +yy865: + YYDEBUG(865, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy866; + if (yych != 'e') goto yy295; +yy866: + YYDEBUG(866, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '@') { + if (yych <= '/') goto yy867; + if (yych <= '9') goto yy294; + } else { + if (yych == 'I') goto yy868; + if (yych <= 'Z') goto yy294; } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1493 ) - yy_c = yy_meta[(unsigned int) yy_c]; + } else { + if (yych <= 'h') { + if (yych != '`') goto yy294; + } else { + if (yych <= 'i') goto yy868; + if (yych <= 'z') goto yy294; + if (yych >= 0x7F) goto yy294; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state TSRMLS_CC ) -yy_state_type yy_current_state; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) +yy867: + YYDEBUG(867, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + return T_ELSE; +} +yy868: + YYDEBUG(868, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy869; + if (yych != 'f') goto yy295; +yy869: + YYDEBUG(869, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + YYDEBUG(870, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1493 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 1492); - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp TSRMLS_DC ) -#else -static void yyunput( c, yy_bp TSRMLS_CC ) -int c; -register char *yy_bp; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = SCNG(yy_n_chars) + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - SCNG(yy_n_chars) = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); + return T_ELSEIF; +} +yy871: + YYDEBUG(871, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy872; + if (yych != 'o') goto yy295; +yy872: + YYDEBUG(872, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy294; } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; + YYDEBUG(873, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_ECHO; +} } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput(TSRMLS_D) -#else -static int input(TSRMLS_C) -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif +/* *********************************** */ +yyc_ST_LOOKING_FOR_PROPERTY: { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer(TSRMLS_C) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( SCNG(yy_in) TSRMLS_CC ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(TSRMLS_C); -#else - return input(TSRMLS_C); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 0, 0, 128, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 0, 0, 0, 0, 0, 0, + 0, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 0, 0, 0, 0, 64, + 0, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 0, 0, 0, 0, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + }; + YYDEBUG(874, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= ',') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy876; + if (yych <= 0x08) goto yy884; + if (yych <= '\n') goto yy878; + goto yy884; + } else { + if (yych <= '\r') goto yy878; + if (yych == ' ') goto yy878; + goto yy884; + } + } else { + if (yych <= '^') { + if (yych <= '-') goto yy880; + if (yych <= '@') goto yy884; + if (yych <= 'Z') goto yy882; + goto yy884; + } else { + if (yych <= '`') { + if (yych <= '_') goto yy882; + goto yy884; + } else { + if (yych <= 'z') goto yy882; + if (yych <= '~') goto yy884; + goto yy882; } } } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( struct _zend_file_handle *input_file TSRMLS_DC ) -#else -void yyrestart( input_file TSRMLS_CC ) -struct _zend_file_handle *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); - - yy_init_buffer( yy_current_buffer, input_file TSRMLS_CC ); - yy_load_buffer_state(TSRMLS_C); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC) -#else -void yy_switch_to_buffer( new_buffer TSRMLS_CC) -YY_BUFFER_STATE new_buffer; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) +yy876: + YYDEBUG(876, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(877, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return 0; } +yy878: + YYDEBUG(878, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy890; +yy879: + YYDEBUG(879, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars); - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(TSRMLS_C); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( TSRMLS_D ) -#else -void yy_load_buffer_state(TSRMLS_C) -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - SCNG(yy_in) = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( struct _zend_file_handle *file, int size TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size TSRMLS_CC ) -struct _zend_file_handle *file; -int size; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file TSRMLS_CC ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -#else -void yy_delete_buffer( b TSRMLS_CC ) -YY_BUFFER_STATE b; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC ) -#else -void yy_init_buffer( b, file TSRMLS_CC ) -YY_BUFFER_STATE b; -struct _zend_file_handle *file; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - - - { - yy_flush_buffer( b TSRMLS_CC ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file->handle.stream.interactive; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -#else -void yy_flush_buffer( b TSRMLS_CC ) -YY_BUFFER_STATE b; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(TSRMLS_C); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size TSRMLS_CC ) -char *base; -yy_size_t size; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b TSRMLS_CC ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str TSRMLS_CC ) -yyconst char *yy_str; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len TSRMLS_CC ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len TSRMLS_CC ) -yyconst char *bytes; -int len; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n TSRMLS_CC); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state TSRMLS_DC ) -#else -static void yy_push_state( new_state TSRMLS_CC ) -int new_state; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + HANDLE_NEWLINES(yytext, yyleng); + return T_WHITESPACE; +} +yy880: + YYDEBUG(880, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '>') goto yy887; +yy881: + YYDEBUG(881, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); + yyless(0); + yy_pop_state(TSRMLS_C); + goto restart; +} +yy882: + YYDEBUG(882, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy886; +yy883: + YYDEBUG(883, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yy_pop_state(TSRMLS_C); + zend_copy_value(zendlval, yytext, yyleng); + zendlval->type = IS_STRING; + return T_STRING; +} +yy884: + YYDEBUG(884, *YYCURSOR); + yych = *++YYCURSOR; + goto yy881; +yy885: + YYDEBUG(885, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy886: + YYDEBUG(886, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy885; } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); + goto yy883; +yy887: + YYDEBUG(887, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(888, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + return T_OBJECT_OPERATOR; +} +yy889: + YYDEBUG(889, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy890: + YYDEBUG(890, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy889; + } + goto yy879; } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state(TSRMLS_D) +/* *********************************** */ +yyc_ST_LOOKING_FOR_VARNAME: { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); + static const unsigned char yybm[] = { + 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, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 128, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + YYDEBUG(891, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= '^') { + if (yych <= 0x00) goto yy893; + if (yych <= '@') goto yy897; + if (yych <= 'Z') goto yy895; + goto yy897; + } else { + if (yych <= '`') { + if (yych <= '_') goto yy895; + goto yy897; + } else { + if (yych <= 'z') goto yy895; + if (yych <= '~') goto yy897; + goto yy895; + } + } +yy893: + YYDEBUG(893, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(894, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return 0; } +yy895: + YYDEBUG(895, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy900; +yy896: + YYDEBUG(896, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_copy_value(zendlval, yytext, yyleng); + zendlval->type = IS_STRING; + yy_pop_state(TSRMLS_C); + yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); + return T_STRING_VARNAME; +} +yy897: + YYDEBUG(897, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(898, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yyless(0); + yy_pop_state(TSRMLS_C); + yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); + goto restart; +} +yy899: + YYDEBUG(899, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy900: + YYDEBUG(900, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy899; + } + goto yy896; } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state(TSRMLS_D) +/* *********************************** */ +yyc_ST_NOWDOC: { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif + static const unsigned char yybm[] = { + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 32, 16, 16, 64, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 16, 16, 16, 16, 16, 16, + 16, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 16, 16, 16, 16, 144, + 16, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 16, 16, 16, 16, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + }; + YYDEBUG(901, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy907; + } + if (yych <= 0x00) goto yy903; + if (yych == '\r') goto yy909; + goto yy905; +yy903: + YYDEBUG(903, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy906; + YYDEBUG(904, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return 0; } +yy905: + YYDEBUG(905, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy906: + YYDEBUG(906, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy905; + } + if (yych <= '\f') goto yy916; + goto yy918; +yy907: + YYDEBUG(907, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(908, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy907; + } + if (yych <= '^') { + if (yych <= '\r') { + if (yych <= '\f') goto yy905; + } else { + if (yych <= '@') goto yy905; + if (yych <= 'Z') goto yy911; + goto yy905; + } + } else { + if (yych <= '`') { + if (yych <= '_') goto yy911; + goto yy905; + } else { + if (yych <= 'z') goto yy911; + if (yych <= '~') goto yy905; + goto yy911; + } + } +yy909: + YYDEBUG(909, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(910, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy907; + } + if (yych <= '^') { + if (yych <= '\r') { + if (yych <= '\f') goto yy905; + goto yy909; + } else { + if (yych <= '@') goto yy905; + if (yych >= '[') goto yy905; + } + } else { + if (yych <= '`') { + if (yych >= '`') goto yy905; + } else { + if (yych <= 'z') goto yy911; + if (yych <= '~') goto yy905; + } + } +yy911: + YYDEBUG(911, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(912, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy911; + } + if (yych <= '\f') { + if (yych == '\n') goto yy914; + goto yy905; + } else { + if (yych <= '\r') goto yy914; + if (yych != ';') goto yy905; + } + YYDEBUG(913, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy905; + } +yy914: + YYDEBUG(914, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(915, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + char *end = yytext + yyleng - 1; -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); + if (end[-1] == ';') { + end--; + yyleng--; } + if (yyleng > CG(heredoc_len) && !memcmp(end - CG(heredoc_len), CG(heredoc), CG(heredoc_len))) { + int len = yyleng - CG(heredoc_len) - 2; /* 2 for newline before and after label */ + /* May have matched fooLABEL; make sure there's a newline before it */ + if (yytext[len] != '\n') { + if (yytext[len] != '\r') { + yyless(yyleng - 1); + yymore(); + } + } else if (len > 0 && yytext[len - 1] == '\r') { + len--; /* Windows newline */ + } -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - + /* Go back before label, to match in ST_END_HEREDOC state. yytext will include + * newline before label, for zend_highlight/strip, tokenizer, etc. */ + yyless(yyleng - CG(heredoc_len) - 1); /* 1 for newline after label */ -/* Internal utility routines. */ + CG(increment_lineno) = 1; /* For newline before label */ + BEGIN(ST_END_HEREDOC); -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; + zend_copy_value(zendlval, yytext, len); + zendlval->type = IS_STRING; + HANDLE_NEWLINES(yytext, len); + return T_ENCAPSED_AND_WHITESPACE; + } else { + /* Go back to end of label, so the next match works correctly in case of + * another label at the beginning of the next line */ + yyless(yyleng - 1); + yymore(); } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; +} +yy916: + YYDEBUG(916, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(917, *YYCURSOR); + if (yych <= 'Z') { + if (yych <= '\f') { + if (yych == '\n') goto yy916; + goto yy905; + } else { + if (yych <= '\r') goto yy918; + if (yych <= '@') goto yy905; + goto yy911; + } + } else { + if (yych <= '`') { + if (yych == '_') goto yy911; + goto yy905; + } else { + if (yych <= 'z') goto yy911; + if (yych <= '~') goto yy905; + goto yy911; + } + } +yy918: + YYDEBUG(918, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(919, *YYCURSOR); + if (yych <= 'Z') { + if (yych <= '\f') { + if (yych == '\n') goto yy916; + goto yy905; + } else { + if (yych <= '\r') goto yy918; + if (yych <= '@') goto yy905; + goto yy911; + } + } else { + if (yych <= '`') { + if (yych == '_') goto yy911; + goto yy905; + } else { + if (yych <= 'z') goto yy911; + if (yych <= '~') goto yy905; + goto yy911; + } + } } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif +/* *********************************** */ +yyc_ST_ONE_LINE_COMMENT: { - return (void *) malloc( size ); + static const unsigned char yybm[] = { + 128, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 0, 64, 64, 0, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 0, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 0, 0, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + }; + YYDEBUG(920, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy928; + } + if (yych <= '\r') { + if (yych <= 0x00) goto yy922; + if (yych <= '\f') goto yy931; + goto yy932; + } else { + if (yych <= '=') goto yy924; + if (yych <= '>') goto yy926; + goto yy927; + } +yy922: + YYDEBUG(922, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy937; + YYDEBUG(923, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return 0; } +yy924: + YYDEBUG(924, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '>') goto yy938; +yy925: + YYDEBUG(925, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yymore(); +} +yy926: + YYDEBUG(926, *YYCURSOR); + yych = *++YYCURSOR; + goto yy925; +yy927: + YYDEBUG(927, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '>') goto yy938; + goto yy925; +yy928: + YYDEBUG(928, *YYCURSOR); + yyaccept = 1; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(929, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy936; + } + if (yych <= '\r') { + if (yych == '\n') goto yy935; + if (yych <= '\f') goto yy928; + goto yy935; + } else { + if (yych <= '%') { + if (yych <= '$') goto yy928; + goto yy935; + } else { + if (yych <= '=') goto yy928; + if (yych <= '?') goto yy935; + goto yy928; + } + } +yy930: + YYDEBUG(930, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + switch (yytext[yyleng-1]) { + case '?': case '%': case '>': + yyless(yyleng-1); + yymore(); + break; + case '\n': + CG(zend_lineno)++; + /* intentional fall through */ + default: + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + BEGIN(ST_IN_SCRIPTING); + return T_COMMENT; } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); +} +yy931: + YYDEBUG(931, *YYCURSOR); + yych = *++YYCURSOR; + goto yy930; +yy932: + YYDEBUG(932, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '\n') goto yy930; + YYDEBUG(933, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(934, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + BEGIN(ST_IN_SCRIPTING); + CG(zend_lineno)++; + return T_COMMENT; +} +yy935: + YYDEBUG(935, *YYCURSOR); + yych = *++YYCURSOR; + goto yy930; +yy936: + YYDEBUG(936, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy937: + YYDEBUG(937, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy936; + } + if (yych <= '\r') { + if (yych == '\n') goto yy935; + if (yych <= '\f') goto yy928; + goto yy935; + } else { + if (yych <= '%') { + if (yych <= '$') goto yy928; + goto yy935; + } else { + if (yych <= '=') goto yy928; + if (yych <= '?') goto yy935; + goto yy928; + } + } +yy938: + YYDEBUG(938, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(939, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */ + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng-2; + zendlval->type = IS_STRING; + yyless(yyleng - 2); + BEGIN(ST_IN_SCRIPTING); + return T_COMMENT; + } else { + yymore(); } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); +} } - -#if YY_MAIN -int main() +/* *********************************** */ +yyc_ST_VAR_OFFSET: { - yylex(); - return 0; + static const unsigned char yybm[] = { + 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, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 0, 0, 0, 0, 0, 0, + 0, 160, 160, 160, 160, 160, 160, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 0, 0, 0, 0, 32, + 0, 160, 160, 160, 160, 160, 160, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 0, 0, 0, 0, 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, 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, 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, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + }; + YYDEBUG(940, *YYCURSOR); + YYFILL(3); + yych = *YYCURSOR; + if (yych <= '/') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x00) goto yy942; + if (yych <= 0x08) goto yy956; + goto yy952; + } else { + if (yych == '\r') goto yy952; + goto yy956; + } + } else { + if (yych <= '#') { + if (yych <= ' ') goto yy952; + if (yych <= '"') goto yy951; + goto yy952; + } else { + if (yych <= '$') goto yy947; + if (yych == '\'') goto yy952; + goto yy951; + } + } + } else { + if (yych <= '\\') { + if (yych <= '@') { + if (yych <= '0') goto yy944; + if (yych <= '9') goto yy946; + goto yy951; + } else { + if (yych <= 'Z') goto yy954; + if (yych <= '[') goto yy951; + goto yy952; + } + } else { + if (yych <= '_') { + if (yych <= ']') goto yy949; + if (yych <= '^') goto yy951; + goto yy954; + } else { + if (yych <= '`') goto yy951; + if (yych <= 'z') goto yy954; + if (yych <= '~') goto yy951; + goto yy954; + } + } + } +yy942: + YYDEBUG(942, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(943, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { return 0; } +yy944: + YYDEBUG(944, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'W') { + if (yych <= '/') goto yy945; + if (yych <= '9') goto yy967; + } else { + if (yych <= 'X') goto yy965; + if (yych == 'x') goto yy965; + } +yy945: + YYDEBUG(945, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { /* Offset could be treated as a long */ + if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { + zendlval->value.lval = strtol(yytext, NULL, 10); + zendlval->type = IS_LONG; + } else { + zendlval->value.str.val = (char *)estrndup(yytext, yyleng); + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; } -#endif + return T_NUM_STRING; +} +yy946: + YYDEBUG(946, *YYCURSOR); + yych = *++YYCURSOR; + goto yy964; +yy947: + YYDEBUG(947, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '_') { + if (yych <= '@') goto yy948; + if (yych <= 'Z') goto yy960; + if (yych >= '_') goto yy960; + } else { + if (yych <= '`') goto yy948; + if (yych <= 'z') goto yy960; + if (yych >= 0x7F) goto yy960; + } +yy948: + YYDEBUG(948, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ + return yytext[0]; +} +yy949: + YYDEBUG(949, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(950, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + yy_pop_state(TSRMLS_C); + return ']'; +} +yy951: + YYDEBUG(951, *YYCURSOR); + yych = *++YYCURSOR; + goto yy948; +yy952: + YYDEBUG(952, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(953, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + /* Invalid rule to return a more explicit parse error with proper line number */ + yyless(0); + yy_pop_state(TSRMLS_C); + ZVAL_EMPTY_STRING(zendlval); /* Empty since it won't be used */ + return T_ENCAPSED_AND_WHITESPACE; +} +yy954: + YYDEBUG(954, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy959; +yy955: + YYDEBUG(955, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_copy_value(zendlval, yytext, yyleng); + zendlval->type = IS_STRING; + return T_STRING; +} +yy956: + YYDEBUG(956, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(957, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); + goto restart; +} +yy958: + YYDEBUG(958, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy959: + YYDEBUG(959, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy958; + } + goto yy955; +yy960: + YYDEBUG(960, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(961, *YYCURSOR); + if (yych <= '^') { + if (yych <= '9') { + if (yych >= '0') goto yy960; + } else { + if (yych <= '@') goto yy962; + if (yych <= 'Z') goto yy960; + } + } else { + if (yych <= '`') { + if (yych <= '_') goto yy960; + } else { + if (yych <= 'z') goto yy960; + if (yych >= 0x7F) goto yy960; + } + } +yy962: + YYDEBUG(962, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; +} +yy963: + YYDEBUG(963, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy964: + YYDEBUG(964, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy963; + } + goto yy945; +yy965: + YYDEBUG(965, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy970; + } + YYDEBUG(966, *YYCURSOR); + YYCURSOR = YYMARKER; + goto yy945; +yy967: + YYDEBUG(967, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(968, *YYCURSOR); + if (yych <= '/') goto yy969; + if (yych <= '9') goto yy967; +yy969: + YYDEBUG(969, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); + { /* Offset must be treated as a string */ + zendlval->value.str.val = (char *)estrndup(yytext, yyleng); + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + return T_NUM_STRING; +} +yy970: + YYDEBUG(970, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(971, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy970; + } + goto yy969; + } +} + +} diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h index c02f13c9f..e75f54b39 100644 --- a/Zend/zend_language_scanner.h +++ b/Zend/zend_language_scanner.h @@ -17,26 +17,33 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.h,v 1.19.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_language_scanner.h,v 1.19.2.1.2.1.2.5 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_SCANNER_H #define ZEND_SCANNER_H typedef struct _zend_lex_state { - YY_BUFFER_STATE buffer_state; - int state; + unsigned int yy_leng; + unsigned char *yy_start; + unsigned char *yy_text; + unsigned char *yy_cursor; + unsigned char *yy_marker; + unsigned char *yy_limit; + int yy_state; + zend_stack state_stack; + zend_file_handle *in; uint lineno; char *filename; #ifdef ZEND_MULTIBYTE /* original (unfiltered) script */ - char *script_org; - int script_org_size; + unsigned char *script_org; + size_t script_org_size; /* filtered script */ - char *script_filtered; - int script_filtered_size; + unsigned char *script_filtered; + size_t script_filtered_size; /* input/ouput filters */ zend_encoding_filter input_filter; @@ -47,7 +54,6 @@ typedef struct _zend_lex_state { } zend_lex_state; -void zend_fatal_scanner_error(char *); BEGIN_EXTERN_C() int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC); diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 004260388..7ab9f5871 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1,10 +1,8 @@ -%{ - /* +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -14,40 +12,24 @@ | obtain it through the world-wide-web, please send a note to | | license@zend.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | + | Authors: Marcus Boerger | + | Nuno Lopes | + | Scott MacVicar | + | Flex version authors: | + | Andi Gutmans | | Zeev Suraski | +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.11.2.17 2008/05/10 09:18:27 mattwil Exp $ */ - -#define yyleng SCNG(yy_leng) -#define yytext SCNG(yy_text) -#define yytext_ptr SCNG(yy_text) -#define yyin SCNG(yy_in) -#define yyout SCNG(yy_out) -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#define yy_more_flag SCNG(_yy_more_flag) -#define yy_more_len SCNG(_yy_more_len) - -%} - -%x ST_IN_SCRIPTING -%x ST_DOUBLE_QUOTES -%x ST_BACKQUOTE -%x ST_HEREDOC -%x ST_START_HEREDOC -%x ST_END_HEREDOC -%x ST_LOOKING_FOR_PROPERTY -%x ST_LOOKING_FOR_VARNAME -%x ST_VAR_OFFSET -%x ST_COMMENT -%x ST_DOC_COMMENT -%x ST_ONE_LINE_COMMENT -%option stack - -%{ +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13.2.37 2009/03/16 01:40:13 shire Exp $ */ + +#if 0 +# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c) +#else +# define YYDEBUG(s, c) +#endif + +#include "zend_language_scanner_defs.h" #include #include "zend.h" @@ -62,6 +44,35 @@ #include "zend_API.h" #include "zend_strtod.h" #include "zend_exceptions.h" +#include "tsrm_virtual_cwd.h" +#include "tsrm_config_common.h" + +#define YYCTYPE unsigned char +#define YYFILL(n) { if ((YYCURSOR + n) >= (YYLIMIT + ZEND_MMAP_AHEAD)) { return 0; } } +#define YYCURSOR SCNG(yy_cursor) +#define YYLIMIT SCNG(yy_limit) +#define YYMARKER SCNG(yy_marker) + +#define YYGETCONDITION() SCNG(yy_state) +#define YYSETCONDITION(s) SCNG(yy_state) = s + +#define STATE(name) yyc##name + +/* emulate flex constructs */ +#define BEGIN(state) YYSETCONDITION(STATE(state)) +#define YYSTATE YYGETCONDITION() +#define yytext ((char*)SCNG(yy_text)) +#define yyleng SCNG(yy_leng) +#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ + yyleng = (unsigned int)x; } while(0) +#define yymore() goto yymore_restart + +/* perform sanity check. If this message is triggered you should + increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */ +/*!max:re2c */ +#if ZEND_MMAP_AHEAD < YYMAXFILL +# error ZEND_MMAP_AHEAD should be greater than or equal to YYMAXFILL +#endif #ifdef HAVE_STDARG_H # include @@ -71,28 +82,14 @@ # include #endif -#define YY_DECL int lex_scan(zval *zendlval TSRMLS_DC) - -#define ECHO { ZEND_WRITE( yytext, yyleng ); } - -#ifdef ZTS -# define MY_INPUT yyinput -#else -# define MY_INPUT input -#endif - - /* Globals Macros */ #define SCNG LANG_SCNG #ifdef ZTS ZEND_API ts_rsrc_id language_scanner_globals_id; #else -ZEND_API zend_scanner_globals language_scanner_globals; +ZEND_API zend_php_scanner_globals language_scanner_globals; #endif - -#define YY_FATAL_ERROR zend_fatal_scanner_error - #define HANDLE_NEWLINES(s, l) \ do { \ char *p = (s), *boundary = p+(l); \ @@ -112,76 +109,75 @@ do { \ } \ } - #define ZEND_IS_OCT(c) ((c)>='0' && (c)<='7') #define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F')) +BEGIN_EXTERN_C() -void zend_fatal_scanner_error(char *message) +static void _yy_push_state(int new_state TSRMLS_DC) { - zend_error(E_COMPILE_ERROR, "%s", message); + zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int)); + YYSETCONDITION(new_state); +} + +#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm) + +static void yy_pop_state(TSRMLS_D) +{ + int *stack_state; + zend_stack_top(&SCNG(state_stack), (void **) &stack_state); + YYSETCONDITION(*stack_state); + zend_stack_del_top(&SCNG(state_stack)); +} + +static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC) +{ + YYCURSOR = (YYCTYPE*)str; + SCNG(yy_start) = YYCURSOR; + YYLIMIT = YYCURSOR + len; } -BEGIN_EXTERN_C() void startup_scanner(TSRMLS_D) { CG(heredoc) = NULL; CG(heredoc_len) = 0; CG(doc_comment) = NULL; CG(doc_comment_len) = 0; - SCNG(yy_start_stack_ptr) = 0; - SCNG(yy_start_stack_depth) = 0; - SCNG(current_buffer) = NULL; -#ifdef ZEND_MULTIBYTE - SCNG(script_org) = NULL; - SCNG(script_org_size) = 0; - SCNG(script_filtered) = NULL; - SCNG(script_filtered_size) = 0; - SCNG(input_filter) = NULL; - SCNG(output_filter) = NULL; - SCNG(script_encoding) = NULL; - SCNG(internal_encoding) = NULL; -#endif /* ZEND_MULTIBYTE */ + zend_llist_init(&SCNG(used_state_stacks), sizeof(zend_stack), (llist_dtor_func_t) zend_stack_destroy, 0); + zend_stack_init(&SCNG(state_stack)); + zend_llist_add_element(&SCNG(used_state_stacks), &SCNG(state_stack)); } - void shutdown_scanner(TSRMLS_D) { if (CG(heredoc)) { efree(CG(heredoc)); CG(heredoc_len)=0; } - if (SCNG(yy_start_stack)) { - yy_flex_free(SCNG(yy_start_stack)); - SCNG(yy_start_stack) = NULL; - } + zend_llist_destroy(&SCNG(used_state_stacks)); RESET_DOC_COMMENT(); - -#ifdef ZEND_MULTIBYTE - if (SCNG(script_org)) { - efree(SCNG(script_org)); - SCNG(script_org) = NULL; - } - if (SCNG(script_filtered)) { - efree(SCNG(script_filtered)); - SCNG(script_filtered) = NULL; - } - SCNG(script_org_size) = 0; - SCNG(script_filtered_size) = 0; - SCNG(input_filter) = NULL; - SCNG(output_filter) = NULL; - SCNG(script_encoding) = NULL; - SCNG(internal_encoding) = NULL; -#endif /* ZEND_MULTIBYTE */ } -END_EXTERN_C() +static int compare_stacks(zend_stack *stack1, zend_stack *stack2) +{ + return (stack1 == stack2); +} ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC) { - memcpy(&lex_state->buffer_state, &YY_CURRENT_BUFFER, sizeof(YY_BUFFER_STATE)); + lex_state->yy_leng = SCNG(yy_leng); + lex_state->yy_start = SCNG(yy_start); + lex_state->yy_text = SCNG(yy_text); + lex_state->yy_cursor = SCNG(yy_cursor); + lex_state->yy_marker = SCNG(yy_marker); + lex_state->yy_limit = SCNG(yy_limit); + + lex_state->state_stack = SCNG(state_stack); + zend_stack_init(&SCNG(state_stack)); + zend_llist_add_element(&SCNG(used_state_stacks), &SCNG(state_stack)); + lex_state->in = SCNG(yy_in); - lex_state->state = YYSTATE; + lex_state->yy_state = YYSTATE; lex_state->filename = zend_get_compiled_filename(TSRMLS_C); lex_state->lineno = CG(zend_lineno); @@ -199,20 +195,20 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC) ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC) { - YY_BUFFER_STATE original_buffer_state = YY_CURRENT_BUFFER; + SCNG(yy_leng) = lex_state->yy_leng; + SCNG(yy_start) = lex_state->yy_start; + SCNG(yy_text) = lex_state->yy_text; + SCNG(yy_cursor) = lex_state->yy_cursor; + SCNG(yy_marker) = lex_state->yy_marker; + SCNG(yy_limit) = lex_state->yy_limit; - if (lex_state->buffer_state) { - yy_switch_to_buffer(lex_state->buffer_state TSRMLS_CC); - } else { - YY_CURRENT_BUFFER = NULL; - } + zend_llist_del_element(&SCNG(used_state_stacks), &SCNG(state_stack), (int (*)(void *, void *)) compare_stacks); + SCNG(state_stack) = lex_state->state_stack; - yy_delete_buffer(original_buffer_state TSRMLS_CC); SCNG(yy_in) = lex_state->in; - BEGIN(lex_state->state); + YYSETCONDITION(lex_state->yy_state); CG(zend_lineno) = lex_state->lineno; zend_restore_compiled_filename(lex_state->filename TSRMLS_CC); - #ifdef ZEND_MULTIBYTE if (SCNG(script_org)) { efree(SCNG(script_org)); @@ -233,57 +229,6 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC) #endif /* ZEND_MULTIBYTE */ } - -BEGIN_EXTERN_C() - - -ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) -{ - TSRMLS_FETCH(); - - switch (fh->type) { - case ZEND_HANDLE_FP: - fclose(fh->handle.fp); - break; - case ZEND_HANDLE_STREAM: - if (fh->handle.stream.closer) { - fh->handle.stream.closer(fh->handle.stream.handle TSRMLS_CC); - } - break; - case ZEND_HANDLE_FILENAME: - /* We're only supposed to get here when destructing the used_files hash, - * which doesn't really contain open files, but references to their names/paths - */ - break; - } - if (fh->opened_path) { - efree(fh->opened_path); - fh->opened_path = NULL; - } - if (fh->free_filename && fh->filename) { - efree(fh->filename); - fh->filename = NULL; - } -} - - -int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) -{ - if (fh1->type != fh2->type) { - return 0; - } - switch (fh1->type) { - case ZEND_HANDLE_FP: - return fh1->handle.fp==fh2->handle.fp; - break; - case ZEND_HANDLE_STREAM: - return fh1->handle.stream.handle == fh2->handle.stream.handle; - break; - } - return 0; -} - - ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC) { zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles); @@ -297,49 +242,49 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC) ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC) { - char *file_path=NULL; + char *file_path = NULL, *buf; + size_t size; - if (FAILURE == zend_stream_fixup(file_handle TSRMLS_CC)) { + if (zend_stream_fixup(file_handle, &buf, &size TSRMLS_CC) == FAILURE) { return FAILURE; } zend_llist_add_element(&CG(open_files), file_handle); - + if (file_handle->handle.stream.handle >= (void*)file_handle && file_handle->handle.stream.handle <= (void*)(file_handle+1)) { + zend_file_handle *fh = (zend_file_handle*)zend_llist_get_last(&CG(open_files)); + size_t diff = (char*)file_handle->handle.stream.handle - (char*)file_handle; + fh->handle.stream.handle = (void*)(((char*)fh) + diff); + file_handle->handle.stream.handle = fh->handle.stream.handle; + } + /* Reset the scanner for scanning the new file */ SCNG(yy_in) = file_handle; + if (size != -1) { #ifdef ZEND_MULTIBYTE - if (file_handle->handle.stream.interactive == 0) { - if (zend_multibyte_read_script(TSRMLS_C) != 0) { + if (zend_multibyte_read_script((unsigned char *)buf, size TSRMLS_CC) != 0) { return FAILURE; } - /* force flex to use buffer only */ SCNG(yy_in) = NULL; - SCNG(init) = 0; - SCNG(start) = 1; zend_multibyte_set_filter(NULL TSRMLS_CC); if (!SCNG(input_filter)) { - SCNG(script_filtered) = (char*)emalloc(SCNG(script_org_size)+1); + SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+1); memcpy(SCNG(script_filtered), SCNG(script_org), SCNG(script_org_size)+1); SCNG(script_filtered_size) = SCNG(script_org_size); } else { SCNG(input_filter)(&SCNG(script_filtered), &SCNG(script_filtered_size), SCNG(script_org), SCNG(script_org_size) TSRMLS_CC); } - /* flex requires doubled null */ - SCNG(script_filtered) = (char*)erealloc(SCNG(script_filtered), SCNG(script_filtered_size)+2); - *(SCNG(script_filtered)+SCNG(script_filtered_size)) = (char)NULL; - *(SCNG(script_filtered)+SCNG(script_filtered_size)+1) = (char)NULL; - yy_scan_buffer(SCNG(script_filtered), SCNG(script_filtered_size)+2 TSRMLS_CC); + yy_scan_buffer((char *)SCNG(script_filtered), SCNG(script_filtered_size) TSRMLS_CC); +#else /* !ZEND_MULTIBYTE */ + yy_scan_buffer(buf, size TSRMLS_CC); +#endif /* ZEND_MULTIBYTE */ } else { - yy_switch_to_buffer(yy_create_buffer(SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC); + zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed"); } -#else /* !ZEND_MULTIBYTE */ - yy_switch_to_buffer(yy_create_buffer(SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC); -#endif /* ZEND_MULTIBYTE */ BEGIN(INITIAL); @@ -378,8 +323,8 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR retval_znode.op_type = IS_CONST; retval_znode.u.constant.type = IS_LONG; retval_znode.u.constant.value.lval = 1; - retval_znode.u.constant.is_ref = 0; - retval_znode.u.constant.refcount = 1; + Z_UNSET_ISREF(retval_znode.u.constant); + Z_SET_REFCOUNT(retval_znode.u.constant, 1); zend_save_lexical_state(&original_lex_state TSRMLS_CC); @@ -387,10 +332,10 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) { if (type==ZEND_REQUIRE) { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC); zend_bailout(); } else { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC); } compilation_successful=0; } else { @@ -399,7 +344,6 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR CG(active_op_array) = op_array; compiler_result = zendparse(TSRMLS_C); zend_do_return(&retval_znode, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); CG(in_compilation) = original_in_compilation; if (compiler_result==1) { /* parser error */ zend_bailout(); @@ -411,6 +355,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR CG(active_op_array) = original_active_op_array; if (compilation_successful) { pass_two(op_array TSRMLS_CC); + zend_release_labels(TSRMLS_C); } else { efree(op_array); retval = NULL; @@ -467,33 +412,29 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC) { /* enforce two trailing NULLs for flex... */ - STR_REALLOC(str->value.str.val, str->value.str.len+2); + str->value.str.val = safe_erealloc(str->value.str.val, 1, str->value.str.len, ZEND_MMAP_AHEAD); - str->value.str.val[str->value.str.len+1]=0; + memset(str->value.str.val + str->value.str.len, 0, ZEND_MMAP_AHEAD); SCNG(yy_in)=NULL; #ifdef ZEND_MULTIBYTE - SCNG(script_org) = estrdup(str->value.str.val); + SCNG(script_org) = (unsigned char *)estrdup(str->value.str.val); SCNG(script_org_size) = str->value.str.len; zend_multibyte_set_filter(CG(internal_encoding) TSRMLS_CC); if (!SCNG(input_filter)) { - SCNG(script_filtered) = (char*)emalloc(SCNG(script_org_size)+1); + SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+1); memcpy(SCNG(script_filtered), SCNG(script_org), SCNG(script_org_size)+1); SCNG(script_filtered_size) = SCNG(script_org_size); } else { SCNG(input_filter)(&SCNG(script_filtered), &SCNG(script_filtered_size), SCNG(script_org), SCNG(script_org_size) TSRMLS_CC); } - /* flex requires doubled null */ - SCNG(script_filtered) = (char*)erealloc(SCNG(script_filtered), SCNG(script_filtered_size)+2); - *(SCNG(script_filtered)+SCNG(script_filtered_size)) = (char)NULL; - *(SCNG(script_filtered)+SCNG(script_filtered_size)+1) = (char)NULL; - yy_scan_buffer(SCNG(script_filtered), SCNG(script_filtered_size)+2 TSRMLS_CC); + yy_scan_buffer((char *)SCNG(script_filtered), SCNG(script_filtered_size) TSRMLS_CC); #else /* !ZEND_MULTIBYTE */ - yy_scan_buffer(str->value.str.val, str->value.str.len+2 TSRMLS_CC); + yy_scan_buffer(str->value.str.val, str->value.str.len TSRMLS_CC); #endif /* ZEND_MULTIBYTE */ zend_set_compiled_filename(filename TSRMLS_CC); @@ -503,19 +444,27 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D } -ZEND_API int zend_get_scanned_file_offset(TSRMLS_D) +ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D) { - if (yyin) { - int offset_in_buffer = (yy_c_buf_p - (YY_CURRENT_BUFFER)->yy_ch_buf); - int read_bytes = SCNG(yy_n_chars); - int offset_from_the_end = read_bytes - offset_in_buffer; - - return zend_stream_ftell(yyin TSRMLS_CC) - offset_from_the_end; - } else { - /* The entire file is in the buffer; probably zend multibyte - is enabled */ - return (yy_c_buf_p - (YY_CURRENT_BUFFER)->yy_ch_buf); + size_t offset = SCNG(yy_cursor) - SCNG(yy_start); +#ifdef ZEND_MULTIBYTE + if (SCNG(input_filter)) { + size_t original_offset = offset, length = 0; do { + unsigned char *p = NULL; + SCNG(input_filter)(&p, &length, SCNG(script_org), offset TSRMLS_CC); + if (!p) { + break; + } + efree(p); + if (length > original_offset) { + offset--; + } else if (length < original_offset) { + offset++; + } + } while (original_offset != length); } +#endif + return offset; } @@ -547,7 +496,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) retval = NULL; } else { zend_bool orig_interactive = CG(interactive); - + CG(interactive) = 0; init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC); CG(interactive) = orig_interactive; @@ -572,9 +521,9 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) retval = NULL; } else { zend_do_return(NULL, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); CG(active_op_array) = original_active_op_array; pass_two(op_array TSRMLS_CC); + zend_release_labels(TSRMLS_C); retval = op_array; } zend_restore_lexical_state(&original_lex_state TSRMLS_CC); @@ -597,7 +546,7 @@ int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlight file_handle.opened_path = NULL; zend_save_lexical_state(&original_lex_state TSRMLS_CC); if (open_file_for_scanning(&file_handle TSRMLS_CC)==FAILURE) { - zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename); + zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename TSRMLS_CC); return FAILURE; } zend_highlight(syntax_highlighter_ini TSRMLS_CC); @@ -646,56 +595,49 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ END_EXTERN_C() #ifdef ZEND_MULTIBYTE + BEGIN_EXTERN_C() ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, zend_encoding *old_encoding TSRMLS_DC) { - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - int offset, original_offset, length, free_flag; - char *p; - zend_encoding *new_encoding; + size_t original_offset, offset, free_flag, new_len, length; + unsigned char *p; /* calculate current position */ - offset = original_offset = yy_c_buf_p - b->yy_ch_buf; - if (old_input_filter && original_offset > 0) { - new_encoding = SCNG(script_encoding); + offset = original_offset = YYCURSOR - SCNG(yy_start); + if (old_input_filter && offset > 0) { + zend_encoding *new_encoding = SCNG(script_encoding); + zend_encoding_filter new_filter = SCNG(input_filter); SCNG(script_encoding) = old_encoding; - do { - (old_input_filter)(&p, &length, SCNG(script_org), offset TSRMLS_CC); - if (!p) { - SCNG(script_encoding) = new_encoding; - return; - } - efree(p); - if (length > original_offset) { - offset--; - } else if (length < original_offset) { - offset++; - } - } while (original_offset != length); + SCNG(input_filter) = old_input_filter; + offset = zend_get_scanned_file_offset(TSRMLS_C); SCNG(script_encoding) = new_encoding; + SCNG(input_filter) = new_filter; } /* convert and set */ if (!SCNG(input_filter)) { - length = SCNG(script_org_size)-offset-1; - p = SCNG(script_org)+offset+1; + length = SCNG(script_org_size) - offset; + p = SCNG(script_org) + offset; free_flag = 0; } else { - SCNG(input_filter)(&p, &length, SCNG(script_org)+offset+1, SCNG(script_org_size)-offset-1 TSRMLS_CC); + SCNG(input_filter)(&p, &length, SCNG(script_org) + offset, SCNG(script_org_size) - offset TSRMLS_CC); free_flag = 1; } - if (original_offset+length+1 > (int)b->yy_buf_size) { - b->yy_buf_size = original_offset+length+1; - b->yy_ch_buf = (char*)erealloc(b->yy_ch_buf, b->yy_buf_size+2); - SCNG(script_filtered) = b->yy_ch_buf; - SCNG(script_filtered_size) = b->yy_buf_size; + + new_len = original_offset + length; + + if (new_len > YYLIMIT - SCNG(yy_start)) { + unsigned char *new_yy_start = erealloc(SCNG(yy_start), new_len); + SCNG(yy_cursor) = new_yy_start + (SCNG(yy_cursor) - SCNG(yy_start)); + SCNG(yy_marker) = new_yy_start + (SCNG(yy_marker) - SCNG(yy_start)); + SCNG(yy_text) = new_yy_start + (SCNG(yy_text) - SCNG(yy_start)); + SCNG(yy_start) = new_yy_start; + SCNG(script_filtered) = new_yy_start; + SCNG(script_filtered_size) = new_len; } - yy_c_buf_p = b->yy_ch_buf + original_offset; - strncpy(yy_c_buf_p+1, p, length); - b->yy_n_chars = original_offset + length + 1; - SCNG(yy_n_chars) = b->yy_n_chars; - b->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[SCNG(yy_n_chars)+1] = YY_END_OF_BUFFER_CHAR; + + SCNG(yy_limit) = SCNG(yy_start) + new_len; + memmove(SCNG(yy_start) + original_offset, p, length); if (free_flag) { efree(p); @@ -705,10 +647,14 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter ZEND_API int zend_multibyte_yyinput(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC) { - int c = '*', n; + size_t n; - if (file_handle->handle.stream.interactive == 0) { - return zend_stream_read(file_handle, buf, len TSRMLS_CC); + if (CG(interactive) == 0) { + if (zend_stream_fixup(file_handle, &buf, &len TSRMLS_CC) == FAILURE) { + return FAILURE; + } + n = len; + return n; } /* interactive */ @@ -722,44 +668,29 @@ ZEND_API int zend_multibyte_yyinput(zend_file_handle *file_handle, char *buf, si SCNG(script_org_size) = 0; /* TODO: support widechars */ - - for (n = 0; n < len && (c = zend_stream_getc(yyin TSRMLS_CC)) != EOF && c != '\n'; ++n) { - buf[n] = (char)c; - } - if (c == '\n') { - buf[n++] = (char) c; + if (zend_stream_fixup(file_handle, &buf, &len TSRMLS_CC) == FAILURE) { + return FAILURE; } + n = len; SCNG(script_org_size) = n; - SCNG(script_org) = (char*)emalloc(SCNG(script_org_size) + 1); + SCNG(script_org) = (unsigned char*)emalloc(SCNG(script_org_size) + 1); memcpy(SCNG(script_org), buf, n); return n; } -ZEND_API int zend_multibyte_read_script(TSRMLS_D) +ZEND_API int zend_multibyte_read_script(unsigned char *buf, size_t n TSRMLS_DC) { - char buf[8192]; - int n; - if (SCNG(script_org)) { efree(SCNG(script_org)); } - SCNG(script_org) = NULL; - SCNG(script_org_size) = 0; - - for (; (n = zend_stream_read(yyin, buf, sizeof(buf) TSRMLS_CC)) > 0; ) { - SCNG(script_org_size) += n; - SCNG(script_org) = (char*)erealloc(SCNG(script_org), SCNG(script_org_size)); - memcpy(SCNG(script_org) + SCNG(script_org_size) - n, buf, n); - } - - if (n < 0) { - return -1; - } - - SCNG(script_org) = (char*)erealloc(SCNG(script_org), SCNG(script_org_size) + 1); + SCNG(script_org_size) = n; + SCNG(script_org) = (unsigned char*)erealloc(SCNG(script_org), SCNG(script_org_size)); + memcpy(SCNG(script_org) + SCNG(script_org_size) - n, buf, n); + + SCNG(script_org) = (unsigned char*)erealloc(SCNG(script_org), SCNG(script_org_size) + 1); *(SCNG(script_org)+SCNG(script_org_size)) = '\0'; return 0; @@ -768,7 +699,9 @@ ZEND_API int zend_multibyte_read_script(TSRMLS_D) # define zend_copy_value(zendlval, yytext, yyleng) \ if (SCNG(output_filter)) { \ - SCNG(output_filter)(&(zendlval->value.str.val), &(zendlval->value.str.len), yytext, yyleng TSRMLS_CC); \ + size_t sz = 0; \ + SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \ + zendlval->value.str.len = sz; \ } else { \ zendlval->value.str.val = (char *) estrndup(yytext, yyleng); \ zendlval->value.str.len = yyleng; \ @@ -881,28 +814,38 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo s++; } *t = 0; - #ifdef ZEND_MULTIBYTE if (SCNG(output_filter)) { + size_t sz = 0; s = zendlval->value.str.val; - SCNG(output_filter)(&(zendlval->value.str.val), &(zendlval->value.str.len), s, zendlval->value.str.len TSRMLS_CC); + SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)s, (size_t)zendlval->value.str.len TSRMLS_CC); + zendlval->value.str.len = sz; efree(s); } #endif /* ZEND_MULTIBYTE */ } -%} +int lex_scan(zval *zendlval TSRMLS_DC) +{ +restart: + SCNG(yy_text) = YYCURSOR; + +yymore_restart: + +/*!re2c +re2c:yyfill:check = 0; LNUM [0-9]+ -DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*) +DNUM ([0-9]*"."[0-9]+)|([0-9]+"."[0-9]*) EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) HNUM "0x"[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@] -ANY_CHAR (.|[\n]) +ANY_CHAR [^\x00] NEWLINE ("\r"|"\n"|"\r\n") +NULL [\x00]{1} /* * LITERAL_DOLLAR matches unescaped $ that aren't followed by a label character @@ -956,9 +899,11 @@ DOUBLE_QUOTES_CHARS ("{"*([^$"\\{]|("\\"{ANY_CHAR}))|{DOUBLE_QUOTES_LITERAL_DOLL BACKQUOTE_CHARS ("{"*([^$`\\{]|("\\"{ANY_CHAR}))|{BACKQUOTE_LITERAL_DOLLAR}) HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({HEREDOC_NEWLINE}+({HEREDOC_NON_LABEL}|{HEREDOC_LABEL_NO_NEWLINE}))) -%option noyylineno -%option noyywrap -%% +NOWDOC_CHARS ([^\n\r]|{NEWLINE}+([^a-zA-Z_\x7f-\xff\n\r]|({LABEL}([^a-zA-Z0-9_\x7f-\xff;\n\r]|(";"[^\n\r]))))) + +/* compute yyleng before each rule */ + := yyleng = YYCURSOR - SCNG(yy_text); + "exit" { return T_EXIT; @@ -1076,6 +1021,10 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return T_CONTINUE; } +"goto" { + return T_GOTO; +} + "echo" { return T_ECHO; } @@ -1105,6 +1054,14 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return T_OBJECT_OPERATOR; } +{WHITESPACE}+ { + zendlval->value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + HANDLE_NEWLINES(yytext, yyleng); + return T_WHITESPACE; +} + "->" { return T_OBJECT_OPERATOR; } @@ -1119,12 +1076,17 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ {ANY_CHAR} { yyless(0); yy_pop_state(TSRMLS_C); + goto restart; } "::" { return T_PAAMAYIM_NEKUDOTAYIM; } +"\\" { + return T_NS_SEPARATOR; +} + "new" { return T_NEW; } @@ -1189,6 +1151,10 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return T_REQUIRE_ONCE; } +"namespace" { + return T_NAMESPACE; +} + "use" { return T_USE; } @@ -1372,8 +1338,7 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ "}" { RESET_DOC_COMMENT(); - /* This is a temporary fix which is dependant on flex and it's implementation */ - if (yy_start_stack_ptr) { + if (!zend_stack_is_empty(&SCNG(state_stack))) { yy_pop_state(TSRMLS_C); } return '}'; @@ -1393,6 +1358,7 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ yyless(0); yy_pop_state(TSRMLS_C); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); + goto restart; } @@ -1438,7 +1404,7 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ } } -0|([1-9][0-9]*) { /* Offset could be treated as a long */ +[0]|([1-9][0-9]*) { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { zendlval->value.lval = strtol(yytext, NULL, 10); zendlval->type = IS_LONG; @@ -1534,56 +1500,75 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return T_FILE; } -(([^<]|"<"[^?%s<]){1,400})|"value.str.val), &(zendlval->value.str.len), yytext, yyleng TSRMLS_CC); - if (readsize < yyleng) { - yyless(readsize); - } +"__DIR__" { + char *filename = zend_get_compiled_filename(TSRMLS_C); + const size_t filename_len = strlen(filename); + char *dirname; + + if (!filename) { + filename = ""; + } + + dirname = estrndup(filename, filename_len); + zend_dirname(dirname, filename_len); + + if (strcmp(dirname, ".") == 0) { + dirname = erealloc(dirname, MAXPATHLEN); +#if HAVE_GETCWD + VCWD_GETCWD(dirname, MAXPATHLEN); +#elif HAVE_GETWD + VCWD_GETWD(dirname); +#endif + } + + zendlval->value.str.len = strlen(dirname); + zendlval->value.str.val = dirname; + zendlval->type = IS_STRING; + return T_DIR; +} + +"__NAMESPACE__" { + if (CG(current_namespace)) { + *zendlval = *CG(current_namespace); + zval_copy_ctor(zendlval); } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; + ZVAL_EMPTY_STRING(zendlval); } -#else /* !ZEND_MULTIBYTE */ - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); + return T_NS_C; +} + +"" { + HANDLE_NEWLINES(yytext, yyleng); + zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; -#endif /* ZEND_MULTIBYTE */ zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext, yyleng); - return T_INLINE_HTML; + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; } -"" { - HANDLE_NEWLINES(yytext, yyleng); - if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not */ + +"<%=" { + if (CG(asp_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; zendlval->type = IS_STRING; BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG; + return T_OPEN_TAG_WITH_ECHO; } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; + goto inline_char_handler; } } -"<%="|""value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; zendlval->type = IS_STRING; BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; + goto inline_char_handler; } } @@ -1596,10 +1581,7 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; + goto inline_char_handler; } } @@ -1613,16 +1595,69 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return T_OPEN_TAG; } -"$"{LABEL} { - zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + +"value.str.val = yytext; /* no copying - intentional */ + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; + } else { + goto inline_char_handler; + } +} + +{ANY_CHAR} { + +inline_char_handler: + + while (1) { + YYCTYPE *ptr = memchr(YYCURSOR, '<', YYLIMIT - YYCURSOR); + + if (ptr == NULL) { + YYCURSOR = YYLIMIT; + yyleng = YYCURSOR - SCNG(yy_text); + break; + + } else { + YYCURSOR = ptr + 1; + + /* stop if it may be an opening tag (). this condition is not optimal though */ + if (YYCURSOR < YYLIMIT && (*YYCURSOR == '?' || *YYCURSOR == '%' || *YYCURSOR == 's')) { + --YYCURSOR; + yyleng = YYCURSOR - SCNG(yy_text); + break; + } + } + } + +#ifdef ZEND_MULTIBYTE + if (SCNG(output_filter)) { + int readsize; + size_t sz = 0; + readsize = SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); + zendlval->value.str.len = sz; + if (readsize < yyleng) { + yyless(readsize); + } + } else { + zendlval->value.str.val = (char *) estrndup(yytext, yyleng); + zendlval->value.str.len = yyleng; + } +#else /* !ZEND_MULTIBYTE */ + zendlval->value.str.val = (char *) estrndup(yytext, yyleng); + zendlval->value.str.len = yyleng; +#endif zendlval->type = IS_STRING; - return T_VARIABLE; + HANDLE_NEWLINES(yytext, yyleng); + return T_INLINE_HTML; } -%{ + /* Make sure a label character follows "->", otherwise there is no property * and "->" will be taken literally - */ %} + */ "$"{LABEL}"->"[a-zA-Z_\x7f-\xff] { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1631,9 +1666,8 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return T_VARIABLE; } -%{ /* A [ always designates a variable offset, regardless of what follows - */ %} + */ "$"{LABEL}"[" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1642,6 +1676,12 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return T_VARIABLE; } +"$"{LABEL} { + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; +} + "]" { yy_pop_state(TSRMLS_C); return ']'; @@ -1667,15 +1707,6 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ } -{WHITESPACE} { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext, yyleng); - return T_WHITESPACE; -} - - "#"|"//" { BEGIN(ST_ONE_LINE_COMMENT); yymore(); @@ -1713,11 +1744,11 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ } "?>"|"%>" { - if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */ + if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */ zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng-2; zendlval->type = IS_STRING; - yyless(yyleng-2); + yyless(yyleng - 2); BEGIN(ST_IN_SCRIPTING); return T_COMMENT; } else { @@ -1726,14 +1757,17 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ } "/**"{WHITESPACE} { - CG(comment_start_line) = CG(zend_lineno); RESET_DOC_COMMENT(); BEGIN(ST_DOC_COMMENT); yymore(); } +{NULL} { + zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno)); + return 0; +} + "/*" { - CG(comment_start_line) = CG(zend_lineno); BEGIN(ST_COMMENT); yymore(); } @@ -1784,9 +1818,8 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ } -%{ /* ("{"*|"$"*) handles { or $ at the end of a string (or the entire contents) - */ %} + */ (b?["]{DOUBLE_QUOTES_CHARS}*("{"*|"$"*)["]) { int bprefix = (yytext[0] != '"') ? 1 : 0; @@ -1835,12 +1868,13 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ #ifdef ZEND_MULTIBYTE if (SCNG(output_filter)) { + size_t sz = 0; s = zendlval->value.str.val; - SCNG(output_filter)(&(zendlval->value.str.val), &(zendlval->value.str.len), s, zendlval->value.str.len TSRMLS_CC); + SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)s, (size_t)zendlval->value.str.len TSRMLS_CC); + zendlval->value.str.len = sz; efree(s); } #endif /* ZEND_MULTIBYTE */ - return T_CONSTANT_ENCAPSED_STRING; } @@ -1851,7 +1885,7 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ } -b?"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} { +b?"<<<"{TABS_AND_SPACES}({LABEL}|([']{LABEL}['])|(["]{LABEL}["])){NEWLINE} { char *s; int bprefix = (yytext[0] != '<') ? 1 : 0; @@ -1862,52 +1896,52 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ s++; CG(heredoc_len)--; } - CG(heredoc) = estrndup(s, CG(heredoc_len)); - BEGIN(ST_START_HEREDOC); - return T_START_HEREDOC; -} + if (*s == '\'') { + s++; + CG(heredoc_len) -= 2; -[`] { - BEGIN(ST_BACKQUOTE); - return '`'; -} + BEGIN(ST_NOWDOC); + } else { + if (*s == '"') { + s++; + CG(heredoc_len) -= 2; + } + + BEGIN(ST_HEREDOC); + } + CG(heredoc) = estrndup(s, CG(heredoc_len)); -{ANY_CHAR} { - yyless(0); - BEGIN(ST_HEREDOC); -} + /* Check for ending label on the next line */ + if (CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, CG(heredoc_len))) { + unsigned char *end = YYCURSOR + CG(heredoc_len); -{LABEL}";"?[\n\r] { - int label_len = yyleng - 1; + if (*end == ';') { + end++; + } - if (yytext[label_len-1]==';') { - label_len--; + if (*end == '\n' || *end == '\r') { + BEGIN(ST_END_HEREDOC); + } } - yyless(label_len); + return T_START_HEREDOC; +} - if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) { - zendlval->value.str.val = CG(heredoc); - zendlval->value.str.len = label_len; - CG(heredoc)=NULL; - CG(heredoc_len)=0; - BEGIN(ST_IN_SCRIPTING); - return T_END_HEREDOC; - } else { - yymore(); - BEGIN(ST_HEREDOC); - } + +[`] { + BEGIN(ST_BACKQUOTE); + return '`'; } -%{ + /* Match everything up to and including a possible ending label, so if the label * doesn't match, it's kept with the rest of the string * * {HEREDOC_NEWLINE}+ handles the case of more than one newline sequence that * couldn't be matched with HEREDOC_CHARS, because of the following label - */ %} + */ {HEREDOC_CHARS}*{HEREDOC_NEWLINE}+{LABEL}";"?[\n\r] { char *end = yytext + yyleng - 1; @@ -1922,18 +1956,16 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ /* May have matched fooLABEL; make sure there's a newline before it */ if (yytext[len] != '\n') { if (yytext[len] != '\r') { - goto wrong_label; + yyless(yyleng - 1); + yymore(); } } else if (len > 0 && yytext[len - 1] == '\r') { len--; /* Windows newline */ } - /* Go back before last label char, to match in ST_END_HEREDOC state */ - yyless(yyleng - 2); - - /* Subtract the remaining label length. yyleng must include newline - * before label, for zend_highlight/strip, tokenizer, etc. */ - yyleng -= CG(heredoc_len) - 1; + /* Go back before label, to match in ST_END_HEREDOC state. yytext will include + * newline before label, for zend_highlight/strip, tokenizer, etc. */ + yyless(yyleng - CG(heredoc_len) - 1); /* 1 for newline after label */ CG(increment_lineno) = 1; /* For newline before label */ BEGIN(ST_END_HEREDOC); @@ -1942,17 +1974,17 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ } else { /* Go back to end of label, so the next match works correctly in case of * a variable or another label at the beginning of the next line */ -wrong_label: yyless(yyleng - 1); yymore(); } } {ANY_CHAR} { - zendlval->value.str.val = CG(heredoc); - zendlval->value.str.len = CG(heredoc_len); - yytext = zendlval->value.str.val; - yyleng = zendlval->value.str.len; + YYCURSOR += CG(heredoc_len) - 1; + yyleng = CG(heredoc_len); + + Z_STRVAL_P(zendlval) = CG(heredoc); + Z_STRLEN_P(zendlval) = CG(heredoc_len); CG(heredoc) = NULL; CG(heredoc_len) = 0; BEGIN(ST_IN_SCRIPTING); @@ -1960,10 +1992,10 @@ wrong_label: } -"{$" { +/* Will only match when $ follows: "{$" */ +"{" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); - yyless(1); return T_CURLY_OPEN; } @@ -1973,13 +2005,12 @@ wrong_label: return T_ENCAPSED_AND_WHITESPACE; } -%{ /* "{"{2,}|"$"{2,} handles { before "{$" or literal $ before a variable or "${" * (("{"+|"$"+)["]) handles { or $ at the end of a string * * Same for backquotes and heredocs, except the second case doesn't apply to * heredocs. yyless(yyleng - 1) is used to correct taking one character too many - */ %} + */ {DOUBLE_QUOTES_CHARS}*("{"{2,}|"$"{2,}|(("{"+|"$"+)["])) { yyless(yyleng - 1); zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC); @@ -1999,14 +2030,13 @@ wrong_label: } -%{ /* ({HEREDOC_NEWLINE}+({LABEL}";"?)?)? handles the possible case of newline * sequences, possibly followed by a label, that couldn't be matched with * HEREDOC_CHARS because of a following variable or "{$" * * This doesn't affect real ending labels, as they are followed by a newline, * which will result in a longer match for the correct rule if present - */ %} + */ {HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({LABEL}";"?)?)? { zend_scan_escape_string(zendlval, yytext, yyleng, 0 TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; @@ -2019,6 +2049,47 @@ wrong_label: } +({NOWDOC_CHARS}+{NEWLINE}+|{NEWLINE}+){LABEL}";"?[\n\r] { + char *end = yytext + yyleng - 1; + + if (end[-1] == ';') { + end--; + yyleng--; + } + + if (yyleng > CG(heredoc_len) && !memcmp(end - CG(heredoc_len), CG(heredoc), CG(heredoc_len))) { + int len = yyleng - CG(heredoc_len) - 2; /* 2 for newline before and after label */ + + /* May have matched fooLABEL; make sure there's a newline before it */ + if (yytext[len] != '\n') { + if (yytext[len] != '\r') { + yyless(yyleng - 1); + yymore(); + } + } else if (len > 0 && yytext[len - 1] == '\r') { + len--; /* Windows newline */ + } + + /* Go back before label, to match in ST_END_HEREDOC state. yytext will include + * newline before label, for zend_highlight/strip, tokenizer, etc. */ + yyless(yyleng - CG(heredoc_len) - 1); /* 1 for newline after label */ + + CG(increment_lineno) = 1; /* For newline before label */ + BEGIN(ST_END_HEREDOC); + + zend_copy_value(zendlval, yytext, len); + zendlval->type = IS_STRING; + HANDLE_NEWLINES(yytext, len); + return T_ENCAPSED_AND_WHITESPACE; + } else { + /* Go back to end of label, so the next match works correctly in case of + * another label at the beginning of the next line */ + yyless(yyleng - 1); + yymore(); + } +} + + ["] { BEGIN(ST_IN_SCRIPTING); return '"'; @@ -2030,14 +2101,12 @@ wrong_label: return '`'; } - -<> { - zend_error(E_COMPILE_WARNING,"Unterminated comment starting line %d", CG(comment_start_line)); - return 0; -} - - +<*>{NULL} { return 0; } /* EOF */ {ANY_CHAR} { zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); + goto restart; +} + +*/ } diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h new file mode 100644 index 000000000..eaedca67c --- /dev/null +++ b/Zend/zend_language_scanner_defs.h @@ -0,0 +1,17 @@ +/* Generated by re2c 0.13.5 on Mon Mar 23 21:40:47 2009 */ + +enum YYCONDTYPE { + yycST_IN_SCRIPTING, + yycST_LOOKING_FOR_PROPERTY, + yycST_BACKQUOTE, + yycST_DOUBLE_QUOTES, + yycST_HEREDOC, + yycST_LOOKING_FOR_VARNAME, + yycST_VAR_OFFSET, + yycINITIAL, + yycST_ONE_LINE_COMMENT, + yycST_COMMENT, + yycST_DOC_COMMENT, + yycST_END_HEREDOC, + yycST_NOWDOC, +}; diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 48cca2c3f..ae3bbc97b 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_list.c,v 1.66.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_list.c,v 1.66.2.1.2.1.2.4 2008/12/31 11:15:32 sebastian Exp $ */ /* resource lists */ diff --git a/Zend/zend_list.h b/Zend/zend_list.h index cfe5abbc3..1bdcfed86 100644 --- a/Zend/zend_list.h +++ b/Zend/zend_list.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_list.h,v 1.48.2.1.2.5 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_list.h,v 1.48.2.1.2.1.2.4 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_LIST_H #define ZEND_LIST_H diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index 70e2b9a9b..80dbc0a0b 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_llist.c,v 1.35.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_llist.c,v 1.35.2.1.2.2.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" #include "zend_llist.h" diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h index 7291da55f..6b9cdd0ab 100644 --- a/Zend/zend_llist.h +++ b/Zend/zend_llist.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_llist.h,v 1.33.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_llist.h,v 1.33.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_LLIST_H #define ZEND_LLIST_H diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index a26a0f9e1..fc1a239f2 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -17,13 +17,14 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_modules.h,v 1.67.2.3.2.6 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_modules.h,v 1.67.2.3.2.4.2.8 2009/01/17 02:05:13 stas Exp $ */ #ifndef MODULES_H #define MODULES_H #include "zend.h" #include "zend_compile.h" +#include "zend_build.h" #define INIT_FUNC_ARGS int type, int module_number TSRMLS_DC #define INIT_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC @@ -32,14 +33,7 @@ #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC -extern struct _zend_arg_info first_arg_force_ref[2]; -extern struct _zend_arg_info second_arg_force_ref[3]; -extern struct _zend_arg_info third_arg_force_ref[4]; -extern struct _zend_arg_info fourth_arg_force_ref[5]; -extern struct _zend_arg_info fifth_arg_force_ref[6]; -extern struct _zend_arg_info all_args_by_ref[1]; - -#define ZEND_MODULE_API_NO 20060613 +#define ZEND_MODULE_API_NO 20090115 #ifdef ZTS #define USING_ZTS 1 #else @@ -52,7 +46,9 @@ extern struct _zend_arg_info all_args_by_ref[1]; #define ZE2_STANDARD_MODULE_HEADER \ STANDARD_MODULE_HEADER_EX, ini_entries, NULL -#define STANDARD_MODULE_PROPERTIES_EX 0, 0, NULL, 0 +#define ZEND_MODULE_BUILD_ID "API" ZEND_TOSTR(ZEND_MODULE_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA + +#define STANDARD_MODULE_PROPERTIES_EX 0, 0, NULL, 0, ZEND_MODULE_BUILD_ID #define NO_MODULE_GLOBALS 0, NULL, NULL, NULL @@ -79,16 +75,16 @@ struct _zend_module_entry { unsigned int zend_api; unsigned char zend_debug; unsigned char zts; - struct _zend_ini_entry *ini_entry; - struct _zend_module_dep *deps; - char *name; - struct _zend_function_entry *functions; + const struct _zend_ini_entry *ini_entry; + const struct _zend_module_dep *deps; + const char *name; + const struct _zend_function_entry *functions; int (*module_startup_func)(INIT_FUNC_ARGS); int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); int (*request_startup_func)(INIT_FUNC_ARGS); int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); - char *version; + const char *version; size_t globals_size; #ifdef ZTS ts_rsrc_id* globals_id_ptr; @@ -102,6 +98,7 @@ struct _zend_module_entry { unsigned char type; void *handle; int module_number; + char *build_id; }; #define MODULE_DEP_REQUIRED 1 @@ -117,10 +114,10 @@ struct _zend_module_entry { #define ZEND_MOD_OPTIONAL(name) ZEND_MOD_OPTIONAL_EX(name, NULL, NULL) struct _zend_module_dep { - char *name; /* module name */ - char *rel; /* version relationship: NULL (exists), lt|le|eq|ge|gt (to given version) */ - char *version; /* version */ - unsigned char type; /* dependency type */ + const char *name; /* module name */ + const char *rel; /* version relationship: NULL (exists), lt|le|eq|ge|gt (to given version) */ + const char *version; /* version */ + unsigned char type; /* dependency type */ }; extern ZEND_API HashTable module_registry; @@ -128,7 +125,7 @@ extern ZEND_API HashTable module_registry; void module_destructor(zend_module_entry *module); int module_registry_cleanup(zend_module_entry *module TSRMLS_DC); int module_registry_request_startup(zend_module_entry *module TSRMLS_DC); -int module_registry_unload_temp(zend_module_entry *module TSRMLS_DC); +int module_registry_unload_temp(const zend_module_entry *module TSRMLS_DC); #define ZEND_MODULE_DTOR (void (*)(void *)) module_destructor #endif diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index 90bcf8004..5159afa43 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_multibyte.c,v 1.4.2.4.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_multibyte.c,v 1.4.2.4.2.1.2.7 2009/03/18 17:44:25 moriyoshi Exp $ */ #include "zend.h" #include "zend_compile.h" @@ -25,20 +25,21 @@ #include "zend_multibyte.h" #ifdef ZEND_MULTIBYTE -static int zend_multibyte_encoding_filter(char **to, int *to_length, const char *to_encoding, const char *from, int from_length, const char *from_encoding TSRMLS_DC); -int sjis_input_filter(char **buf, int *length, const char *sjis, int sjis_length TSRMLS_DC); -int sjis_output_filter(char **buf, int *length, const char *sjis, int sjis_length TSRMLS_DC); -static char* zend_multibyte_assemble_encoding_list(zend_encoding **encoding_list, int encoding_list_size); -static int zend_multibyte_parse_encoding_list(const char *encoding_list, int encoding_list_size, zend_encoding ***result, int *result_size); -static zend_encoding* zend_multibyte_find_script_encoding(zend_encoding *onetime_encoding TSRMLS_DC); -static zend_encoding* zend_multibyte_detect_unicode(TSRMLS_D); -static zend_encoding* zend_multibyte_detect_utf_encoding(char *script, int script_size TSRMLS_DC); +static size_t zend_multibyte_encoding_filter(unsigned char **to, size_t *to_length, const char *to_encoding, const unsigned char *from, size_t from_length, const char *from_encoding TSRMLS_DC); +size_t sjis_input_filter(unsigned char **buf, size_t *length, const unsigned char *sjis, size_t sjis_length TSRMLS_DC); +size_t sjis_output_filter(unsigned char **buf, size_t *length, const unsigned char *sjis, size_t sjis_length TSRMLS_DC); +static char* zend_multibyte_assemble_encoding_list(zend_encoding **encoding_list, size_t encoding_list_size); +static int zend_multibyte_parse_encoding_list(const char *encoding_list, +size_t encoding_list_size, zend_encoding ***result, size_t *result_size); +static zend_encoding *zend_multibyte_find_script_encoding(zend_encoding *onetime_encoding TSRMLS_DC); +static zend_encoding *zend_multibyte_detect_unicode(TSRMLS_D); +static zend_encoding *zend_multibyte_detect_utf_encoding(const unsigned char *script, size_t script_size TSRMLS_DC); /* * encodings */ -const char *ucs2_aliases[] = {"ISO-10646-UCS-2", "UCS2" , "UNICODE", NULL}; -zend_encoding encoding_ucs2 = { +static const char *ucs2_aliases[] = {"ISO-10646-UCS-2", "UCS2" , "UNICODE", NULL}; +static zend_encoding encoding_ucs2 = { NULL, NULL, "UCS-2", @@ -46,7 +47,7 @@ zend_encoding encoding_ucs2 = { 0 }; -zend_encoding encoding_ucs2be = { +static zend_encoding encoding_ucs2be = { NULL, NULL, "UCS-2BE", @@ -54,7 +55,7 @@ zend_encoding encoding_ucs2be = { 0 }; -zend_encoding encoding_ucs2le = { +static zend_encoding encoding_ucs2le = { NULL, NULL, "UCS-2LE", @@ -62,8 +63,8 @@ zend_encoding encoding_ucs2le = { 0 }; -const char *ucs4_aliases[] = {"ISO-10646-UCS-4", "UCS4", NULL}; -zend_encoding encoding_ucs4 = { +static const char *ucs4_aliases[] = {"ISO-10646-UCS-4", "UCS4", NULL}; +static zend_encoding encoding_ucs4 = { NULL, NULL, "UCS-4", @@ -71,7 +72,7 @@ zend_encoding encoding_ucs4 = { 0 }; -zend_encoding encoding_ucs4be = { +static zend_encoding encoding_ucs4be = { NULL, NULL, "UCS-4BE", @@ -79,7 +80,7 @@ zend_encoding encoding_ucs4be = { 0 }; -zend_encoding encoding_ucs4le = { +static zend_encoding encoding_ucs4le = { NULL, NULL, "UCS-4LE", @@ -87,8 +88,8 @@ zend_encoding encoding_ucs4le = { 0 }; -const char *utf32_aliases[] = {"utf32", NULL}; -zend_encoding encoding_utf32 = { +static const char *utf32_aliases[] = {"utf32", NULL}; +static zend_encoding encoding_utf32 = { NULL, NULL, "UTF-32", @@ -96,7 +97,7 @@ zend_encoding encoding_utf32 = { 0 }; -zend_encoding encoding_utf32be = { +static zend_encoding encoding_utf32be = { NULL, NULL, "UTF-32BE", @@ -104,7 +105,7 @@ zend_encoding encoding_utf32be = { 0 }; -zend_encoding encoding_utf32le = { +static zend_encoding encoding_utf32le = { NULL, NULL, "UTF-32LE", @@ -112,8 +113,8 @@ zend_encoding encoding_utf32le = { 0 }; -const char *utf16_aliases[] = {"utf16", NULL}; -zend_encoding encoding_utf16 = { +static const char *utf16_aliases[] = {"utf16", NULL}; +static zend_encoding encoding_utf16 = { NULL, NULL, "UTF-16", @@ -121,7 +122,7 @@ zend_encoding encoding_utf16 = { 0 }; -zend_encoding encoding_utf16be = { +static zend_encoding encoding_utf16be = { NULL, NULL, "UTF-16BE", @@ -129,7 +130,7 @@ zend_encoding encoding_utf16be = { 0 }; -zend_encoding encoding_utf16le = { +static zend_encoding encoding_utf16le = { NULL, NULL, "UTF-16LE", @@ -137,8 +138,8 @@ zend_encoding encoding_utf16le = { 0 }; -const char *utf8_aliases[] = {"utf8", NULL}; -zend_encoding encoding_utf8 = { +static const char *utf8_aliases[] = {"utf8", NULL}; +static zend_encoding encoding_utf8 = { NULL, NULL, "UTF-8", @@ -146,8 +147,8 @@ zend_encoding encoding_utf8 = { 1 }; -const char *ascii_aliases[] = {"ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "US-ASCII", "ISO646-US", "us", "IBM367", "cp367", "csASCII", NULL}; -zend_encoding encoding_ascii = { +static const char *ascii_aliases[] = {"ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "US-ASCII", "ISO646-US", "us", "IBM367", "cp367", "csASCII", NULL}; +static zend_encoding encoding_ascii = { NULL, NULL, "ASCII", @@ -155,8 +156,8 @@ zend_encoding encoding_ascii = { 1 }; -const char *euc_jp_aliases[] = {"EUC", "EUC_JP", "eucJP", "x-euc-jp", NULL}; -zend_encoding encoding_euc_jp = { +static const char *euc_jp_aliases[] = {"EUC", "EUC_JP", "eucJP", "x-euc-jp", NULL}; +static zend_encoding encoding_euc_jp = { NULL, NULL, "EUC-JP", @@ -164,8 +165,8 @@ zend_encoding encoding_euc_jp = { 1 }; -const char *sjis_aliases[] = {"x-sjis", "SJIS", "SHIFT-JIS", NULL}; -zend_encoding encoding_sjis = { +static const char *sjis_aliases[] = {"x-sjis", "SJIS", "SHIFT-JIS", NULL}; +static zend_encoding encoding_sjis = { sjis_input_filter, sjis_output_filter, "Shift_JIS", @@ -173,8 +174,8 @@ zend_encoding encoding_sjis = { 0 }; -const char *eucjp_win_aliases[] = {"eucJP-open", NULL}; -zend_encoding encoding_eucjp_win = { +static const char *eucjp_win_aliases[] = {"eucJP-open", NULL}; +static zend_encoding encoding_eucjp_win = { NULL, NULL, "eucJP-win", @@ -182,8 +183,8 @@ zend_encoding encoding_eucjp_win = { 1 }; -const char *sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", "CP932", NULL}; -zend_encoding encoding_sjis_win = { +static const char *sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", "CP932", NULL}; +static zend_encoding encoding_sjis_win = { /* sjis-filters does not care about diffs of Shift_JIS and CP932 */ sjis_input_filter, sjis_output_filter, @@ -192,8 +193,8 @@ zend_encoding encoding_sjis_win = { 0 }; -const char *jis_aliases[] = {"ISO-2022-JP", NULL}; -zend_encoding encoding_jis = { +static const char *jis_aliases[] = {"ISO-2022-JP", NULL}; +static zend_encoding encoding_jis = { NULL, NULL, "JIS", @@ -201,8 +202,8 @@ zend_encoding encoding_jis = { 0 }; -const char *euc_cn_aliases[] = {"CN-GB", "EUC_CN", "eucCN", "x-euc-cn", "gb2312", NULL}; -zend_encoding encoding_euc_cn = { +static const char *euc_cn_aliases[] = {"CN-GB", "EUC_CN", "eucCN", "x-euc-cn", "gb2312", NULL}; +static zend_encoding encoding_euc_cn = { NULL, NULL, "EUC-CN", @@ -210,8 +211,8 @@ zend_encoding encoding_euc_cn = { 1 }; -const char *cp936_aliases[] = {"CP-936", NULL}; -zend_encoding encoding_cp936 = { +static const char *cp936_aliases[] = {"CP-936", NULL}; +static zend_encoding encoding_cp936 = { NULL, NULL, "CP936", @@ -219,8 +220,8 @@ zend_encoding encoding_cp936 = { 0 }; -const char *hz_aliases[] = {"HZ-GB-2312", NULL}; -zend_encoding encoding_hz = { +static const char *hz_aliases[] = {"HZ-GB-2312", NULL}; +static zend_encoding encoding_hz = { NULL, NULL, "HZ", @@ -228,8 +229,8 @@ zend_encoding encoding_hz = { 0 }; -const char *euc_tw_aliases[] = {"EUC_TW", "eucTW", "x-euc-tw", NULL}; -zend_encoding encoding_euc_tw = { +static const char *euc_tw_aliases[] = {"EUC_TW", "eucTW", "x-euc-tw", NULL}; +static zend_encoding encoding_euc_tw = { NULL, NULL, "EUC-TW", @@ -237,8 +238,8 @@ zend_encoding encoding_euc_tw = { 1 }; -const char *big5_aliases[] = {"BIG5", "CN-BIG5", "BIG-FIVE", "BIGFIVE", "CP950", NULL}; -zend_encoding encoding_big5 = { +static const char *big5_aliases[] = {"BIG5", "CN-BIG5", "BIG-FIVE", "BIGFIVE", "CP950", NULL}; +static zend_encoding encoding_big5 = { NULL, NULL, "BIG-5", @@ -246,8 +247,8 @@ zend_encoding encoding_big5 = { 0 }; -const char *euc_kr_aliases[] = {"EUC_KR", "eucKR", "x-euc-kr", NULL}; -zend_encoding encoding_euc_kr = { +static const char *euc_kr_aliases[] = {"EUC_KR", "eucKR", "x-euc-kr", NULL}; +static zend_encoding encoding_euc_kr = { NULL, NULL, "EUC-KR", @@ -255,8 +256,8 @@ zend_encoding encoding_euc_kr = { 1 }; -const char *uhc_aliases[] = {"CP949", NULL}; -zend_encoding encoding_uhc = { +static const char *uhc_aliases[] = {"CP949", NULL}; +static zend_encoding encoding_uhc = { NULL, NULL, "UHC", @@ -264,7 +265,7 @@ zend_encoding encoding_uhc = { 1 }; -zend_encoding encoding_2022kr = { +static zend_encoding encoding_2022kr = { NULL, NULL, "ISO-2022-KR", @@ -272,8 +273,8 @@ zend_encoding encoding_2022kr = { 0 }; -const char *cp1252_aliases[] = {"cp1252", NULL}; -zend_encoding encoding_cp1252 = { +static const char *cp1252_aliases[] = {"cp1252", NULL}; +static zend_encoding encoding_cp1252 = { NULL, NULL, "Windows-1252", @@ -281,8 +282,8 @@ zend_encoding encoding_cp1252 = { 1 }; -const char *iso_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL}; -zend_encoding encoding_8859_1 = { +static const char *iso_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL}; +static zend_encoding encoding_8859_1 = { NULL, NULL, "ISO-8859-1", @@ -290,8 +291,8 @@ zend_encoding encoding_8859_1 = { 1 }; -const char *iso_8859_2_aliases[] = {"ISO_8859-2", "latin2", NULL}; -zend_encoding encoding_8859_2 = { +static const char *iso_8859_2_aliases[] = {"ISO_8859-2", "latin2", NULL}; +static zend_encoding encoding_8859_2 = { NULL, NULL, "ISO-8859-2", @@ -299,8 +300,8 @@ zend_encoding encoding_8859_2 = { 1 }; -const char *iso_8859_3_aliases[] = {"ISO_8859-3", "latin3", NULL}; -zend_encoding encoding_8859_3 = { +static const char *iso_8859_3_aliases[] = {"ISO_8859-3", "latin3", NULL}; +static zend_encoding encoding_8859_3 = { NULL, NULL, "ISO-8859-3", @@ -308,8 +309,8 @@ zend_encoding encoding_8859_3 = { 1 }; -const char *iso_8859_4_aliases[] = {"ISO_8859-4", "latin4", NULL}; -zend_encoding encoding_8859_4 = { +static const char *iso_8859_4_aliases[] = {"ISO_8859-4", "latin4", NULL}; +static zend_encoding encoding_8859_4 = { NULL, NULL, "ISO-8859-4", @@ -317,8 +318,8 @@ zend_encoding encoding_8859_4 = { 1 }; -const char *iso_8859_5_aliases[] = {"ISO_8859-5", "cyrillic", NULL}; -zend_encoding encoding_8859_5 = { +static const char *iso_8859_5_aliases[] = {"ISO_8859-5", "cyrillic", NULL}; +static zend_encoding encoding_8859_5 = { NULL, NULL, "ISO-8859-5", @@ -326,8 +327,8 @@ zend_encoding encoding_8859_5 = { 1 }; -const char *iso_8859_6_aliases[] = {"ISO_8859-6", "arabic", NULL}; -zend_encoding encoding_8859_6 = { +static const char *iso_8859_6_aliases[] = {"ISO_8859-6", "arabic", NULL}; +static zend_encoding encoding_8859_6 = { NULL, NULL, "ISO-8859-6", @@ -335,8 +336,8 @@ zend_encoding encoding_8859_6 = { 1 }; -const char *iso_8859_7_aliases[] = {"ISO_8859-7", "greek", NULL}; -zend_encoding encoding_8859_7 = { +static const char *iso_8859_7_aliases[] = {"ISO_8859-7", "greek", NULL}; +static zend_encoding encoding_8859_7 = { NULL, NULL, "ISO-8859-7", @@ -344,8 +345,8 @@ zend_encoding encoding_8859_7 = { 1 }; -const char *iso_8859_8_aliases[] = {"ISO_8859-8", "hebrew", NULL}; -zend_encoding encoding_8859_8 = { +static const char *iso_8859_8_aliases[] = {"ISO_8859-8", "hebrew", NULL}; +static zend_encoding encoding_8859_8 = { NULL, NULL, "ISO-8859-8", @@ -353,8 +354,8 @@ zend_encoding encoding_8859_8 = { 1 }; -const char *iso_8859_9_aliases[] = {"ISO_8859-9", "latin5", NULL}; -zend_encoding encoding_8859_9 = { +static const char *iso_8859_9_aliases[] = {"ISO_8859-9", "latin5", NULL}; +static zend_encoding encoding_8859_9 = { NULL, NULL, "ISO-8859-9", @@ -362,8 +363,8 @@ zend_encoding encoding_8859_9 = { 1 }; -const char *iso_8859_10_aliases[] = {"ISO_8859-10", "latin6", NULL}; -zend_encoding encoding_8859_10 = { +static const char *iso_8859_10_aliases[] = {"ISO_8859-10", "latin6", NULL}; +static zend_encoding encoding_8859_10 = { NULL, NULL, "ISO-8859-10", @@ -371,8 +372,8 @@ zend_encoding encoding_8859_10 = { 1 }; -const char *iso_8859_13_aliases[] = {"ISO_8859-13", NULL}; -zend_encoding encoding_8859_13 = { +static const char *iso_8859_13_aliases[] = {"ISO_8859-13", NULL}; +static zend_encoding encoding_8859_13 = { NULL, NULL, "ISO-8859-13", @@ -380,8 +381,8 @@ zend_encoding encoding_8859_13 = { 1 }; -const char *iso_8859_14_aliases[] = {"ISO_8859-14", "latin8", NULL}; -zend_encoding encoding_8859_14 = { +static const char *iso_8859_14_aliases[] = {"ISO_8859-14", "latin8", NULL}; +static zend_encoding encoding_8859_14 = { NULL, NULL, "ISO-8859-14", @@ -389,8 +390,8 @@ zend_encoding encoding_8859_14 = { 1 }; -const char *iso_8859_15_aliases[] = {"ISO_8859-15", NULL}; -zend_encoding encoding_8859_15 = { +static const char *iso_8859_15_aliases[] = {"ISO_8859-15", NULL}; +static zend_encoding encoding_8859_15 = { NULL, NULL, "ISO-8859-15", @@ -398,8 +399,8 @@ zend_encoding encoding_8859_15 = { 1 }; -const char *cp1251_aliases[] = {"CP1251", "CP-1251", "WINDOWS-1251", NULL}; -zend_encoding encoding_cp1251 = { +static const char *cp1251_aliases[] = {"CP1251", "CP-1251", "WINDOWS-1251", NULL}; +static zend_encoding encoding_cp1251 = { NULL, NULL, "Windows-1251", @@ -407,8 +408,8 @@ zend_encoding encoding_cp1251 = { 1 }; -const char *cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL}; -zend_encoding encoding_cp866 = { +static const char *cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL}; +static zend_encoding encoding_cp866 = { NULL, NULL, "CP866", @@ -416,8 +417,8 @@ zend_encoding encoding_cp866 = { 1 }; -const char *koi8r_aliases[] = {"KOI8-R", "KOI8R", NULL}; -zend_encoding encoding_koi8r = { +static const char *koi8r_aliases[] = {"KOI8-R", "KOI8R", NULL}; +static zend_encoding encoding_koi8r = { NULL, NULL, "KOI8-R", @@ -425,7 +426,43 @@ zend_encoding encoding_koi8r = { 1 }; -zend_encoding *zend_encoding_table[] = { +static const char *koi8u_aliases[] = {"KOI8-U", "KOI8U", NULL}; +static zend_encoding encoding_koi8u = { + NULL, + NULL, + "KOI8-U", + (const char *(*)[])&koi8u_aliases, + 1 +}; + +static const char *cp1254_aliases[] = {"cp1254", NULL}; +static zend_encoding encoding_cp1254 = { + NULL, + NULL, + "Windows-1254", + (const char *(*)[])&cp1254_aliases, + 1 +}; + +static const char *armscii8_aliases[] = { "ArmSCII8", "ARMSCII-8", "ARMSCII8", NULL}; +static zend_encoding encoding_armscii8 = { + NULL, + NULL, + "ArmSCII-8", + (const char *(*)[])&armscii8_aliases, + 1 +}; + +static const char *cp850_aliases[] = {"IBM850", NULL}; +static zend_encoding encoding_cp850 = { + NULL, + NULL, + "CP850", + (const char *(*)[])&cp850_aliases, + 1 +}; + +static zend_encoding *zend_encoding_table[] = { &encoding_ucs4, &encoding_ucs4be, &encoding_ucs4le, @@ -470,12 +507,17 @@ zend_encoding *zend_encoding_table[] = { &encoding_cp1251, &encoding_cp866, &encoding_koi8r, + &encoding_koi8u, + &encoding_armscii8, + &encoding_cp1254, + &encoding_cp850, NULL }; -ZEND_API int zend_multibyte_set_script_encoding(char *encoding_list, int encoding_list_size TSRMLS_DC) +ZEND_API int zend_multibyte_set_script_encoding(const char *encoding_list, +size_t encoding_list_size TSRMLS_DC) { if (CG(script_encoding_list)) { efree(CG(script_encoding_list)); @@ -493,7 +535,7 @@ ZEND_API int zend_multibyte_set_script_encoding(char *encoding_list, int encodin } -ZEND_API int zend_multibyte_set_internal_encoding(char *encoding_name, int encoding_name_size TSRMLS_DC) +ZEND_API int zend_multibyte_set_internal_encoding(const char *encoding_name TSRMLS_DC) { CG(internal_encoding) = zend_multibyte_fetch_encoding(encoding_name); return 0; @@ -558,7 +600,7 @@ ZEND_API int zend_multibyte_set_filter(zend_encoding *onetime_encoding TSRMLS_DC } -ZEND_API zend_encoding* zend_multibyte_fetch_encoding(char *encoding_name) +ZEND_API zend_encoding* zend_multibyte_fetch_encoding(const char *encoding_name) { int i, j; zend_encoding *encoding; @@ -568,7 +610,7 @@ ZEND_API zend_encoding* zend_multibyte_fetch_encoding(char *encoding_name) } for (i = 0; (encoding = zend_encoding_table[i]) != NULL; i++) { - if (zend_binary_strcasecmp((char*)encoding->name, strlen(encoding->name), encoding_name, strlen(encoding_name)) == 0) { + if (zend_binary_strcasecmp(encoding->name, strlen(encoding->name), encoding_name, strlen(encoding_name)) == 0) { return encoding; } } @@ -576,7 +618,7 @@ ZEND_API zend_encoding* zend_multibyte_fetch_encoding(char *encoding_name) for (i = 0; (encoding = zend_encoding_table[i]) != NULL; i++) { if (encoding->aliases != NULL) { for (j = 0; (*encoding->aliases)[j] != NULL; j++) { - if (zend_binary_strcasecmp((char*)(*encoding->aliases)[j], strlen((*encoding->aliases)[j]), encoding_name, strlen(encoding_name)) == 0) { + if (zend_binary_strcasecmp((*encoding->aliases)[j], strlen((*encoding->aliases)[j]), encoding_name, strlen(encoding_name)) == 0) { return encoding; } } @@ -587,7 +629,8 @@ ZEND_API zend_encoding* zend_multibyte_fetch_encoding(char *encoding_name) } -ZEND_API int zend_multibyte_script_encoding_filter(char **to, int *to_length, const char *from, int from_length TSRMLS_DC) +ZEND_API size_t zend_multibyte_script_encoding_filter(unsigned char **to, size_t +*to_length, const unsigned char *from, size_t from_length TSRMLS_DC) { const char *name; @@ -600,7 +643,7 @@ ZEND_API int zend_multibyte_script_encoding_filter(char **to, int *to_length, co return zend_multibyte_encoding_filter(to, to_length, name, from, from_length, LANG_SCNG(script_encoding)->name TSRMLS_CC); } -ZEND_API int zend_multibyte_internal_encoding_filter(char **to, int *to_length, const char *from, int from_length TSRMLS_DC) +ZEND_API size_t zend_multibyte_internal_encoding_filter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC) { const char *name; @@ -613,9 +656,9 @@ ZEND_API int zend_multibyte_internal_encoding_filter(char **to, int *to_length, return zend_multibyte_encoding_filter(to, to_length, LANG_SCNG(internal_encoding)->name, from, from_length, name TSRMLS_CC); } -static int zend_multibyte_encoding_filter(char **to, int *to_length, const char *to_encoding, const char *from, int from_length, const char *from_encoding TSRMLS_DC) +static size_t zend_multibyte_encoding_filter(unsigned char **to, size_t *to_length, const char *to_encoding, const unsigned char *from, size_t from_length, const char *from_encoding TSRMLS_DC) { - int oddlen; + size_t oddlen; if (!CG(encoding_converter)) { return 0; @@ -658,21 +701,22 @@ static const unsigned char table_sjis[] = { /* 0x80-0x9f,0xE0-0xEF */ 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 0, 0, 0 }; -int sjis_input_filter(char **buf, int *length, const char *sjis, int sjis_length TSRMLS_DC) +size_t sjis_input_filter(unsigned char **buf, size_t *length, const unsigned char *sjis, size_t sjis_length TSRMLS_DC) { - unsigned char *p, *q; + const unsigned char *p; + unsigned char *q; unsigned char c1, c2; - *buf = (char*)emalloc(sjis_length*3/2+1); + *buf = (unsigned char*)emalloc(sjis_length * 3 / 2 + 1); if (!*buf) return 0; *length = 0; - p = (unsigned char*)sjis; - q = (unsigned char*)*buf; + p = sjis; + q = *buf; /* convert [SJIS -> EUC-JP] (for lex scan) -- some other better ways? */ - while (*p && (p-(unsigned char*)sjis) < sjis_length) { + while (*p && (p - sjis) < sjis_length) { if (!(*p & 0x80)) { *q++ = *p++; continue; @@ -694,7 +738,7 @@ int sjis_input_filter(char **buf, int *length, const char *sjis, int sjis_length if (table_sjis[*p] == 2) { /* 2 byte kanji code */ c1 = *p++; - if (!*p || (p-(unsigned char*)sjis) >= sjis_length) { + if (!*p || (p - sjis) >= sjis_length) { break; } c2 = *p++; @@ -725,11 +769,11 @@ int sjis_input_filter(char **buf, int *length, const char *sjis, int sjis_length * so, these code are for perfect RESTORING in sjis_output_filter() */ c1 = *p++; - if (!*p || (p-(unsigned char*)sjis) >= sjis_length) { + if (!*p || (p - sjis) >= sjis_length) { break; } c2 = *p++; - *q++ = (char)0x8f; + *q++ = 0x8f; /* * MAP TO (EUC-JP): * type A: 0xeba1 - 0xf4fe @@ -754,8 +798,8 @@ int sjis_input_filter(char **buf, int *length, const char *sjis, int sjis_length *q++ = c2; } } - *q = (char)NULL; - *length = (char*)q - *buf; + *q = '\0'; + *length = q - *buf; return *length; } @@ -779,18 +823,18 @@ static const unsigned char table_eucjp[] = { /* 0xA1-0xFE */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; -int sjis_output_filter(char **sjis, int *sjis_length, const char *buf, int length TSRMLS_DC) +size_t sjis_output_filter(unsigned char **sjis, size_t *sjis_length, const unsigned char *buf, size_t length TSRMLS_DC) { unsigned char c1, c2; - char *p; - const char *q; + unsigned char *p; + const unsigned char *q; if (!sjis || !sjis_length) { return 0; } /* always Shift_JIS <= EUC-JP */ - *sjis = (char*)emalloc(length+1); + *sjis = (unsigned char*)emalloc(length+1); if (!sjis) { return 0; } @@ -798,14 +842,14 @@ int sjis_output_filter(char **sjis, int *sjis_length, const char *buf, int lengt q = buf; /* restore converted strings [EUC-JP -> Shift_JIS] */ - while (*q) { + while (*q && (q - buf) < length) { if (!(*q & 0x80)) { *p++ = *q++; continue; } /* hankaku kana */ - if (*q == (char)0x8e) { + if (*q == 0x8e) { q++; if (*q) { *p++ = *q++; @@ -814,7 +858,7 @@ int sjis_output_filter(char **sjis, int *sjis_length, const char *buf, int lengt } /* 2 byte kanji code */ - if (table_eucjp[(unsigned char)*q] == 2) { + if (table_eucjp[*q] == 2) { c1 = (*q++ & ~0x80) & 0xff; if (*q) { c2 = (*q++ & ~0x80) & 0xff; @@ -837,7 +881,7 @@ int sjis_output_filter(char **sjis, int *sjis_length, const char *buf, int lengt continue; } - if (*q == (char)0x8f) { + if (*q == 0x8f) { q++; if (*q) { c1 = (*q++ & ~0x80) & 0xff; @@ -882,7 +926,7 @@ int sjis_output_filter(char **sjis, int *sjis_length, const char *buf, int lengt } -static char* zend_multibyte_assemble_encoding_list(zend_encoding **encoding_list, int encoding_list_size) +static char *zend_multibyte_assemble_encoding_list(zend_encoding **encoding_list, size_t encoding_list_size) { int i, list_size = 0; const char *name; @@ -901,7 +945,7 @@ static char* zend_multibyte_assemble_encoding_list(zend_encoding **encoding_list if (!list) { return NULL; } - *list = (char)NULL; + *list = '\0'; } else { list = (char*)erealloc(list, list_size); if (!list) { @@ -916,7 +960,8 @@ static char* zend_multibyte_assemble_encoding_list(zend_encoding **encoding_list } -static int zend_multibyte_parse_encoding_list(const char *encoding_list, int encoding_list_size, zend_encoding ***result, int *result_size) +static int zend_multibyte_parse_encoding_list(const char *encoding_list, +size_t encoding_list_size, zend_encoding ***result, size_t *result_size) { int n, size; char *p, *p1, *p2, *endp, *tmpstr; @@ -1034,7 +1079,7 @@ static zend_encoding* zend_multibyte_detect_unicode(TSRMLS_D) { zend_encoding *script_encoding = NULL; int bom_size; - char *script; + unsigned char *script; if (LANG_SCNG(script_org_size) < sizeof(BOM_UTF32_LE)-1) { return NULL; @@ -1060,7 +1105,7 @@ static zend_encoding* zend_multibyte_detect_unicode(TSRMLS_D) if (script_encoding) { /* remove BOM */ - script = (char*)emalloc(LANG_SCNG(script_org_size)+1-bom_size); + script = (unsigned char*)emalloc(LANG_SCNG(script_org_size)+1-bom_size); memcpy(script, LANG_SCNG(script_org)+bom_size, LANG_SCNG(script_org_size)+1-bom_size); efree(LANG_SCNG(script_org)); LANG_SCNG(script_org) = script; @@ -1078,9 +1123,9 @@ static zend_encoding* zend_multibyte_detect_unicode(TSRMLS_D) return NULL; } -static zend_encoding* zend_multibyte_detect_utf_encoding(char *script, int script_size TSRMLS_DC) +static zend_encoding *zend_multibyte_detect_utf_encoding(const unsigned char *script, size_t script_size TSRMLS_DC) { - char *p; + const unsigned char *p; int wchar_size = 2; int le = 0; @@ -1091,7 +1136,7 @@ static zend_encoding* zend_multibyte_detect_utf_encoding(char *script, int scrip if (!p) { break; } - if (*(p+1) == (char)NULL && *(p+2) == (char)NULL) { + if (*(p+1) == '\0' && *(p+2) == '\0') { wchar_size = 4; break; } @@ -1103,11 +1148,11 @@ static zend_encoding* zend_multibyte_detect_utf_encoding(char *script, int scrip /* BE or LE? */ p = script; while ((p-script) < script_size) { - if (*p == (char)NULL && *(p+wchar_size-1) != (char)NULL) { + if (*p == '\0' && *(p+wchar_size-1) != '\0') { /* BE */ le = 0; break; - } else if (*p != (char)NULL && *(p+wchar_size-1) == (char)NULL) { + } else if (*p != '\0' && *(p+wchar_size-1) == '\0') { /* LE* */ le = 1; break; diff --git a/Zend/zend_multibyte.h b/Zend/zend_multibyte.h index 0ffc1b620..454e35d2e 100644 --- a/Zend/zend_multibyte.h +++ b/Zend/zend_multibyte.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_multibyte.h,v 1.3.2.3.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_multibyte.h,v 1.3.2.3.2.1.2.4 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_MULTIBYTE_H #define ZEND_MULTIBYTE_H @@ -30,20 +30,20 @@ #define BOM_UTF16_LE "\xff\xfe" #define BOM_UTF8 "\xef\xbb\xbf" -typedef int (*zend_encoding_filter)(char **str, int *str_length, const char *buf, int length TSRMLS_DC); +typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, const unsigned char *buf, size_t length TSRMLS_DC); -typedef char* (*zend_encoding_detector)(const char *string, int length, char *list TSRMLS_DC); +typedef char* (*zend_encoding_detector)(const unsigned char *string, size_t length, char *list TSRMLS_DC); -typedef int (*zend_encoding_converter)(char **to, int *to_length, const char *from, int from_length, const char *encoding_to, const char *encoding_from TSRMLS_DC); +typedef int (*zend_encoding_converter)(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const char *encoding_to, const char *encoding_from TSRMLS_DC); -typedef int (*zend_encoding_oddlen)(const char *string, int length, const char *encoding TSRMLS_DC); +typedef size_t (*zend_encoding_oddlen)(const unsigned char *string, size_t length, const char *encoding TSRMLS_DC); typedef struct _zend_encoding { zend_encoding_filter input_filter; /* escape input filter */ zend_encoding_filter output_filter; /* escape output filter */ const char *name; /* encoding name */ const char *(*aliases)[]; /* encoding name aliases */ - int compatible; /* flex compatible or not */ + zend_bool compatible; /* flex compatible or not */ } zend_encoding; @@ -51,18 +51,20 @@ typedef struct _zend_encoding { * zend multibyte APIs */ BEGIN_EXTERN_C() -ZEND_API int zend_multibyte_set_script_encoding(char *encoding_list, int encoding_list_size TSRMLS_DC); -ZEND_API int zend_multibyte_set_internal_encoding(char *encoding_name, int encoding_name_size TSRMLS_DC); +ZEND_API int zend_multibyte_set_script_encoding(const char *encoding_list, +size_t encoding_list_size TSRMLS_DC); +ZEND_API int zend_multibyte_set_internal_encoding(const char *encoding_name TSRMLS_DC); ZEND_API int zend_multibyte_set_functions(zend_encoding_detector encoding_detector, zend_encoding_converter encoding_converter, zend_encoding_oddlen encoding_oddlen TSRMLS_DC); ZEND_API int zend_multibyte_set_filter(zend_encoding *onetime_encoding TSRMLS_DC); -ZEND_API zend_encoding* zend_multibyte_fetch_encoding(char *encoding_name); -ZEND_API int zend_multibyte_script_encoding_filter(char **to, int *to_length, const char *from, int from_length TSRMLS_DC); -ZEND_API int zend_multibyte_internal_encoding_filter(char **to, int *to_length, const char *from, int from_length TSRMLS_DC); +ZEND_API zend_encoding* zend_multibyte_fetch_encoding(const char *encoding_name); +ZEND_API size_t zend_multibyte_script_encoding_filter(unsigned char **to, size_t +*to_length, const unsigned char *from, size_t from_length TSRMLS_DC); +ZEND_API size_t zend_multibyte_internal_encoding_filter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC); /* in zend_language_scanner.l */ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, zend_encoding *old_encoding TSRMLS_DC); ZEND_API int zend_multibyte_yyinput(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC); -ZEND_API int zend_multibyte_read_script(TSRMLS_D); +ZEND_API int zend_multibyte_read_script(unsigned char *buf, size_t n TSRMLS_DC); END_EXTERN_C() #endif /* ZEND_MULTIBYTE */ diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h index b84480b57..ad4adc88d 100644 --- a/Zend/zend_multiply.h +++ b/Zend/zend_multiply.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_multiply.h,v 1.10.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_multiply.h,v 1.10.2.1.2.2.2.3 2008/12/31 11:15:32 sebastian Exp $ */ #if defined(__i386__) && defined(__GNUC__) @@ -31,6 +31,19 @@ else (lval) = __tmpvar; \ } while (0) +#elif SIZEOF_LONG == 4 && defined(HAVE_ZEND_LONG64) + +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ + zend_long64 __result = (zend_long64) (a) * (zend_long64) (b); \ + if (__result > LONG_MAX || __result < LONG_MIN) { \ + (dval) = (double) __result; \ + (usedval) = 1; \ + } else { \ + (lval) = (long) __result; \ + (usedval) = 0; \ + } \ +} while (0) + #else #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index b09668b0d..9c1224e66 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.135.2.6.2.32 2009/02/17 17:09:05 iliaa Exp $ */ +/* $Id: zend_object_handlers.c,v 1.135.2.6.2.22.2.26 2009/01/14 10:28:22 dmitry Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -27,6 +27,7 @@ #include "zend_objects_API.h" #include "zend_object_handlers.h" #include "zend_interfaces.h" +#include "zend_closures.h" #define DEBUG_OBJECT_HANDLERS 0 @@ -42,21 +43,29 @@ set, we call __set handler. If it fails, we do not change the array. for both handlers above, when we are inside __get/__set, no further calls for - __get/__set for this property of this object will be made, to prevent endless + __get/__set for this property of this object will be made, to prevent endless recursion and enable accessors to change properties array. if we have __call and method which is not part of the class function table is called, we cal __call handler. */ -static HashTable *zend_std_get_properties(zval *object TSRMLS_DC) +ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC) /* {{{ */ { zend_object *zobj; zobj = Z_OBJ_P(object); return zobj->properties; } +/* }}} */ + +ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */ +{ + *is_temp = 0; + return zend_std_get_properties(object TSRMLS_CC); +} +/* }}} */ -static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) +static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zval *retval = NULL; zend_class_entry *ce = Z_OBJCE_P(object); @@ -74,20 +83,21 @@ static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) zval_ptr_dtor(&member); if (retval) { - retval->refcount--; + Z_DELREF_P(retval); } return retval; } +/* }}} */ -static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC) +static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */ { zval *retval = NULL; int result; zend_class_entry *ce = Z_OBJCE_P(object); SEPARATE_ARG_IF_REF(member); - value->refcount++; + Z_ADDREF_P(value); /* __set handler is called with two arguments: property name @@ -108,8 +118,9 @@ static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_D return FAILURE; } } +/* }}} */ -static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) +static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); @@ -123,8 +134,9 @@ static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) zval_ptr_dtor(&member); } +/* }}} */ -static zval *zend_std_call_issetter(zval *object, zval *member TSRMLS_DC) +static zval *zend_std_call_issetter(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zval *retval = NULL; zend_class_entry *ce = Z_OBJCE_P(object); @@ -143,8 +155,9 @@ static zval *zend_std_call_issetter(zval *object, zval *member TSRMLS_DC) return retval; } +/* }}} */ -static int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce TSRMLS_DC) +static int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce TSRMLS_DC) /* {{{ */ { switch (property_info->flags & ZEND_ACC_PPP_MASK) { case ZEND_ACC_PUBLIC: @@ -161,8 +174,9 @@ static int zend_verify_property_access(zend_property_info *property_info, zend_c } return 0; } +/* }}} */ -static inline zend_bool is_derived_class(zend_class_entry *child_class, zend_class_entry *parent_class) +static inline zend_bool is_derived_class(zend_class_entry *child_class, zend_class_entry *parent_class) /* {{{ */ { child_class = child_class->parent; while (child_class) { @@ -174,8 +188,9 @@ static inline zend_bool is_derived_class(zend_class_entry *child_class, zend_cla return 0; } +/* }}} */ -ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC) +ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC) /* {{{ */ { zend_property_info *property_info = NULL; zend_property_info *scope_property_info; @@ -243,9 +258,9 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce } return property_info; } +/* }}} */ - -ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, int prop_info_name_len TSRMLS_DC) +ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, int prop_info_name_len TSRMLS_DC) /* {{{ */ { zend_property_info *property_info; char *class_name, *prop_name; @@ -257,7 +272,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, if (!property_info) { return FAILURE; } - if (prop_info_name[0] == '\0' && prop_info_name[1] != '*') { + if (class_name && class_name[0] != '*') { if (!(property_info->flags & ZEND_ACC_PRIVATE)) { /* we we're looking for a private prop but found a non private one of the same name */ return FAILURE; @@ -268,8 +283,9 @@ ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, } return zend_verify_property_access(property_info, zobj->ce TSRMLS_CC) ? SUCCESS : FAILURE; } +/* }}} */ -static int zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member, zend_guard **pguard) +static int zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member, zend_guard **pguard) /* {{{ */ { zend_property_info info; zend_guard stub; @@ -292,8 +308,9 @@ static int zend_get_property_guard(zend_object *zobj, zend_property_info *proper stub.in_isset = 0; return zend_hash_quick_add(zobj->guards, property_info->name, property_info->name_length+1, property_info->h, (void**)&stub, sizeof(stub), (void**) pguard); } +/* }}} */ -zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) +zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */ { zend_object *zobj; zval *tmp_member = NULL; @@ -305,7 +322,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) silent = (type == BP_VAR_IS); zobj = Z_OBJ_P(object); - if (member->type != IS_STRING) { + if (Z_TYPE_P(member) != IS_STRING) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); @@ -316,7 +333,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) #if DEBUG_OBJECT_HANDLERS fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member)); -#endif +#endif /* make zend_get_property_info silent if we have getter - we may want to use it */ property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__get != NULL) TSRMLS_CC); @@ -328,23 +345,23 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS && !guard->in_get) { /* have getter - try with it! */ - ZVAL_ADDREF(object); + Z_ADDREF_P(object); guard->in_get = 1; /* prevent circular getting */ rv = zend_std_call_getter(object, member TSRMLS_CC); guard->in_get = 0; if (rv) { retval = &rv; - if (!rv->is_ref && + if (!Z_ISREF_P(rv) && (type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET)) { - if (rv->refcount > 0) { + if (Z_REFCOUNT_P(rv) > 0) { zval *tmp = rv; ALLOC_ZVAL(rv); *rv = *tmp; zval_copy_ctor(rv); - rv->is_ref = 0; - rv->refcount = 0; + Z_UNSET_ISREF_P(rv); + Z_SET_REFCOUNT_P(rv, 0); } if (Z_TYPE_P(rv) != IS_OBJECT) { zend_error(E_NOTICE, "Indirect modification of overloaded property %s::$%s has no effect", zobj->ce->name, Z_STRVAL_P(member)); @@ -362,15 +379,15 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) } } if (tmp_member) { - (*retval)->refcount++; + Z_ADDREF_PP(retval); zval_ptr_dtor(&tmp_member); - (*retval)->refcount--; + Z_DELREF_PP(retval); } return *retval; } +/* }}} */ - -static void zend_std_write_property(zval *object, zval *member, zval *value TSRMLS_DC) +static void zend_std_write_property(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */ { zend_object *zobj; zval *tmp_member = NULL; @@ -379,7 +396,7 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM zobj = Z_OBJ_P(object); - if (member->type != IS_STRING) { + if (Z_TYPE_P(member) != IS_STRING) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); @@ -399,9 +416,9 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM zval garbage = **variable_ptr; /* old value should be destroyed */ /* To check: can't *variable_ptr be some system variable like error_zval here? */ - (*variable_ptr)->type = value->type; + Z_TYPE_PP(variable_ptr) = Z_TYPE_P(value); (*variable_ptr)->value = value->value; - if (value->refcount>0) { + if (Z_REFCOUNT_P(value) > 0) { zval_copy_ctor(*variable_ptr); } zval_dtor(&garbage); @@ -409,7 +426,7 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM zval *garbage = *variable_ptr; /* if we assign referenced variable, we should separate it */ - value->refcount++; + Z_ADDREF_P(value); if (PZVAL_IS_REF(value)) { SEPARATE_ZVAL(&value); } @@ -424,7 +441,7 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM if (zobj->ce->__set && zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS && !guard->in_set) { - ZVAL_ADDREF(object); + Z_ADDREF_P(object); guard->in_set = 1; /* prevent circular setting */ if (zend_std_call_setter(object, member, value TSRMLS_CC) != SUCCESS) { /* for now, just ignore it - __set should take care of warnings, etc. */ @@ -437,7 +454,7 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM zval **foo; /* if we assign referenced variable, we should separate it */ - value->refcount++; + Z_ADDREF_P(value); if (PZVAL_IS_REF(value)) { SEPARATE_ZVAL(&value); } @@ -449,8 +466,9 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM zval_ptr_dtor(&tmp_member); } } +/* }}} */ -zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) +zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); zval *retval; @@ -472,13 +490,9 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) } return 0; } - if (EG(exception)) { - zval_ptr_dtor(&retval); - return 0; - } /* Undo PZVAL_LOCK() */ - retval->refcount--; + Z_DELREF_P(retval); return retval; } else { @@ -486,9 +500,9 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) return 0; } } +/* }}} */ - -static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) +static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); @@ -504,9 +518,9 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSR zend_error(E_ERROR, "Cannot use object of type %s as array", ce->name); } } +/* }}} */ - -static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) +static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); zval *retval; @@ -535,9 +549,9 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TS } return result; } +/* }}} */ - -static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) +static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zend_object *zobj; zval tmp_member; @@ -546,7 +560,7 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC zobj = Z_OBJ_P(object); - if (member->type != IS_STRING) { + if (Z_TYPE_P(member) != IS_STRING) { tmp_member = *member; zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); @@ -570,7 +584,7 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC new_zval = &EG(uninitialized_zval); /* zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member)); */ - new_zval->refcount++; + Z_ADDREF_P(new_zval); zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void **) &retval); } else { /* we do have getter - fail and let it try again with usual get/set */ @@ -582,9 +596,9 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC } return retval; } +/* }}} */ - -static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) +static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zend_object *zobj; zval *tmp_member = NULL; @@ -592,7 +606,7 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) zobj = Z_OBJ_P(object); - if (member->type != IS_STRING) { + if (Z_TYPE_P(member) != IS_STRING) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); @@ -603,14 +617,14 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__unset != NULL) TSRMLS_CC); - if (!property_info || zend_hash_del(zobj->properties, property_info->name, property_info->name_length+1) == FAILURE) { + if (!property_info || zend_hash_quick_del(zobj->properties, property_info->name, property_info->name_length+1, property_info->h) == FAILURE) { zend_guard *guard; if (zobj->ce->__unset && zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS && !guard->in_unset) { /* have unseter - try with it! */ - ZVAL_ADDREF(object); + Z_ADDREF_P(object); guard->in_unset = 1; /* prevent circular unsetting */ zend_std_call_unsetter(object, member TSRMLS_CC); guard->in_unset = 0; @@ -622,9 +636,9 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) zval_ptr_dtor(&tmp_member); } } +/* }}} */ - -static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) +static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); @@ -636,18 +650,18 @@ static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) zend_error(E_ERROR, "Cannot use object of type %s as array", ce->name); } } +/* }}} */ - -ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) +ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ { - zend_internal_function *func = (zend_internal_function *)EG(function_state_ptr)->function; + zend_internal_function *func = (zend_internal_function *)EG(current_execute_data)->function_state.function; zval *method_name_ptr, *method_args_ptr; zval *method_result_ptr = NULL; zend_class_entry *ce = Z_OBJCE_P(this_ptr); ALLOC_ZVAL(method_args_ptr); INIT_PZVAL(method_args_ptr); - array_init(method_args_ptr); + array_init_size(method_args_ptr, ZEND_NUM_ARGS()); if (zend_copy_parameters_array(ZEND_NUM_ARGS(), method_args_ptr TSRMLS_CC) == FAILURE) { zval_dtor(method_args_ptr); @@ -667,7 +681,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) zend_call_method_with_2_params(&this_ptr, ce, &ce->__call, ZEND_CALL_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr); if (method_result_ptr) { - if (method_result_ptr->is_ref || method_result_ptr->refcount > 1) { + if (Z_ISREF_P(method_result_ptr) || Z_REFCOUNT_P(method_result_ptr) > 1) { RETVAL_ZVAL(method_result_ptr, 1, 1); } else { RETVAL_ZVAL(method_result_ptr, 0, 1); @@ -681,12 +695,13 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* destruct the function also, then - we have allocated it in get_method */ efree(func); } +/* }}} */ /* Ensures that we're allowed to call a private method. * Returns the function address that should be called, or NULL * if no such function exists. */ -static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) +static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ { if (!ce) { return 0; @@ -719,17 +734,17 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla } return NULL; } +/* }}} */ - -ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) +ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ { return zend_check_private_int(fbc, ce, function_name_strval, function_name_strlen TSRMLS_CC) != NULL; } - +/* }}} */ /* Ensures that we're allowed to call a protected method. */ -ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) +ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ { zend_class_entry *fbc_scope = ce; @@ -754,13 +769,13 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) } return 0; } +/* }}} */ - -static inline zend_class_entry * zend_get_function_root_class(zend_function *fbc) +static inline zend_class_entry * zend_get_function_root_class(zend_function *fbc) /* {{{ */ { return fbc->common.prototype ? fbc->common.prototype->common.scope : fbc->common.scope; } - +/* }}} */ static inline union _zend_function *zend_get_user_call_function(zend_object *zobj, char *method_name, int method_len) /* {{{ */ { @@ -771,7 +786,7 @@ static inline union _zend_function *zend_get_user_call_function(zend_object *zob call_user_call->arg_info = NULL; call_user_call->num_args = 0; call_user_call->scope = zobj->ce; - call_user_call->fn_flags = 0; + call_user_call->fn_flags = ZEND_ACC_CALL_VIA_HANDLER; call_user_call->function_name = estrndup(method_name, method_len); call_user_call->pass_rest_by_reference = 0; call_user_call->return_reference = ZEND_RETURN_VALUE; @@ -780,21 +795,21 @@ static inline union _zend_function *zend_get_user_call_function(zend_object *zob } /* }}} */ -static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int method_len TSRMLS_DC) +static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int method_len TSRMLS_DC) /* {{{ */ { zend_object *zobj; zend_function *fbc; char *lc_method_name; zval *object = *object_ptr; ALLOCA_FLAG(use_heap) - - lc_method_name = do_alloca_with_limit(method_len+1, use_heap); + + lc_method_name = do_alloca(method_len+1, use_heap); /* Create a zend_copy_str_tolower(dest, src, src_length); */ zend_str_tolower_copy(lc_method_name, method_name, method_len); - + zobj = Z_OBJ_P(object); if (zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&fbc) == FAILURE) { - free_alloca_with_limit(lc_method_name, use_heap); + free_alloca(lc_method_name, use_heap); if (zobj->ce->__call) { return zend_get_user_call_function(zobj, method_name, method_len); } else { @@ -848,17 +863,74 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method } } - free_alloca_with_limit(lc_method_name, use_heap); + free_alloca(lc_method_name, use_heap); return fbc; } +/* }}} */ +ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ +{ + zend_internal_function *func = (zend_internal_function *)EG(current_execute_data)->function_state.function; + zval *method_name_ptr, *method_args_ptr; + zval *method_result_ptr = NULL; + zend_class_entry *ce = EG(scope); + + ALLOC_ZVAL(method_args_ptr); + INIT_PZVAL(method_args_ptr); + array_init_size(method_args_ptr, ZEND_NUM_ARGS()); + + if (zend_copy_parameters_array(ZEND_NUM_ARGS(), method_args_ptr TSRMLS_CC) == FAILURE) { + zval_dtor(method_args_ptr); + zend_error(E_ERROR, "Cannot get arguments for " ZEND_CALLSTATIC_FUNC_NAME); + RETURN_FALSE; + } + + ALLOC_ZVAL(method_name_ptr); + INIT_PZVAL(method_name_ptr); + ZVAL_STRING(method_name_ptr, func->function_name, 0); /* no dup - it's a copy */ + + /* __callStatic handler is called with two arguments: + method name + array of method parameters + */ + zend_call_method_with_2_params(NULL, ce, &ce->__callstatic, ZEND_CALLSTATIC_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr); + + if (method_result_ptr) { + if (Z_ISREF_P(method_result_ptr) || Z_REFCOUNT_P(method_result_ptr) > 1) { + RETVAL_ZVAL(method_result_ptr, 1, 1); + } else { + RETVAL_ZVAL(method_result_ptr, 0, 1); + } + } + + /* now destruct all auxiliaries */ + zval_ptr_dtor(&method_args_ptr); + zval_ptr_dtor(&method_name_ptr); + + /* destruct the function also, then - we have allocated it in get_method */ + efree(func); +} +/* }}} */ /* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */ -ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) + +ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ { - zend_function *fbc; + zend_function *fbc = NULL; + char *lc_class_name, *lc_function_name = NULL; + + lc_function_name = zend_str_tolower_dup(function_name_strval, function_name_strlen); + + if (function_name_strlen == ce->name_length && ce->constructor) { + lc_class_name = zend_str_tolower_dup(ce->name, ce->name_length); + if (!memcmp(lc_class_name, function_name_strval, function_name_strlen)) { + fbc = ce->constructor; + } + efree(lc_class_name); + } + if (!fbc && zend_hash_find(&ce->function_table, lc_function_name, function_name_strlen+1, (void **) &fbc)==FAILURE) { + efree(lc_function_name); - if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) { if (ce->__call && EG(This) && Z_OBJ_HT_P(EG(This))->get_class_entry && @@ -871,21 +943,40 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f call_user_call->arg_info = NULL; call_user_call->num_args = 0; call_user_call->scope = ce; - call_user_call->fn_flags = 0; + call_user_call->fn_flags = ZEND_ACC_CALL_VIA_HANDLER; call_user_call->function_name = estrndup(function_name_strval, function_name_strlen); call_user_call->pass_rest_by_reference = 0; call_user_call->return_reference = ZEND_RETURN_VALUE; return (union _zend_function *)call_user_call; + } else if (ce->__callstatic) { + zend_internal_function *callstatic_user_call = emalloc(sizeof(zend_internal_function)); + + callstatic_user_call->type = ZEND_INTERNAL_FUNCTION; + callstatic_user_call->module = ce->module; + callstatic_user_call->handler = zend_std_callstatic_user_call; + callstatic_user_call->arg_info = NULL; + callstatic_user_call->num_args = 0; + callstatic_user_call->scope = ce; + callstatic_user_call->fn_flags = ZEND_ACC_STATIC | ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER; + callstatic_user_call->function_name = estrndup(function_name_strval, function_name_strlen); + callstatic_user_call->pass_rest_by_reference = 0; + callstatic_user_call->return_reference = ZEND_RETURN_VALUE; + + return (zend_function *)callstatic_user_call; } else { - char *class_name = ce->name; - - if (!class_name) { - class_name = ""; - } - zend_error(E_ERROR, "Call to undefined method %s::%s()", class_name, function_name_strval); + return NULL; } } + efree(lc_function_name); + +#if MBO_0 + /* right now this function is used for non static method lookup too */ + /* Is the function static */ + if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { + zend_error(E_ERROR, "Cannot call non static method %s::%s() without object", ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name); + } +#endif if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) { /* No further checks necessary, most common case */ } else if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) { @@ -908,16 +999,16 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f return fbc; } +/* }}} */ - -ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC) +ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC) /* {{{ */ { zval **retval = NULL; zend_class_entry *tmp_ce = ce; zend_property_info *property_info; zend_property_info std_property_info; - if (zend_hash_find(&ce->properties_info, property_name, property_name_len+1, (void **) &property_info)==FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { + if (zend_hash_find(&ce->properties_info, property_name, property_name_len+1, (void **) &property_info)==FAILURE) { std_property_info.flags = ZEND_ACC_PUBLIC; std_property_info.name = property_name; std_property_info.name_length = property_name_len; @@ -951,16 +1042,16 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert return retval; } +/* }}} */ - -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC) +ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC) /* {{{ */ { zend_error(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name); return 0; } +/* }}} */ - -ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) +ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) /* {{{ */ { zend_object *zobj = Z_OBJ_P(object); zend_function *constructor = zobj->ce->constructor; @@ -980,6 +1071,8 @@ ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) } } else if ((constructor->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. + * Constructors only have prototype if they are defined by an interface but + * it is the compilers responsibility to take care of the prototype. */ if (!zend_check_protected(zend_get_function_root_class(constructor), EG(scope))) { if (EG(scope)) { @@ -993,12 +1086,11 @@ ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) return constructor; } - +/* }}} */ int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC); - -static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) +static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ { zend_object *zobj1, *zobj2; @@ -1010,8 +1102,9 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) } return zend_compare_symbol_tables_i(zobj1->properties, zobj2->properties TSRMLS_CC); } +/* }}} */ -static int zend_std_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC) +static int zend_std_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC) /* {{{ */ { zend_object *zobj; int result; @@ -1021,7 +1114,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists zobj = Z_OBJ_P(object); - if (member->type != IS_STRING) { + if (Z_TYPE_P(member) != IS_STRING) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); @@ -1047,20 +1140,26 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists zval *rv; /* have issetter - try with it! */ - ZVAL_ADDREF(object); + Z_ADDREF_P(object); guard->in_isset = 1; /* prevent circular getting */ rv = zend_std_call_issetter(object, member TSRMLS_CC); if (rv) { result = zend_is_true(rv); zval_ptr_dtor(&rv); - if (has_set_exists && result && !EG(exception) && zobj->ce->__get && !guard->in_get) { - guard->in_get = 1; - rv = zend_std_call_getter(object, member TSRMLS_CC); - guard->in_get = 0; - if (rv) { - rv->refcount++; - result = i_zend_is_true(rv); - zval_ptr_dtor(&rv); + if (has_set_exists && result) { + if (!EG(exception) && zobj->ce->__get && !guard->in_get) { + guard->in_get = 1; + rv = zend_std_call_getter(object, member TSRMLS_CC); + guard->in_get = 0; + if (rv) { + Z_ADDREF_P(rv); + result = i_zend_is_true(rv); + zval_ptr_dtor(&rv); + } else { + result = 0; + } + } else { + result = 0; } } } @@ -1086,17 +1185,18 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists } return result; } +/* }}} */ - -zend_class_entry *zend_std_object_get_class(zval *object TSRMLS_DC) +zend_class_entry *zend_std_object_get_class(const zval *object TSRMLS_DC) /* {{{ */ { zend_object *zobj; zobj = Z_OBJ_P(object); return zobj->ce; } +/* }}} */ -int zend_std_object_get_class_name(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) +int zend_std_object_get_class_name(const zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */ { zend_object *zobj; zend_class_entry *ce; @@ -1115,8 +1215,9 @@ int zend_std_object_get_class_name(zval *object, char **class_name, zend_uint *c *class_name = estrndup(ce->name, ce->name_length); return SUCCESS; } +/* }}} */ -ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC) +ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* {{{ */ { zval *retval; zend_class_entry *ce; @@ -1125,14 +1226,14 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty case IS_STRING: ce = Z_OBJCE_P(readobj); if (ce->__tostring && - (zend_call_method_with_0_params(&readobj, ce, &ce->__tostring, "__tostring", &retval) || EG(exception))) { - if (EG(exception)) { - if (retval) { - zval_ptr_dtor(&retval); - } + (zend_call_method_with_0_params(&readobj, ce, &ce->__tostring, "__tostring", &retval) || EG(exception))) { + if (EG(exception)) { + if (retval) { + zval_ptr_dtor(&retval); + } zend_error(E_ERROR, "Method %s::__toString() must not throw an exception", ce->name); - return FAILURE; - } + return FAILURE; + } if (Z_TYPE_P(retval) == IS_STRING) { INIT_PZVAL(writeobj); if (readobj == writeobj) { @@ -1184,7 +1285,34 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty } return FAILURE; } +/* }}} */ +int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC) /* {{{ */ +{ + zend_class_entry *ce; + if (Z_TYPE_P(obj) != IS_OBJECT) { + return FAILURE; + } + + ce = Z_OBJCE_P(obj); + + if (zend_hash_find(&ce->function_table, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME), (void**)fptr_ptr) == FAILURE) { + return FAILURE; + } + + *ce_ptr = ce; + if ((*fptr_ptr)->common.fn_flags & ZEND_ACC_STATIC) { + if (zobj_ptr) { + *zobj_ptr = NULL; + } + } else { + if (zobj_ptr) { + *zobj_ptr = obj; + } + } + return SUCCESS; +} +/* }}} */ ZEND_API zend_object_handlers std_object_handlers = { zend_objects_store_add_ref, /* add_ref */ @@ -1211,6 +1339,8 @@ ZEND_API zend_object_handlers std_object_handlers = { zend_std_compare_objects, /* compare_objects */ zend_std_cast_object_tostring, /* cast_object */ NULL, /* count_elements */ + NULL, /* get_debug_info */ + zend_std_get_closure, /* get_closure */ }; /* diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 98ed2822b..463852341 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.h,v 1.47.2.2.2.7 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_object_handlers.h,v 1.47.2.2.2.5.2.7 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_OBJECT_HANDLERS_H #define ZEND_OBJECT_HANDLERS_H @@ -80,6 +80,8 @@ typedef void (*zend_object_unset_dimension_t)(zval *object, zval *offset TSRMLS_ /* Used to get hash of the properties of the object, as hash of zval's */ typedef HashTable *(*zend_object_get_properties_t)(zval *object TSRMLS_DC); +typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp TSRMLS_DC); + /* 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. @@ -94,8 +96,8 @@ typedef void (*zend_object_del_ref_t)(zval *object TSRMLS_DC); typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC); typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC); -typedef zend_class_entry *(*zend_object_get_class_entry_t)(zval *object TSRMLS_DC); -typedef int (*zend_object_get_class_name_t)(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC); +typedef zend_class_entry *(*zend_object_get_class_entry_t)(const zval *object TSRMLS_DC); +typedef int (*zend_object_get_class_name_t)(const zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC); typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC); /* Cast an object to some other type @@ -106,6 +108,8 @@ typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type TSRMLS_D * Returns FAILURE if the object does not have any sense of overloaded dimensions */ typedef int (*zend_object_count_elements_t)(zval *object, long *count TSRMLS_DC); +typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC); + struct _zend_object_handlers { /* general object functions */ zend_object_add_ref_t add_ref; @@ -132,6 +136,8 @@ struct _zend_object_handlers { zend_object_compare_t compare_objects; zend_object_cast_t cast_object; zend_object_count_elements_t count_elements; + zend_object_get_debug_info_t get_debug_info; + zend_object_get_closure_t get_closure; }; extern ZEND_API zend_object_handlers std_object_handlers; @@ -142,7 +148,8 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC); ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC); ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC); - +ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC); +ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC); ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC); diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 4754c4f9a..3b41926e1 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects.c,v 1.56.2.3.2.8 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_objects.c,v 1.56.2.3.2.6.2.8 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -53,7 +53,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl if (destructor) { zval *obj; - zval *old_exception; + zend_object_store_bucket *obj_bucket; if (destructor->op_array.fn_flags & (ZEND_ACC_PRIVATE|ZEND_ACC_PROTECTED)) { if (destructor->op_array.fn_flags & ZEND_ACC_PRIVATE) { @@ -88,31 +88,23 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl MAKE_STD_ZVAL(obj); Z_TYPE_P(obj) = IS_OBJECT; Z_OBJ_HANDLE_P(obj) = handle; - /* TODO: We cannot set proper handlers. */ - Z_OBJ_HT_P(obj) = &std_object_handlers; + obj_bucket = &EG(objects_store).object_buckets[handle]; + if (!obj_bucket->bucket.obj.handlers) { + obj_bucket->bucket.obj.handlers = &std_object_handlers; + } + Z_OBJ_HT_P(obj) = obj_bucket->bucket.obj.handlers; zval_copy_ctor(obj); /* Make sure that destructors are protected from previously thrown exceptions. * For example, if an exception was thrown in a function and when the function's * local variable destruction results in a destructor being called. */ - old_exception = EG(exception); - EG(exception) = NULL; - zend_call_method_with_0_params(&obj, object->ce, &destructor, ZEND_DESTRUCTOR_FUNC_NAME, NULL); - if (old_exception) { - if (EG(exception)) { - zend_class_entry *default_exception_ce = zend_exception_get_default(TSRMLS_C); - zval *file = zend_read_property(default_exception_ce, old_exception, "file", sizeof("file")-1, 1 TSRMLS_CC); - zval *line = zend_read_property(default_exception_ce, old_exception, "line", sizeof("line")-1, 1 TSRMLS_CC); - - zval_ptr_dtor(&obj); - zval_ptr_dtor(&EG(exception)); - EG(exception) = old_exception; - zend_error(E_ERROR, "Ignoring exception from %s::__destruct() while an exception is already active (Uncaught %s in %s on line %ld)", - object->ce->name, Z_OBJCE_P(old_exception)->name, Z_STRVAL_P(file), Z_LVAL_P(line)); - } - EG(exception) = old_exception; + if (EG(exception) && Z_OBJ_HANDLE_P(EG(exception)) == handle) { + zend_error(E_ERROR, "Attempt to destruct pending exception"); } + zend_exception_save(TSRMLS_C); + zend_call_method_with_0_params(&obj, object->ce, &destructor, ZEND_DESTRUCTOR_FUNC_NAME, NULL); + zend_exception_restore(TSRMLS_C); zval_ptr_dtor(&obj); } } @@ -135,38 +127,15 @@ ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_ent return retval; } -ZEND_API zend_object *zend_objects_get_address(zval *zobject TSRMLS_DC) +ZEND_API zend_object *zend_objects_get_address(const zval *zobject TSRMLS_DC) { return (zend_object *)zend_object_store_get_object(zobject TSRMLS_CC); } -static void zval_add_ref_or_clone(zval **p) -{ - if (Z_TYPE_PP(p) == IS_OBJECT && !PZVAL_IS_REF(*p)) { - TSRMLS_FETCH(); - - if (Z_OBJ_HANDLER_PP(p, clone_obj) == NULL) { - zend_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_PP(p)->name); - } else { - zval *orig = *p; - - ALLOC_ZVAL(*p); - **p = *orig; - INIT_PZVAL(*p); - (*p)->value.obj = Z_OBJ_HT_PP(p)->clone_obj(orig TSRMLS_CC); - } - } else { - (*p)->refcount++; - } -} - ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_value new_obj_val, zend_object *old_object, zend_object_handle handle TSRMLS_DC) { - if (EG(ze1_compatibility_mode)) { - zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref_or_clone, (void *) NULL /* Not used anymore */, sizeof(zval *)); - } else { - zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *)); - } + zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *)); + if (old_object->ce->clone) { zval *new_obj; diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h index 1c93f5c6a..1b60e9953 100644 --- a/Zend/zend_objects.h +++ b/Zend/zend_objects.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects.h,v 1.25.2.2.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_objects.h,v 1.25.2.2.2.1.2.3 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_OBJECTS_H #define ZEND_OBJECTS_H @@ -29,7 +29,7 @@ ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSR ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC); ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC); ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC); -ZEND_API zend_object *zend_objects_get_address(zval *object TSRMLS_DC); +ZEND_API zend_object *zend_objects_get_address(const zval *object TSRMLS_DC); ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_value new_obj_val, zend_object *old_object, zend_object_handle handle TSRMLS_DC); ZEND_API zend_object_value zend_objects_clone_obj(zval *object TSRMLS_DC); ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC); diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index 176b004bc..1cce7ca62 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects_API.c,v 1.47.2.6.2.9 2009/02/11 09:58:33 tony2001 Exp $ */ +/* $Id: zend_objects_API.c,v 1.47.2.6.2.6.2.9 2009/02/11 09:58:23 tony2001 Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -85,6 +85,8 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects if (objects->object_buckets[i].valid) { struct _store_object *obj = &objects->object_buckets[i].bucket.obj; + GC_REMOVE_ZOBJ_FROM_BUFFER(obj); + objects->object_buckets[i].valid = 0; if (obj->free_storage) { obj->free_storage(obj->object TSRMLS_CC); @@ -117,11 +119,12 @@ ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_st EG(objects_store).object_buckets[handle].valid = 1; obj->refcount = 1; + GC_OBJ_INIT(obj); obj->object = object; obj->dtor = dtor?dtor:(zend_objects_store_dtor_t)zend_objects_destroy_object; obj->free_storage = free_storage; - obj->clone = clone; + obj->handlers = NULL; #if ZEND_DEBUG_OBJECTS fprintf(stderr, "Allocated object id #%d\n", handle); @@ -165,15 +168,17 @@ ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC) handle = Z_OBJ_HANDLE_P(zobject); - zobject->refcount++; - zend_objects_store_del_ref_by_handle(handle TSRMLS_CC); - zobject->refcount--; + Z_ADDREF_P(zobject); + zend_objects_store_del_ref_by_handle_ex(handle, Z_OBJ_HT_P(zobject) TSRMLS_CC); + Z_DELREF_P(zobject); + + GC_ZOBJ_CHECK_POSSIBLE_ROOT(zobject); } /* * Delete a reference to an objects store entry given the object handle. */ -ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC) +ZEND_API void zend_objects_store_del_ref_by_handle_ex(zend_object_handle handle, const zend_object_handlers *handlers TSRMLS_DC) /* {{{ */ { struct _store_object *obj; int failure = 0; @@ -194,6 +199,9 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR EG(objects_store).object_buckets[handle].destructor_called = 1; if (obj->dtor) { + if (handlers && !obj->handlers) { + obj->handlers = handlers; + } zend_try { obj->dtor(obj->object, handle TSRMLS_CC); } zend_catch { @@ -201,11 +209,12 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR } zend_end_try(); } } - + /* re-read the object from the object store as the store might have been reallocated in the dtor */ obj = &EG(objects_store).object_buckets[handle].bucket.obj; if (obj->refcount == 1) { + GC_REMOVE_ZOBJ_FROM_BUFFER(obj); if (obj->free_storage) { zend_try { obj->free_storage(obj->object TSRMLS_CC); @@ -231,6 +240,7 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR zend_bailout(); } } +/* }}} */ ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC) { @@ -250,11 +260,12 @@ ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC) retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->free_storage, obj->clone TSRMLS_CC); retval.handlers = Z_OBJ_HT_P(zobject); + EG(objects_store).object_buckets[handle].bucket.obj.handlers = retval.handlers; return retval; } -ZEND_API void *zend_object_store_get_object(zval *zobject TSRMLS_DC) +ZEND_API void *zend_object_store_get_object(const zval *zobject TSRMLS_DC) { zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); @@ -288,8 +299,10 @@ ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC) { zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); - - EG(objects_store).object_buckets[handle].destructor_called = 1; + zend_object_store_bucket *obj_bucket = &EG(objects_store).object_buckets[handle]; + + obj_bucket->bucket.obj.handlers = Z_OBJ_HT_P(zobject);; + obj_bucket->destructor_called = 1; } diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h index 9646c2f5a..de9bf114f 100644 --- a/Zend/zend_objects_API.h +++ b/Zend/zend_objects_API.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects_API.h,v 1.20.2.1.2.6 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_objects_API.h,v 1.20.2.1.2.4.2.5 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_OBJECTS_API_H #define ZEND_OBJECTS_API_H @@ -37,7 +37,9 @@ typedef struct _zend_object_store_bucket { zend_objects_store_dtor_t dtor; zend_objects_free_object_storage_t free_storage; zend_objects_store_clone_t clone; + const zend_object_handlers *handlers; zend_uint refcount; + gc_root_buffer *buffered; } obj; struct { int next; @@ -65,10 +67,13 @@ ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_st ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC); ZEND_API void zend_objects_store_del_ref(zval *object TSRMLS_DC); ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC); -ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC); +ZEND_API void zend_objects_store_del_ref_by_handle_ex(zend_object_handle handle, const zend_object_handlers *handlers TSRMLS_DC); +static inline void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC) { + zend_objects_store_del_ref_by_handle_ex(handle, NULL TSRMLS_CC); +} ZEND_API zend_uint zend_objects_store_get_refcount(zval *object TSRMLS_DC); ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC); -ZEND_API void *zend_object_store_get_object(zval *object TSRMLS_DC); +ZEND_API void *zend_object_store_get_object(const zval *object TSRMLS_DC); ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC); /* See comment in zend_objects_API.c before you use this */ ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC); diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 8c7001f45..07288c0ec 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_opcode.c,v 1.110.2.6.2.6 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_opcode.c,v 1.110.2.6.2.3.2.10 2008/12/31 11:15:32 sebastian Exp $ */ #include @@ -95,12 +95,14 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz op_array->return_reference = 0; op_array->done_pass_two = 0; - op_array->uses_this = 0; + op_array->this_var = -1; op_array->start_op = NULL; op_array->fn_flags = CG(interactive)?ZEND_ACC_INTERACTIVE:0; + op_array->early_binding = -1; + memset(op_array->reserved, 0, ZEND_MAX_RESERVED_RESOURCES * sizeof(void*)); zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array TSRMLS_CC); @@ -276,9 +278,9 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC) } if (op_array->arg_info) { for (i=0; inum_args; i++) { - efree(op_array->arg_info[i].name); + efree((char*)op_array->arg_info[i].name); if (op_array->arg_info[i].class_name) { - efree(op_array->arg_info[i].class_name); + efree((char*)op_array->arg_info[i].class_name); } } efree(op_array->arg_info); @@ -364,10 +366,10 @@ int pass_two(zend_op_array *op_array TSRMLS_DC) if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) { return 0; } - if (CG(extended_info)) { + if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) { zend_update_extended_info(op_array TSRMLS_CC); } - if (CG(handle_op_arrays)) { + if (CG(compiler_options) & ZEND_COMPILE_HANDLE_OP_ARRAY) { zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC); } @@ -380,14 +382,19 @@ int pass_two(zend_op_array *op_array TSRMLS_DC) end = opline + op_array->last; while (opline < end) { if (opline->op1.op_type == IS_CONST) { - opline->op1.u.constant.is_ref = 1; - opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */ + Z_SET_ISREF(opline->op1.u.constant); + Z_SET_REFCOUNT(opline->op1.u.constant, 2); /* Make sure is_ref won't be reset */ } if (opline->op2.op_type == IS_CONST) { - opline->op2.u.constant.is_ref = 1; - opline->op2.u.constant.refcount = 2; + Z_SET_ISREF(opline->op2.u.constant); + Z_SET_REFCOUNT(opline->op2.u.constant, 2); } switch (opline->opcode) { + case ZEND_GOTO: + if (Z_TYPE(opline->op2.u.constant) != IS_LONG) { + zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC); + } + /* break omitted intentionally */ case ZEND_JMP: opline->op1.u.jmp_addr = &op_array->opcodes[opline->op1.u.opline_num]; break; @@ -395,6 +402,7 @@ int pass_two(zend_op_array *op_array TSRMLS_DC) case ZEND_JMPNZ: case ZEND_JMPZ_EX: case ZEND_JMPNZ_EX: + case ZEND_JMP_SET: opline->op2.u.jmp_addr = &op_array->opcodes[opline->op2.u.opline_num]; break; } @@ -429,73 +437,76 @@ ZEND_API unary_op_type get_unary_op(int opcode) } } -ZEND_API void *get_binary_op(int opcode) +ZEND_API binary_op_type get_binary_op(int opcode) { switch (opcode) { case ZEND_ADD: case ZEND_ASSIGN_ADD: - return (void *) add_function; + return (binary_op_type) add_function; break; case ZEND_SUB: case ZEND_ASSIGN_SUB: - return (void *) sub_function; + return (binary_op_type) sub_function; break; case ZEND_MUL: case ZEND_ASSIGN_MUL: - return (void *) mul_function; + return (binary_op_type) mul_function; break; case ZEND_DIV: case ZEND_ASSIGN_DIV: - return (void *) div_function; + return (binary_op_type) div_function; break; case ZEND_MOD: case ZEND_ASSIGN_MOD: - return (void *) mod_function; + return (binary_op_type) mod_function; break; case ZEND_SL: case ZEND_ASSIGN_SL: - return (void *) shift_left_function; + return (binary_op_type) shift_left_function; break; case ZEND_SR: case ZEND_ASSIGN_SR: - return (void *) shift_right_function; + return (binary_op_type) shift_right_function; break; case ZEND_CONCAT: case ZEND_ASSIGN_CONCAT: - return (void *) concat_function; + return (binary_op_type) concat_function; break; case ZEND_IS_IDENTICAL: - return (void *) is_identical_function; + return (binary_op_type) is_identical_function; break; case ZEND_IS_NOT_IDENTICAL: - return (void *) is_not_identical_function; + return (binary_op_type) is_not_identical_function; break; case ZEND_IS_EQUAL: - return (void *) is_equal_function; + return (binary_op_type) is_equal_function; break; case ZEND_IS_NOT_EQUAL: - return (void *) is_not_equal_function; + return (binary_op_type) is_not_equal_function; break; case ZEND_IS_SMALLER: - return (void *) is_smaller_function; + return (binary_op_type) is_smaller_function; break; case ZEND_IS_SMALLER_OR_EQUAL: - return (void *) is_smaller_or_equal_function; + return (binary_op_type) is_smaller_or_equal_function; break; case ZEND_BW_OR: case ZEND_ASSIGN_BW_OR: - return (void *) bitwise_or_function; + return (binary_op_type) bitwise_or_function; break; case ZEND_BW_AND: case ZEND_ASSIGN_BW_AND: - return (void *) bitwise_and_function; + return (binary_op_type) bitwise_and_function; break; case ZEND_BW_XOR: case ZEND_ASSIGN_BW_XOR: - return (void *) bitwise_xor_function; + return (binary_op_type) bitwise_xor_function; + break; + case ZEND_BOOL_XOR: + return (binary_op_type) boolean_xor_function; break; default: - return (void *) NULL; + return (binary_op_type) NULL; break; } } diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index f0f1a761a..5c4e87828 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -5,7 +5,7 @@ | Copyright (c) 1998-2009 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 | + | 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.c,v 1.208.2.4.2.30 2009/02/17 15:15:36 mattwil Exp $ */ +/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.22 2009/03/18 11:25:37 dmitry Exp $ */ #include @@ -42,6 +42,8 @@ static _locale_t current_locale = NULL; #define zend_tolower(c) tolower(c) #endif +#define TYPE_PAIR(t1,t2) (((t1) << 4) | (t2)) + ZEND_API int zend_atoi(const char *str, int str_len) { int retval; @@ -69,6 +71,33 @@ ZEND_API int zend_atoi(const char *str, int str_len) return retval; } +ZEND_API long zend_atol(const char *str, int str_len) +{ + long retval; + + if (!str_len) { + str_len = strlen(str); + } + retval = strtol(str, NULL, 0); + if (str_len>0) { + switch (str[str_len-1]) { + case 'g': + case 'G': + retval *= 1024; + /* break intentionally missing */ + case 'm': + case 'M': + retval *= 1024; + /* break intentionally missing */ + case 'k': + case 'K': + retval *= 1024; + break; + } + } + return retval; +} + ZEND_API double zend_string_to_double(const char *number, zend_uint length) { @@ -118,106 +147,86 @@ ZEND_API double zend_string_to_double(const char *number, zend_uint length) ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) { - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_STRING: { char *strval; - strval = op->value.str.val; - if ((op->type=is_numeric_string(strval, op->value.str.len, &op->value.lval, &op->value.dval, 1)) == 0) { - op->value.lval = 0; - op->type = IS_LONG; + strval = Z_STRVAL_P(op); + if ((Z_TYPE_P(op)=is_numeric_string(strval, Z_STRLEN_P(op), &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { + ZVAL_LONG(op, 0); } STR_FREE(strval); break; } case IS_BOOL: - op->type = IS_LONG; + Z_TYPE_P(op) = IS_LONG; break; case IS_RESOURCE: - zend_list_delete(op->value.lval); - op->type = IS_LONG; + zend_list_delete(Z_LVAL_P(op)); + Z_TYPE_P(op) = IS_LONG; break; case IS_OBJECT: convert_to_long_base(op, 10); break; case IS_NULL: - op->type = IS_LONG; - op->value.lval = 0; + ZVAL_LONG(op, 0); break; } } #define zendi_convert_scalar_to_number(op, holder, result) \ if (op==result) { \ - if (op->type != IS_LONG) { \ + if (Z_TYPE_P(op) != IS_LONG) { \ convert_scalar_to_number(op TSRMLS_CC); \ } \ } else { \ - switch ((op)->type) { \ + switch (Z_TYPE_P(op)) { \ case IS_STRING: \ { \ - if (((holder).type=is_numeric_string((op)->value.str.val, (op)->value.str.len, &(holder).value.lval, &(holder).value.dval, 1)) == 0) { \ - (holder).value.lval = 0; \ - (holder).type = IS_LONG; \ + if ((Z_TYPE(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \ + ZVAL_LONG(&(holder), 0); \ } \ (op) = &(holder); \ break; \ } \ case IS_BOOL: \ case IS_RESOURCE: \ - (holder).value.lval = (op)->value.lval; \ - (holder).type = IS_LONG; \ + ZVAL_LONG(&(holder), Z_LVAL_P(op)); \ (op) = &(holder); \ break; \ case IS_NULL: \ - (holder).value.lval = 0; \ - (holder).type = IS_LONG; \ + ZVAL_LONG(&(holder), 0); \ (op) = &(holder); \ break; \ case IS_OBJECT: \ (holder) = (*(op)); \ zval_copy_ctor(&(holder)); \ convert_to_long_base(&(holder), 10); \ - if ((holder).type == IS_LONG) { \ + if (Z_TYPE(holder) == IS_LONG) { \ (op) = &(holder); \ } \ break; \ } \ } -#ifdef _WIN64 -# define DVAL_TO_LVAL(d, l) \ - if ((d) > LONG_MAX) { \ - (l) = (long)(unsigned long)(__int64) (d); \ - } else { \ - (l) = (long) (d); \ - } -#else -# define DVAL_TO_LVAL(d, l) \ - if ((d) > LONG_MAX) { \ - (l) = (unsigned long) (d); \ - } else { \ - (l) = (long) (d); \ - } -#endif #define zendi_convert_to_long(op, holder, result) \ if (op == result) { \ convert_to_long(op); \ - } else if ((op)->type != IS_LONG) { \ - switch ((op)->type) { \ + } else if (Z_TYPE_P(op) != IS_LONG) { \ + switch (Z_TYPE_P(op)) { \ case IS_NULL: \ - (holder).value.lval = 0; \ + Z_LVAL(holder) = 0; \ break; \ case IS_DOUBLE: \ - DVAL_TO_LVAL((op)->value.dval, (holder).value.lval); \ + DVAL_TO_LVAL(Z_DVAL_P(op), Z_LVAL(holder)); \ break; \ case IS_STRING: \ - (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \ + Z_LVAL(holder) = strtol(Z_STRVAL_P(op), NULL, 10); \ break; \ case IS_ARRAY: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \ + Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \ break; \ case IS_OBJECT: \ (holder) = (*(op)); \ @@ -226,14 +235,14 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) break; \ case IS_BOOL: \ case IS_RESOURCE: \ - (holder).value.lval = (op)->value.lval; \ + Z_LVAL(holder) = Z_LVAL_P(op); \ break; \ default: \ zend_error(E_WARNING, "Cannot convert to ordinal value"); \ - (holder).value.lval = 0; \ + Z_LVAL(holder) = 0; \ break; \ } \ - (holder).type = IS_LONG; \ + Z_TYPE(holder) = IS_LONG; \ (op) = &(holder); \ } @@ -241,28 +250,28 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) #define zendi_convert_to_boolean(op, holder, result) \ if (op==result) { \ convert_to_boolean(op); \ - } else if ((op)->type != IS_BOOL) { \ - switch ((op)->type) { \ + } else if (Z_TYPE_P(op) != IS_BOOL) { \ + switch (Z_TYPE_P(op)) { \ case IS_NULL: \ - (holder).value.lval = 0; \ + Z_LVAL(holder) = 0; \ break; \ case IS_RESOURCE: \ case IS_LONG: \ - (holder).value.lval = ((op)->value.lval ? 1 : 0); \ + Z_LVAL(holder) = (Z_LVAL_P(op) ? 1 : 0); \ break; \ case IS_DOUBLE: \ - (holder).value.lval = ((op)->value.dval ? 1 : 0); \ + Z_LVAL(holder) = (Z_DVAL_P(op) ? 1 : 0); \ break; \ case IS_STRING: \ - if ((op)->value.str.len == 0 \ - || ((op)->value.str.len==1 && (op)->value.str.val[0]=='0')) { \ - (holder).value.lval = 0; \ + if (Z_STRLEN_P(op) == 0 \ + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \ + Z_LVAL(holder) = 0; \ } else { \ - (holder).value.lval = 1; \ + Z_LVAL(holder) = 1; \ } \ break; \ case IS_ARRAY: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \ + Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \ break; \ case IS_OBJECT: \ (holder) = (*(op)); \ @@ -270,10 +279,10 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) convert_to_boolean(&(holder)); \ break; \ default: \ - (holder).value.lval = 0; \ + Z_LVAL(holder) = 0; \ break; \ } \ - (holder).type = IS_BOOL; \ + Z_TYPE(holder) = IS_BOOL; \ (op) = &(holder); \ } @@ -305,7 +314,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) ZEND_API void convert_to_long(zval *op) { - if ((op)->type != IS_LONG) { + if (Z_TYPE_P(op) != IS_LONG) { convert_to_long_base(op, 10); } } @@ -315,31 +324,31 @@ ZEND_API void convert_to_long_base(zval *op, int base) char *strval; long tmp; - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_NULL: - op->value.lval = 0; + Z_LVAL_P(op) = 0; break; case IS_RESOURCE: { TSRMLS_FETCH(); - zend_list_delete(op->value.lval); + zend_list_delete(Z_LVAL_P(op)); } /* break missing intentionally */ case IS_BOOL: case IS_LONG: break; case IS_DOUBLE: - DVAL_TO_LVAL(op->value.dval, op->value.lval); + DVAL_TO_LVAL(Z_DVAL_P(op), Z_LVAL_P(op)); break; case IS_STRING: - strval = op->value.str.val; - op->value.lval = strtol(strval, NULL, base); + strval = Z_STRVAL_P(op); + Z_LVAL_P(op) = strtol(strval, NULL, base); STR_FREE(strval); break; case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); + tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - op->value.lval = tmp; + Z_LVAL_P(op) = tmp; break; case IS_OBJECT: { @@ -348,18 +357,11 @@ ZEND_API void convert_to_long_base(zval *op, int base) convert_object_to_type(op, IS_LONG, convert_to_long); - if (op->type == IS_LONG) { + if (Z_TYPE_P(op) == IS_LONG) { return; } - - if (EG(ze1_compatibility_mode)) { - HashTable *ht = Z_OBJPROP_P(op); - if (ht) { - retval = (zend_hash_num_elements(ht)?1:0); - } - } else { - zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name); - } + zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name); + zval_dtor(op); ZVAL_LONG(op, retval); return; @@ -367,11 +369,11 @@ ZEND_API void convert_to_long_base(zval *op, int base) default: zend_error(E_WARNING, "Cannot convert to ordinal value"); zval_dtor(op); - op->value.lval = 0; + Z_LVAL_P(op) = 0; break; } - op->type = IS_LONG; + Z_TYPE_P(op) = IS_LONG; } @@ -380,64 +382,56 @@ ZEND_API void convert_to_double(zval *op) char *strval; double tmp; - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_NULL: - op->value.dval = 0.0; + Z_DVAL_P(op) = 0.0; break; case IS_RESOURCE: { TSRMLS_FETCH(); - zend_list_delete(op->value.lval); + zend_list_delete(Z_LVAL_P(op)); } /* break missing intentionally */ case IS_BOOL: case IS_LONG: - op->value.dval = (double) op->value.lval; + Z_DVAL_P(op) = (double) Z_LVAL_P(op); break; case IS_DOUBLE: break; case IS_STRING: - strval = op->value.str.val; + strval = Z_STRVAL_P(op); - op->value.dval = zend_strtod(strval, NULL); + Z_DVAL_P(op) = zend_strtod(strval, NULL); STR_FREE(strval); break; case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); + tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - op->value.dval = tmp; + Z_DVAL_P(op) = tmp; break; case IS_OBJECT: { double retval = 1.0; TSRMLS_FETCH(); - + convert_object_to_type(op, IS_DOUBLE, convert_to_double); - if (op->type == IS_DOUBLE) { + if (Z_TYPE_P(op) == IS_DOUBLE) { return; } - - if (EG(ze1_compatibility_mode)) { - HashTable *ht = Z_OBJPROP_P(op); - if (ht) { - retval = (zend_hash_num_elements(ht)?1.0:0.0); - } - } else { - zend_error(E_NOTICE, "Object of class %s could not be converted to double", Z_OBJCE_P(op)->name); - } + zend_error(E_NOTICE, "Object of class %s could not be converted to double", Z_OBJCE_P(op)->name); zval_dtor(op); ZVAL_DOUBLE(op, retval); break; - } + } default: - zend_error(E_WARNING, "Cannot convert to real value (type=%d)", op->type); + zend_error(E_WARNING, "Cannot convert to real value (type=%d)", Z_TYPE_P(op)); zval_dtor(op); - op->value.dval = 0; + Z_DVAL_P(op) = 0; break; } - op->type = IS_DOUBLE; + Z_TYPE_P(op) = IS_DOUBLE; } @@ -469,39 +463,39 @@ ZEND_API void convert_to_boolean(zval *op) char *strval; int tmp; - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_BOOL: break; case IS_NULL: - op->value.lval = 0; + Z_LVAL_P(op) = 0; break; case IS_RESOURCE: { TSRMLS_FETCH(); - zend_list_delete(op->value.lval); + zend_list_delete(Z_LVAL_P(op)); } /* break missing intentionally */ case IS_LONG: - op->value.lval = (op->value.lval ? 1 : 0); + Z_LVAL_P(op) = (Z_LVAL_P(op) ? 1 : 0); break; case IS_DOUBLE: - op->value.lval = (op->value.dval ? 1 : 0); + Z_LVAL_P(op) = (Z_DVAL_P(op) ? 1 : 0); break; case IS_STRING: - strval = op->value.str.val; + strval = Z_STRVAL_P(op); - if (op->value.str.len == 0 - || (op->value.str.len==1 && op->value.str.val[0]=='0')) { - op->value.lval = 0; + if (Z_STRLEN_P(op) == 0 + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { + Z_LVAL_P(op) = 0; } else { - op->value.lval = 1; + Z_LVAL_P(op) = 1; } STR_FREE(strval); break; case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); + tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - op->value.lval = tmp; + Z_LVAL_P(op) = tmp; break; case IS_OBJECT: { @@ -510,27 +504,20 @@ ZEND_API void convert_to_boolean(zval *op) convert_object_to_type(op, IS_BOOL, convert_to_boolean); - if (op->type == IS_BOOL) { + if (Z_TYPE_P(op) == IS_BOOL) { return; } - - if (EG(ze1_compatibility_mode)) { - HashTable *ht = Z_OBJPROP_P(op); - if (ht) { - retval = (zend_hash_num_elements(ht)?1:0); - } - } - + zval_dtor(op); ZVAL_BOOL(op, retval); break; } default: zval_dtor(op); - op->value.lval = 0; + Z_LVAL_P(op) = 0; break; } - op->type = IS_BOOL; + Z_TYPE_P(op) = IS_BOOL; } ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) @@ -538,61 +525,61 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) long lval; double dval; - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_NULL: - op->value.str.val = STR_EMPTY_ALLOC(); - op->value.str.len = 0; + Z_STRVAL_P(op) = STR_EMPTY_ALLOC(); + Z_STRLEN_P(op) = 0; break; case IS_STRING: break; case IS_BOOL: - if (op->value.lval) { - op->value.str.val = estrndup_rel("1", 1); - op->value.str.len = 1; + if (Z_LVAL_P(op)) { + Z_STRVAL_P(op) = estrndup_rel("1", 1); + Z_STRLEN_P(op) = 1; } else { - op->value.str.val = STR_EMPTY_ALLOC(); - op->value.str.len = 0; + Z_STRVAL_P(op) = STR_EMPTY_ALLOC(); + Z_STRLEN_P(op) = 0; } break; case IS_RESOURCE: { - long tmp = op->value.lval; + long tmp = Z_LVAL_P(op); TSRMLS_FETCH(); - zend_list_delete(op->value.lval); - op->value.str.len = zend_spprintf(&op->value.str.val, 0, "Resource id #%ld", tmp); + zend_list_delete(Z_LVAL_P(op)); + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "Resource id #%ld", tmp); break; } case IS_LONG: - lval = op->value.lval; + lval = Z_LVAL_P(op); - op->value.str.len = zend_spprintf(&op->value.str.val, 0, "%ld", lval); /* SAFE */ + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%ld", lval); /* SAFE */ break; case IS_DOUBLE: { TSRMLS_FETCH(); - dval = op->value.dval; - op->value.str.len = zend_spprintf(&op->value.str.val, 0, "%.*G", (int) EG(precision), dval); /* SAFE */ + dval = Z_DVAL_P(op); + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), dval); /* SAFE */ /* %G already handles removing trailing zeros from the fractional part, yay */ break; } case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); zval_dtor(op); - op->value.str.val = estrndup_rel("Array", sizeof("Array")-1); - op->value.str.len = sizeof("Array")-1; + Z_STRVAL_P(op) = estrndup_rel("Array", sizeof("Array")-1); + Z_STRLEN_P(op) = sizeof("Array")-1; break; case IS_OBJECT: { TSRMLS_FETCH(); - + convert_object_to_type(op, IS_STRING, convert_to_string); - if (op->type == IS_STRING) { + if (Z_TYPE_P(op) == IS_STRING) { return; } zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name); zval_dtor(op); - op->value.str.val = estrndup_rel("Object", sizeof("Object")-1); - op->value.str.len = sizeof("Object")-1; + Z_STRVAL_P(op) = estrndup_rel("Object", sizeof("Object")-1); + Z_STRLEN_P(op) = sizeof("Object")-1; break; } default: @@ -600,24 +587,24 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) ZVAL_BOOL(op, 0); break; } - op->type = IS_STRING; + Z_TYPE_P(op) = IS_STRING; } static void convert_scalar_to_array(zval *op, int type) { zval *entry; - + ALLOC_ZVAL(entry); *entry = *op; INIT_PZVAL(entry); - + switch (type) { case IS_ARRAY: - ALLOC_HASHTABLE(op->value.ht); - zend_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_index_update(op->value.ht, 0, (void *) &entry, sizeof(zval *), NULL); - op->type = IS_ARRAY; + ALLOC_HASHTABLE(Z_ARRVAL_P(op)); + zend_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0); + zend_hash_index_update(Z_ARRVAL_P(op), 0, (void *) &entry, sizeof(zval *), NULL); + Z_TYPE_P(op) = IS_ARRAY; break; case IS_OBJECT: { @@ -636,7 +623,7 @@ ZEND_API void convert_to_array(zval *op) { TSRMLS_FETCH(); - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_ARRAY: return; break; @@ -656,21 +643,21 @@ ZEND_API void convert_to_array(zval *op) } else { convert_object_to_type(op, IS_ARRAY, convert_to_array); - if (op->type == IS_ARRAY) { + if (Z_TYPE_P(op) == IS_ARRAY) { zend_hash_destroy(ht); FREE_HASHTABLE(ht); return; } } zval_dtor(op); - op->type = IS_ARRAY; - op->value.ht = ht; + Z_TYPE_P(op) = IS_ARRAY; + Z_ARRVAL_P(op) = ht; } return; case IS_NULL: - ALLOC_HASHTABLE(op->value.ht); - zend_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0); - op->type = IS_ARRAY; + ALLOC_HASHTABLE(Z_ARRVAL_P(op)); + zend_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0); + Z_TYPE_P(op) = IS_ARRAY; break; default: convert_scalar_to_array(op, IS_ARRAY); @@ -681,13 +668,13 @@ ZEND_API void convert_to_array(zval *op) ZEND_API void convert_to_object(zval *op) { - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_ARRAY: { /* OBJECTS_OPTIMIZE */ TSRMLS_FETCH(); - object_and_properties_init(op, zend_standard_class_def, op->value.ht); + object_and_properties_init(op, zend_standard_class_def, Z_ARRVAL_P(op)); return; break; } @@ -711,14 +698,14 @@ ZEND_API void multi_convert_to_long_ex(int argc, ...) { zval **arg; va_list ap; - + va_start(ap, argc); while (argc--) { arg = va_arg(ap, zval **); convert_to_long_ex(arg); } - + va_end(ap); } @@ -726,14 +713,14 @@ ZEND_API void multi_convert_to_double_ex(int argc, ...) { zval **arg; va_list ap; - + va_start(ap, argc); - while (argc--) { + while (argc--) { arg = va_arg(ap, zval **); convert_to_double_ex(arg); } - + va_end(ap); } @@ -741,209 +728,251 @@ ZEND_API void multi_convert_to_string_ex(int argc, ...) { zval **arg; va_list ap; - + va_start(ap, argc); - while (argc--) { + while (argc--) { arg = va_arg(ap, zval **); convert_to_string_ex(arg); } - + va_end(ap); } ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; + int converted = 0; - if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) { - zval *tmp; + while (1) { + switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { + case TYPE_PAIR(IS_LONG, IS_LONG): { + long lval = Z_LVAL_P(op1) + Z_LVAL_P(op2); - if ((result == op1) && (result == op2)) { - /* $a += $a */ - return SUCCESS; - } - if (result != op1) { - *result = *op1; - zval_copy_ctor(result); - } - zend_hash_merge(result->value.ht, op2->value.ht, (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); - return SUCCESS; - } - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); + /* check for overflow by comparing sign bits */ + if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK) + && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { + ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2)); + } else { + ZVAL_LONG(result, lval); + } + return SUCCESS; + } - if (op1->type == IS_LONG && op2->type == IS_LONG) { - long lval = op1->value.lval + op2->value.lval; - - /* check for overflow by comparing sign bits */ - if ( (op1->value.lval & LONG_SIGN_MASK) == (op2->value.lval & LONG_SIGN_MASK) - && (op1->value.lval & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { + case TYPE_PAIR(IS_LONG, IS_DOUBLE): + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2)); + return SUCCESS; - result->value.dval = (double) op1->value.lval + (double) op2->value.lval; - result->type = IS_DOUBLE; - } else { - result->value.lval = lval; - result->type = IS_LONG; + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2))); + return SUCCESS; + + case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): + ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2)); + return SUCCESS; + + case TYPE_PAIR(IS_ARRAY, IS_ARRAY): { + zval *tmp; + + if ((result == op1) && (result == op2)) { + /* $a += $a */ + return SUCCESS; + } + if (result != op1) { + *result = *op1; + zval_copy_ctor(result); + } + zend_hash_merge(Z_ARRVAL_P(result), Z_ARRVAL_P(op2), (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); + return SUCCESS; + } + + default: + if (!converted) { + zendi_convert_scalar_to_number(op1, op1_copy, result); + zendi_convert_scalar_to_number(op2, op2_copy, result); + converted = 1; + } else { + zend_error(E_ERROR, "Unsupported operand types"); + return FAILURE; /* unknown datatype */ + } } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) + op2->value.dval) : - (op1->value.dval + ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval + op2->value.dval; - return SUCCESS; } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ } ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if (op1->type == IS_LONG && op2->type == IS_LONG) { - long lval = op1->value.lval - op2->value.lval; - - /* check for overflow by comparing sign bits */ - if ( (op1->value.lval & LONG_SIGN_MASK) != (op2->value.lval & LONG_SIGN_MASK) - && (op1->value.lval & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { - - result->value.dval = (double) op1->value.lval - (double) op2->value.lval; - result->type = IS_DOUBLE; - } else { - result->value.lval = lval; - result->type = IS_LONG; + int converted = 0; + + while (1) { + switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { + case TYPE_PAIR(IS_LONG, IS_LONG): { + long lval = Z_LVAL_P(op1) - Z_LVAL_P(op2); + + /* check for overflow by comparing sign bits */ + if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK) + && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { + + ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2)); + } else { + ZVAL_LONG(result, lval); + } + return SUCCESS; + + } + case TYPE_PAIR(IS_LONG, IS_DOUBLE): + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2)); + return SUCCESS; + + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2))); + return SUCCESS; + + case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): + ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2)); + return SUCCESS; + + default: + if (!converted) { + zendi_convert_scalar_to_number(op1, op1_copy, result); + zendi_convert_scalar_to_number(op2, op2_copy, result); + converted = 1; + } else { + zend_error(E_ERROR, "Unsupported operand types"); + return FAILURE; /* unknown datatype */ + } } - return SUCCESS; } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) - op2->value.dval) : - (op1->value.dval - ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval - op2->value.dval; - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ } ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); + int converted = 0; - if (op1->type == IS_LONG && op2->type == IS_LONG) { - long overflow; + while (1) { + switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { + case TYPE_PAIR(IS_LONG, IS_LONG): { + long overflow; - ZEND_SIGNED_MULTIPLY_LONG(op1->value.lval,op2->value.lval, result->value.lval,result->value.dval,overflow); - result->type = overflow ? IS_DOUBLE : IS_LONG; - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) * op2->value.dval) : - (op1->value.dval * ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval * op2->value.dval; - return SUCCESS; + ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), Z_LVAL_P(result),Z_DVAL_P(result),overflow); + Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG; + return SUCCESS; + + } + case TYPE_PAIR(IS_LONG, IS_DOUBLE): + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2)); + return SUCCESS; + + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2))); + return SUCCESS; + + case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): + ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2)); + return SUCCESS; + + default: + if (!converted) { + zendi_convert_scalar_to_number(op1, op1_copy, result); + zendi_convert_scalar_to_number(op2, op2_copy, result); + converted = 1; + } else { + zend_error(E_ERROR, "Unsupported operand types"); + return FAILURE; /* unknown datatype */ + } + } } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ } ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); + int converted = 0; + + while (1) { + switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { + case TYPE_PAIR(IS_LONG, IS_LONG): + if (Z_LVAL_P(op2) == 0) { + zend_error(E_WARNING, "Division by zero"); + ZVAL_BOOL(result, 0); + return FAILURE; /* division by zero */ + } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN) { + /* Prevent overflow error/crash */ + ZVAL_DOUBLE(result, (double) LONG_MIN / -1); + return SUCCESS; + } + if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */ + ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2)); + } else { + ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2)); + } + return SUCCESS; - if ((op2->type == IS_LONG && op2->value.lval == 0) || (op2->type == IS_DOUBLE && op2->value.dval == 0.0)) { - zend_error(E_WARNING, "Division by zero"); - ZVAL_BOOL(result, 0); - return FAILURE; /* division by zero */ - } - if (op1->type == IS_LONG && op2->type == IS_LONG) { - if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN) { - /* Prevent overflow error/crash */ - ZVAL_DOUBLE(result, (double) LONG_MIN / -1); - return SUCCESS; - } - if (op1->value.lval % op2->value.lval == 0) { /* integer */ - result->type = IS_LONG; - result->value.lval = op1->value.lval / op2->value.lval; - } else { - result->type = IS_DOUBLE; - result->value.dval = ((double) op1->value.lval) / op2->value.lval; + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + if (Z_LVAL_P(op2) == 0) { + zend_error(E_WARNING, "Division by zero"); + ZVAL_BOOL(result, 0); + return FAILURE; /* division by zero */ + } + ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_LVAL_P(op2)); + return SUCCESS; + + case TYPE_PAIR(IS_LONG, IS_DOUBLE): + if (Z_DVAL_P(op2) == 0) { + zend_error(E_WARNING, "Division by zero"); + ZVAL_BOOL(result, 0); + return FAILURE; /* division by zero */ + } + ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / Z_DVAL_P(op2)); + return SUCCESS; + + case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): + if (Z_DVAL_P(op2) == 0) { + zend_error(E_WARNING, "Division by zero"); + ZVAL_BOOL(result, 0); + return FAILURE; /* division by zero */ + } + ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2)); + return SUCCESS; + + default: + if (!converted) { + zendi_convert_scalar_to_number(op1, op1_copy, result); + zendi_convert_scalar_to_number(op2, op2_copy, result); + converted = 1; + } else { + zend_error(E_ERROR, "Unsupported operand types"); + return FAILURE; /* unknown datatype */ + } } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) / op2->value.dval) : - (op1->value.dval / ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval / op2->value.dval; - return SUCCESS; } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ } ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - + zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - if (op2->value.lval == 0) { + if (Z_LVAL_P(op2) == 0) { zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; /* modulus by zero */ } - if (op2->value.lval == -1) { + if (Z_LVAL_P(op2) == -1) { /* Prevent overflow error/crash if op1==LONG_MIN */ ZVAL_LONG(result, 0); return SUCCESS; } - result->type = IS_LONG; - result->value.lval = op1->value.lval % op2->value.lval; + ZVAL_LONG(result, Z_LVAL_P(op1) % Z_LVAL_P(op2)); return SUCCESS; } @@ -952,12 +981,10 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - - result->type = IS_BOOL; zendi_convert_to_boolean(op1, op1_copy, result); zendi_convert_to_boolean(op2, op2_copy, result); - result->value.lval = op1->value.lval ^ op2->value.lval; + ZVAL_BOOL(result, Z_LVAL_P(op1) ^ Z_LVAL_P(op2)); return SUCCESS; } @@ -965,11 +992,10 @@ ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) { zval op1_copy; - + zendi_convert_to_boolean(op1, op1_copy, result); - result->type = IS_BOOL; - result->value.lval = !op1->value.lval; + ZVAL_BOOL(result, !Z_LVAL_P(op1)); return SUCCESS; } @@ -977,26 +1003,23 @@ ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) { zval op1_copy = *op1; - + op1 = &op1_copy; - - if (op1->type == IS_DOUBLE) { - op1->value.lval = (long) op1->value.dval; - op1->type = IS_LONG; - } - if (op1->type == IS_LONG) { - result->value.lval = ~op1->value.lval; - result->type = IS_LONG; + + if (Z_TYPE_P(op1) == IS_LONG) { + ZVAL_LONG(result, ~Z_LVAL_P(op1)); return SUCCESS; - } - if (op1->type == IS_STRING) { + } else if (Z_TYPE_P(op1) == IS_DOUBLE) { + ZVAL_LONG(result, ~(long) Z_DVAL_P(op1)); + return SUCCESS; + } else if (Z_TYPE_P(op1) == IS_STRING) { int i; - result->type = IS_STRING; - result->value.str.val = estrndup(op1->value.str.val, op1->value.str.len); - result->value.str.len = op1->value.str.len; - for (i = 0; i < op1->value.str.len; i++) { - result->value.str.val[i] = ~op1->value.str.val[i]; + Z_TYPE_P(result) = IS_STRING; + Z_STRVAL_P(result) = estrndup(Z_STRVAL_P(op1), Z_STRLEN_P(op1)); + Z_STRLEN_P(result) = Z_STRLEN_P(op1); + for (i = 0; i < Z_STRLEN_P(op1); i++) { + Z_STRVAL_P(result)[i] = ~Z_STRVAL_P(op1)[i]; } return SUCCESS; } @@ -1008,13 +1031,13 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { + + if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; int i, result_len; - if (op1->value.str.len >= op2->value.str.len) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1022,24 +1045,23 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) shorter = op1; } - result->type = IS_STRING; - result_len = longer->value.str.len; - result_str = estrndup(longer->value.str.val, longer->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result_str[i] |= shorter->value.str.val[i]; + Z_TYPE_P(result) = IS_STRING; + result_len = Z_STRLEN_P(longer); + result_str = estrndup(Z_STRVAL_P(longer), Z_STRLEN_P(longer)); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { + result_str[i] |= Z_STRVAL_P(shorter)[i]; } if (result==op1) { - STR_FREE(result->value.str.val); + STR_FREE(Z_STRVAL_P(result)); } - result->value.str.val = result_str; - result->value.str.len = result_len; + Z_STRVAL_P(result) = result_str; + Z_STRLEN_P(result) = result_len; return SUCCESS; } zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - result->type = IS_LONG; - result->value.lval = op1->value.lval | op2->value.lval; + ZVAL_LONG(result, Z_LVAL_P(op1) | Z_LVAL_P(op2)); return SUCCESS; } @@ -1047,13 +1069,13 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { + + if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; int i, result_len; - if (op1->value.str.len >= op2->value.str.len) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1061,26 +1083,25 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) shorter = op1; } - result->type = IS_STRING; - result_len = shorter->value.str.len; - result_str = estrndup(shorter->value.str.val, shorter->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result_str[i] &= longer->value.str.val[i]; + Z_TYPE_P(result) = IS_STRING; + result_len = Z_STRLEN_P(shorter); + result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter)); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { + result_str[i] &= Z_STRVAL_P(longer)[i]; } if (result==op1) { - STR_FREE(result->value.str.val); + STR_FREE(Z_STRVAL_P(result)); } - result->value.str.val = result_str; - result->value.str.len = result_len; + Z_STRVAL_P(result) = result_str; + Z_STRLEN_P(result) = result_len; return SUCCESS; } - + zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - result->type = IS_LONG; - result->value.lval = op1->value.lval & op2->value.lval; + ZVAL_LONG(result, Z_LVAL_P(op1) & Z_LVAL_P(op2)); return SUCCESS; } @@ -1088,13 +1109,13 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { + + if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; int i, result_len; - if (op1->value.str.len >= op2->value.str.len) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1102,25 +1123,24 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) shorter = op1; } - result->type = IS_STRING; - result_len = shorter->value.str.len; - result_str = estrndup(shorter->value.str.val, shorter->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result_str[i] ^= longer->value.str.val[i]; + Z_TYPE_P(result) = IS_STRING; + result_len = Z_STRLEN_P(shorter); + result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter)); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { + result_str[i] ^= Z_STRVAL_P(longer)[i]; } if (result==op1) { - STR_FREE(result->value.str.val); + STR_FREE(Z_STRVAL_P(result)); } - result->value.str.val = result_str; - result->value.str.len = result_len; + Z_STRVAL_P(result) = result_str; + Z_STRLEN_P(result) = result_len; return SUCCESS; } zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); + zendi_convert_to_long(op2, op2_copy, result); - result->type = IS_LONG; - result->value.lval = op1->value.lval ^ op2->value.lval; + ZVAL_LONG(result, Z_LVAL_P(op1) ^ Z_LVAL_P(op2)); return SUCCESS; } @@ -1128,11 +1148,10 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - + zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - result->value.lval = op1->value.lval << op2->value.lval; - result->type = IS_LONG; + ZVAL_LONG(result, Z_LVAL_P(op1) << Z_LVAL_P(op2)); return SUCCESS; } @@ -1140,38 +1159,37 @@ ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - + zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - result->value.lval = op1->value.lval >> op2->value.lval; - result->type = IS_LONG; + ZVAL_LONG(result, Z_LVAL_P(op1) >> Z_LVAL_P(op2)); return SUCCESS; } /* must support result==op1 */ -ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2) +ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) { - result->value.str.len = op1->value.str.len + 1; - result->value.str.val = (char *) erealloc(op1->value.str.val, result->value.str.len+1); - result->value.str.val[result->value.str.len - 1] = (char) op2->value.lval; - result->value.str.val[result->value.str.len] = 0; - result->type = IS_STRING; + Z_STRLEN_P(result) = Z_STRLEN_P(op1) + 1; + Z_STRVAL_P(result) = (char *) erealloc(Z_STRVAL_P(op1), Z_STRLEN_P(result)+1); + Z_STRVAL_P(result)[Z_STRLEN_P(result) - 1] = (char) Z_LVAL_P(op2); + Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0; + Z_TYPE_P(result) = IS_STRING; return SUCCESS; } /* must support result==op1 */ -ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2) +ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) { - int length = op1->value.str.len + op2->value.str.len; + int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); - result->value.str.val = (char *) erealloc(op1->value.str.val, length+1); - memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[length] = 0; - result->value.str.len = length; - result->type = IS_STRING; + Z_STRVAL_P(result) = (char *) erealloc(Z_STRVAL_P(op1), length+1); + memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + Z_STRVAL_P(result)[length] = 0; + Z_STRLEN_P(result) = length; + Z_TYPE_P(result) = IS_STRING; return SUCCESS; } @@ -1181,10 +1199,10 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zval op1_copy, op2_copy; int use_copy1 = 0, use_copy2 = 0; - if (op1->type != IS_STRING) { + if (Z_TYPE_P(op1) != IS_STRING) { zend_make_printable_zval(op1, &op1_copy, &use_copy1); } - if (op2->type != IS_STRING) { + if (Z_TYPE_P(op2) != IS_STRING) { zend_make_printable_zval(op2, &op2_copy, &use_copy2); } @@ -1201,20 +1219,20 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) op2 = &op2_copy; } if (result==op1) { /* special case, perform operations on result */ - uint res_len = op1->value.str.len + op2->value.str.len; - - result->value.str.val = erealloc(result->value.str.val, res_len+1); + uint res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + + Z_STRVAL_P(result) = erealloc(Z_STRVAL_P(result), res_len+1); - memcpy(result->value.str.val+result->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[res_len]=0; - result->value.str.len = res_len; + memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(result), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + Z_STRVAL_P(result)[res_len]=0; + Z_STRLEN_P(result) = res_len; } else { - result->value.str.len = op1->value.str.len + op2->value.str.len; - result->value.str.val = (char *) emalloc(result->value.str.len + 1); - memcpy(result->value.str.val, op1->value.str.val, op1->value.str.len); - memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[result->value.str.len] = 0; - result->type = IS_STRING; + Z_STRLEN_P(result) = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + Z_STRVAL_P(result) = (char *) emalloc(Z_STRLEN_P(result) + 1); + memcpy(Z_STRVAL_P(result), Z_STRVAL_P(op1), Z_STRLEN_P(op1)); + memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0; + Z_TYPE_P(result) = IS_STRING; } if (use_copy1) { zval_dtor(op1); @@ -1231,10 +1249,10 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D zval op1_copy, op2_copy; int use_copy1 = 0, use_copy2 = 0; - if (op1->type != IS_STRING) { + if (Z_TYPE_P(op1) != IS_STRING) { zend_make_printable_zval(op1, &op1_copy, &use_copy1); } - if (op2->type != IS_STRING) { + if (Z_TYPE_P(op2) != IS_STRING) { zend_make_printable_zval(op2, &op2_copy, &use_copy2); } @@ -1245,8 +1263,7 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D op2 = &op2_copy; } - result->value.lval = zend_binary_zval_strcmp(op1, op2); - result->type = IS_LONG; + ZVAL_LONG(result, zend_binary_zval_strcmp(op1, op2)); if (use_copy1) { zval_dtor(op1); @@ -1263,10 +1280,10 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 T zval op1_copy, op2_copy; int use_copy1 = 0, use_copy2 = 0; - if (op1->type != IS_STRING) { + if (Z_TYPE_P(op1) != IS_STRING) { zend_make_printable_zval(op1, &op1_copy, &use_copy1); } - if (op2->type != IS_STRING) { + if (Z_TYPE_P(op2) != IS_STRING) { zend_make_printable_zval(op2, &op2_copy, &use_copy2); } @@ -1277,8 +1294,7 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 T op2 = &op2_copy; } - result->value.lval = strcoll(op1->value.str.val, op2->value.str.val); - result->type = IS_LONG; + ZVAL_LONG(result, strcoll(Z_STRVAL_P(op1), Z_STRVAL_P(op2))); if (use_copy1) { zval_dtor(op1); @@ -1309,151 +1325,177 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_ } -static inline void zend_free_obj_get_result(zval *op) +static inline void zend_free_obj_get_result(zval *op TSRMLS_DC) { - if (op) { - if (op->refcount == 0) { - zval_dtor(op); - FREE_ZVAL(op); - } else { - zval_ptr_dtor(&op); - } + if (Z_REFCOUNT_P(op) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(op); + zval_dtor(op); + FREE_ZVAL(op); + } else { + zval_ptr_dtor(&op); } } -#define COMPARE_RETURN_AND_FREE(retval) \ - zend_free_obj_get_result(op1_free); \ - zend_free_obj_get_result(op2_free); \ - return retval; - ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { + int ret; + int converted = 0; zval op1_copy, op2_copy; - zval *op1_free, *op2_free; - int op1_obj = Z_TYPE_P(op1) == IS_OBJECT; - int op2_obj = Z_TYPE_P(op2) == IS_OBJECT; - int eq_comp = op1_obj && op2_obj && (Z_OBJ_HANDLER_P(op1,compare_objects) - == Z_OBJ_HANDLER_P(op2,compare_objects)); - - if (op1_obj && !eq_comp) { - if (Z_TYPE_P(op2) == IS_NULL) { - ZVAL_LONG(result, 1); - return SUCCESS; - } else if (Z_OBJ_HT_P(op1)->get) { - op1 = op1_free = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC); - } else if (!op2_obj && Z_OBJ_HT_P(op1)->cast_object) { - ALLOC_INIT_ZVAL(op1_free); - if (Z_OBJ_HT_P(op1)->cast_object(op1, op1_free, Z_TYPE_P(op2) TSRMLS_CC) == FAILURE) { - op2_free = NULL; + zval *op_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)get) { - op2 = op2_free = Z_OBJ_HT_P(op2)->get(op2 TSRMLS_CC); - } else if (!op1_obj && Z_OBJ_HT_P(op2)->cast_object) { - ALLOC_INIT_ZVAL(op2_free); - if (Z_OBJ_HT_P(op2)->cast_object(op2, op2_free, Z_TYPE_P(op1) TSRMLS_CC) == FAILURE) { - ZVAL_LONG(result, -1); - COMPARE_RETURN_AND_FREE(SUCCESS); - } - op2 = op2_free; - } else { - op2_free = NULL; - } - op2_obj = Z_TYPE_P(op2) == IS_OBJECT; - eq_comp = op1_obj && op2_obj && (Z_OBJ_HANDLER_P(op1,compare_objects) - == Z_OBJ_HANDLER_P(op2,compare_objects)); - } else { - op2_free = NULL; - } - - if ((Z_TYPE_P(op1) == IS_NULL && Z_TYPE_P(op2) == IS_STRING) - || (Z_TYPE_P(op2) == IS_NULL && Z_TYPE_P(op1) == IS_STRING)) { - if (Z_TYPE_P(op1) == IS_NULL) { - ZVAL_LONG(result, zend_binary_strcmp("", 0, Z_STRVAL_P(op2), Z_STRLEN_P(op2))); - COMPARE_RETURN_AND_FREE(SUCCESS); - } else { - ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), "", 0)); - COMPARE_RETURN_AND_FREE(SUCCESS); - } - } - - if (op1->type == IS_STRING && op2->type == IS_STRING) { - zendi_smart_strcmp(result, op1, op2); - COMPARE_RETURN_AND_FREE(SUCCESS); - } - - if (Z_TYPE_P(op1) == IS_BOOL || Z_TYPE_P(op2) == IS_BOOL - || Z_TYPE_P(op1) == IS_NULL || Z_TYPE_P(op2) == IS_NULL) { - zendi_convert_to_boolean(op1, op1_copy, result); - zendi_convert_to_boolean(op2, op2_copy, result); - ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); - COMPARE_RETURN_AND_FREE(SUCCESS); - } + return SUCCESS; - /* If both are objects sharing the same comparision handler then use is */ - if (eq_comp) { - if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) { - /* object handles are identical, apprently this is the same object */ - ZVAL_LONG(result, 0); - COMPARE_RETURN_AND_FREE(SUCCESS); + case TYPE_PAIR(IS_NULL, IS_OBJECT): + ZVAL_LONG(result, -1); + return SUCCESS; + + case TYPE_PAIR(IS_OBJECT, IS_OBJECT): + /* If both are objects sharing the same comparision handler then use is */ + if (Z_OBJ_HANDLER_P(op1,compare_objects) == Z_OBJ_HANDLER_P(op2,compare_objects)) { + if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) { + /* object handles are identical, apprently this is the same object */ + ZVAL_LONG(result, 0); + return SUCCESS; + } + ZVAL_LONG(result, Z_OBJ_HT_P(op1)->compare_objects(op1, op2 TSRMLS_CC)); + return SUCCESS; + } + /* break missing intentionally */ + + default: + if (Z_TYPE_P(op1) == IS_OBJECT) { + if (Z_OBJ_HT_P(op1)->get) { + op_free = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC); + ret = compare_function(result, op_free, op2 TSRMLS_CC); + zend_free_obj_get_result(op_free TSRMLS_CC); + return ret; + } else if (Z_TYPE_P(op2) != IS_OBJECT && + Z_OBJ_HT_P(op1)->cast_object) { + ALLOC_INIT_ZVAL(op_free); + if (Z_OBJ_HT_P(op1)->cast_object(op1, op_free, Z_TYPE_P(op2) TSRMLS_CC) == FAILURE) { + ZVAL_LONG(result, 1); + zend_free_obj_get_result(op_free TSRMLS_CC); + return SUCCESS; + } + ret = compare_function(result, op_free, op2 TSRMLS_CC); + zend_free_obj_get_result(op_free TSRMLS_CC); + return ret; + } + } + if (Z_TYPE_P(op2) == IS_OBJECT) { + if (Z_OBJ_HT_P(op2)->get) { + op_free = Z_OBJ_HT_P(op2)->get(op2 TSRMLS_CC); + ret = compare_function(result, op1, op_free TSRMLS_CC); + zend_free_obj_get_result(op_free TSRMLS_CC); + return ret; + } else if (Z_TYPE_P(op1) != IS_OBJECT && + Z_OBJ_HT_P(op2)->cast_object) { + ALLOC_INIT_ZVAL(op_free); + if (Z_OBJ_HT_P(op2)->cast_object(op2, op_free, Z_TYPE_P(op1) TSRMLS_CC) == FAILURE) { + ZVAL_LONG(result, -1); + zend_free_obj_get_result(op_free TSRMLS_CC); + return SUCCESS; + } + ret = compare_function(result, op1, op_free TSRMLS_CC); + zend_free_obj_get_result(op_free TSRMLS_CC); + return ret; + } + } + if (!converted) { + if (Z_TYPE_P(op1) == IS_NULL) { + zendi_convert_to_boolean(op2, op2_copy, result); + ZVAL_LONG(result, Z_LVAL_P(op2) ? -1 : 0); + return SUCCESS; + } else if (Z_TYPE_P(op2) == IS_NULL) { + zendi_convert_to_boolean(op1, op1_copy, result); + ZVAL_LONG(result, Z_LVAL_P(op1) ? 1 : 0); + return SUCCESS; + } else if (Z_TYPE_P(op1) == IS_BOOL) { + zendi_convert_to_boolean(op2, op2_copy, result); + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); + return SUCCESS; + } else if (Z_TYPE_P(op2) == IS_BOOL) { + zendi_convert_to_boolean(op1, op1_copy, result); + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); + return SUCCESS; + } else { + zendi_convert_scalar_to_number(op1, op1_copy, result); + zendi_convert_scalar_to_number(op2, op2_copy, result); + converted = 1; + } + } else if (Z_TYPE_P(op1)==IS_ARRAY) { + ZVAL_LONG(result, 1); + return SUCCESS; + } else if (Z_TYPE_P(op2)==IS_ARRAY) { + ZVAL_LONG(result, -1); + return SUCCESS; + } else if (Z_TYPE_P(op1)==IS_OBJECT) { + ZVAL_LONG(result, 1); + return SUCCESS; + } else if (Z_TYPE_P(op2)==IS_OBJECT) { + ZVAL_LONG(result, -1); + return SUCCESS; + } else { + ZVAL_LONG(result, 0); + return FAILURE; + } } - ZVAL_LONG(result, Z_OBJ_HT_P(op1)->compare_objects(op1, op2 TSRMLS_CC)); - COMPARE_RETURN_AND_FREE(SUCCESS); - } - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_LONG) { - ZVAL_LONG(result, Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)type = IS_BOOL; - if (op1->type != op2->type) { - result->value.lval = 0; + Z_TYPE_P(result) = IS_BOOL; + if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { + Z_LVAL_P(result) = 0; return SUCCESS; } - switch (op1->type) { + switch (Z_TYPE_P(op1)) { case IS_NULL: - result->value.lval = (op2->type==IS_NULL); + Z_LVAL_P(result) = 1; break; case IS_BOOL: case IS_LONG: case IS_RESOURCE: - result->value.lval = (op1->value.lval == op2->value.lval); + Z_LVAL_P(result) = (Z_LVAL_P(op1) == Z_LVAL_P(op2)); break; case IS_DOUBLE: - result->value.lval = (op1->value.dval == op2->value.dval); + Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2)); break; case IS_STRING: - if ((op1->value.str.len == op2->value.str.len) - && (!memcmp(op1->value.str.val, op2->value.str.val, op1->value.str.len))) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } + Z_LVAL_P(result) = ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) + && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); break; case IS_ARRAY: - if (zend_hash_compare(op1->value.ht, op2->value.ht, (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } + Z_LVAL_P(result) = zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0; break; case IS_OBJECT: if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { - if (EG(ze1_compatibility_mode)) { - zend_compare_objects(result, op1, op2 TSRMLS_CC); - /* comparison returns 0 in case of equality and - * 1 in case of ineqaulity, we need to reverse it - */ - result->value.lval = !result->value.lval; - } else { - result->value.lval = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)); - } + Z_LVAL_P(result) = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)); } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } break; default: - ZVAL_BOOL(result, 0); + Z_LVAL_P(result) = 0; return FAILURE; } return SUCCESS; @@ -1533,11 +1559,10 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - result->type = IS_BOOL; if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - result->value.lval = !result->value.lval; + Z_LVAL_P(result) = !Z_LVAL_P(result); return SUCCESS; } @@ -1547,12 +1572,7 @@ ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - convert_to_boolean(result); - if (result->value.lval == 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); return SUCCESS; } @@ -1562,12 +1582,7 @@ ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - convert_to_boolean(result); - if (result->value.lval) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); return SUCCESS; } @@ -1577,26 +1592,8 @@ ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - if (result->type == IS_LONG) { - result->type = IS_BOOL; - if (result->value.lval < 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - if (result->type == IS_DOUBLE) { - result->type = IS_BOOL; - if (result->value.dval < 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); + return SUCCESS; } @@ -1605,30 +1602,12 @@ ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSR if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - if (result->type == IS_LONG) { - result->type = IS_BOOL; - if (result->value.lval <= 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - if (result->type == IS_DOUBLE) { - result->type = IS_BOOL; - if (result->value.dval <= 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); + return SUCCESS; } -ZEND_API zend_bool instanceof_function_ex(zend_class_entry *instance_ce, zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC) +ZEND_API zend_bool instanceof_function_ex(const zend_class_entry *instance_ce, const zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC) { zend_uint i; @@ -1649,7 +1628,7 @@ ZEND_API zend_bool instanceof_function_ex(zend_class_entry *instance_ce, zend_cl return 0; } -ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class_entry *ce TSRMLS_DC) +ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, const zend_class_entry *ce TSRMLS_DC) { return instanceof_function_ex(instance_ce, ce, 0 TSRMLS_CC); } @@ -1662,16 +1641,16 @@ ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class static void increment_string(zval *str) { int carry=0; - int pos=str->value.str.len-1; - char *s=str->value.str.val; + int pos=Z_STRLEN_P(str)-1; + char *s=Z_STRVAL_P(str); char *t; int last=0; /* Shut up the compiler warning */ int ch; - - if (str->value.str.len == 0) { - STR_FREE(str->value.str.val); - str->value.str.val = estrndup("1", sizeof("1")-1); - str->value.str.len = 1; + + if (Z_STRLEN_P(str) == 0) { + STR_FREE(Z_STRVAL_P(str)); + Z_STRVAL_P(str) = estrndup("1", sizeof("1")-1); + Z_STRLEN_P(str) = 1; return; } @@ -1715,10 +1694,10 @@ static void increment_string(zval *str) } if (carry) { - t = (char *) emalloc(str->value.str.len+1+1); - memcpy(t+1, str->value.str.val, str->value.str.len); - str->value.str.len++; - t[str->value.str.len] = '\0'; + t = (char *) emalloc(Z_STRLEN_P(str)+1+1); + memcpy(t+1, Z_STRVAL_P(str), Z_STRLEN_P(str)); + Z_STRLEN_P(str)++; + t[Z_STRLEN_P(str)] = '\0'; switch (last) { case NUMERIC: t[0] = '1'; @@ -1730,52 +1709,48 @@ static void increment_string(zval *str) t[0] = 'a'; break; } - STR_FREE(str->value.str.val); - str->value.str.val = t; + STR_FREE(Z_STRVAL_P(str)); + Z_STRVAL_P(str) = t; } } ZEND_API int increment_function(zval *op1) { - switch (op1->type) { + switch (Z_TYPE_P(op1)) { case IS_LONG: - if (op1->value.lval == LONG_MAX) { + if (Z_LVAL_P(op1) == LONG_MAX) { /* switch to double */ - double d = (double)op1->value.lval; + double d = (double)Z_LVAL_P(op1); ZVAL_DOUBLE(op1, d+1); } else { - op1->value.lval++; - } + Z_LVAL_P(op1)++; + } break; case IS_DOUBLE: - op1->value.dval = op1->value.dval + 1; + Z_DVAL_P(op1) = Z_DVAL_P(op1) + 1; break; case IS_NULL: - op1->value.lval = 1; - op1->type = IS_LONG; + ZVAL_LONG(op1, 1); break; case IS_STRING: { long lval; double dval; - char *strval = op1->value.str.val; - switch (is_numeric_string(strval, op1->value.str.len, &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { case IS_LONG: + efree(Z_STRVAL_P(op1)); if (lval == LONG_MAX) { /* switch to double */ double d = (double)lval; ZVAL_DOUBLE(op1, d+1); } else { - op1->value.lval = lval+1; - op1->type = IS_LONG; + ZVAL_LONG(op1, lval+1); } - efree(strval); /* should never be empty_string */ break; case IS_DOUBLE: - op1->value.dval = dval+1; - op1->type = IS_DOUBLE; - efree(strval); /* should never be empty_string */ + efree(Z_STRVAL_P(op1)); + ZVAL_DOUBLE(op1, dval+1); break; default: /* Perl style string increment */ @@ -1795,41 +1770,38 @@ ZEND_API int decrement_function(zval *op1) { long lval; double dval; - - switch (op1->type) { + + switch (Z_TYPE_P(op1)) { case IS_LONG: - if (op1->value.lval == LONG_MIN) { - double d = (double)op1->value.lval; + if (Z_LVAL_P(op1) == LONG_MIN) { + double d = (double)Z_LVAL_P(op1); ZVAL_DOUBLE(op1, d-1); } else { - op1->value.lval--; + Z_LVAL_P(op1)--; } break; case IS_DOUBLE: - op1->value.dval = op1->value.dval - 1; + Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1; break; case IS_STRING: /* Like perl we only support string increment */ - if (op1->value.str.len == 0) { /* consider as 0 */ - STR_FREE(op1->value.str.val); - op1->value.lval = -1; - op1->type = IS_LONG; + if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ + STR_FREE(Z_STRVAL_P(op1)); + ZVAL_LONG(op1, -1); break; } - switch (is_numeric_string(op1->value.str.val, op1->value.str.len, &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { case IS_LONG: - STR_FREE(op1->value.str.val); + STR_FREE(Z_STRVAL_P(op1)); if (lval == LONG_MIN) { double d = (double)lval; ZVAL_DOUBLE(op1, d-1); } else { - op1->value.lval = lval-1; - op1->type = IS_LONG; + ZVAL_LONG(op1, lval-1); } break; case IS_DOUBLE: - STR_FREE(op1->value.str.val); - op1->value.dval = dval - 1; - op1->type = IS_DOUBLE; + STR_FREE(Z_STRVAL_P(op1)); + ZVAL_DOUBLE(op1, dval - 1); break; } break; @@ -1844,7 +1816,7 @@ ZEND_API int decrement_function(zval *op1) ZEND_API int zval_is_true(zval *op) { convert_to_boolean(op); - return (op->value.lval ? 1 : 0); + return (Z_LVAL_P(op) ? 1 : 0); } #ifdef ZEND_USE_TOLOWER_L @@ -1867,7 +1839,7 @@ ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned in return dest; } - + ZEND_API void zend_str_tolower(char *str, unsigned int length) { register unsigned char *p = (unsigned char*)str; @@ -1879,10 +1851,10 @@ ZEND_API void zend_str_tolower(char *str, unsigned int length) } } -ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2) +ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint len2) { int retval; - + retval = memcmp(s1, s2, MIN(len1, len2)); if (!retval) { return (len1 - len2); @@ -1891,10 +1863,10 @@ ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2) } } -ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length) +ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length) { int retval; - + retval = memcmp(s1, s2, MIN(length, MIN(len1, len2))); if (!retval) { return (MIN(length, len1) - MIN(length, len2)); @@ -1904,7 +1876,7 @@ ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint } -ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2) +ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, uint len2) { int len; int c1, c2; @@ -1923,7 +1895,7 @@ ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2) } -ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length) +ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length) { int len; int c1, c2; @@ -1944,24 +1916,24 @@ ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, u ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) { - return zend_binary_strcmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len); + return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) { - return zend_binary_strncmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval); + return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) { - return zend_binary_strcasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len); + return zend_binary_strcasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) { - return zend_binary_strncasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval); + return zend_binary_strncasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } @@ -1970,9 +1942,9 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) int ret1, ret2; long lval1, lval2; double dval1, dval2; - - if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1, 0)) && - (ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2, 0))) { + + if ((ret1=is_numeric_string(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0)) && + (ret2=is_numeric_string(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0))) { if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) { if (ret1!=IS_DOUBLE) { dval1 = (double) lval1; @@ -1983,20 +1955,17 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) * so a numeric comparison would be inaccurate */ goto string_cmp; } - result->value.dval = dval1 - dval2; - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval); - result->type = IS_LONG; + Z_DVAL_P(result) = dval1 - dval2; + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); } else { /* they both have to be long's */ - result->value.lval = lval1 > lval2 ? 1 : (lval1 < lval2 ? -1 : 0); - result->type = IS_LONG; + ZVAL_LONG(result, lval1 > lval2 ? 1 : (lval1 < lval2 ? -1 : 0)); } } else { string_cmp: - result->value.lval = zend_binary_zval_strcmp(s1, s2); - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval); - result->type = IS_LONG; + Z_LVAL_P(result) = zend_binary_zval_strcmp(s1, s2); + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(result))); } - return; + return; } @@ -2019,30 +1988,29 @@ ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_ ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) { - result->type = IS_LONG; - result->value.lval = zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); + ZVAL_LONG(result, zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC)); } ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC) { - zend_compare_symbol_tables(result, a1->value.ht, a2->value.ht TSRMLS_CC); + zend_compare_symbol_tables(result, Z_ARRVAL_P(a1), Z_ARRVAL_P(a2) TSRMLS_CC); } ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) { - result->type = IS_LONG; + Z_TYPE_P(result) = IS_LONG; if (Z_OBJ_HANDLE_P(o1) == Z_OBJ_HANDLE_P(o2)) { - result->value.lval = 0; + Z_LVAL_P(result) = 0; return; } if (Z_OBJ_HT_P(o1)->compare_objects == NULL) { - result->value.lval = 1; + Z_LVAL_P(result) = 1; } else { - result->value.lval = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC); + Z_LVAL_P(result) = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC); } } @@ -2050,7 +2018,7 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) { TSRMLS_FETCH(); - op->value.str.len = zend_spprintf(&op->value.str.val, 0, "%.*G", (int) EG(precision), (double)op->value.dval); + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op)); } /* diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 41ec72622..35ebc86e1 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.h,v 1.94.2.4.2.15 2009/02/15 14:31:17 iliaa Exp $ */ +/* $Id: zend_operators.h,v 1.94.2.4.2.10.2.14 2009/03/18 01:08:12 mattwil Exp $ */ #ifndef ZEND_OPERATORS_H #define ZEND_OPERATORS_H @@ -36,18 +36,6 @@ #include "ext/bcmath/libbcmath/src/bcmath.h" #endif -#if SIZEOF_LONG == 4 -#define MAX_LENGTH_OF_LONG 11 -static const char long_min_digits[] = "2147483648"; -#elif SIZEOF_LONG == 8 -#define MAX_LENGTH_OF_LONG 20 -static const char long_min_digits[] = "9223372036854775808"; -#else -#error "Unknown SIZEOF_LONG" -#endif - -#define MAX_LENGTH_OF_DOUBLE 32 - BEGIN_EXTERN_C() ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); @@ -71,10 +59,44 @@ ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API zend_bool instanceof_function_ex(zend_class_entry *instance_ce, zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC); -ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class_entry *ce TSRMLS_DC); +ZEND_API zend_bool instanceof_function_ex(const zend_class_entry *instance_ce, const zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC); +ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, const zend_class_entry *ce TSRMLS_DC); END_EXTERN_C() +#define MAX_UNSIGNED_INT ((double) LONG_MAX * 2) + 1 +#ifdef _WIN64 +# define DVAL_TO_LVAL(d, l) \ + if ((d) > LONG_MAX) { \ + (l) = (long)(unsigned long)(__int64) (d); \ + } else { \ + (l) = (long) (d); \ + } +#elif !defined(_WIN64) && __WORDSIZE == 64 +# define DVAL_TO_LVAL(d, l) \ + if ((d) >= LONG_MAX) { \ + (l) = LONG_MAX; \ + } else if ((d) <= LONG_MIN) { \ + (l) = LONG_MIN; \ + } else {\ + (l) = (long) (d); \ + } +#else +# define DVAL_TO_LVAL(d, l) \ + if ((d) > LONG_MAX) { \ + if ((d) > MAX_UNSIGNED_INT) { \ + (l) = LONG_MAX; \ + } else { \ + (l) = (unsigned long) (d); \ + } \ + } else { \ + if((d) < LONG_MIN) { \ + (l) = LONG_MIN; \ + } else { \ + (l) = (long) (d); \ + } \ + } +#endif + #define ZEND_IS_DIGIT(c) ((c) >= '0' && (c) <= '9') #define ZEND_IS_XDIGIT(c) (((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f')) @@ -220,9 +242,14 @@ zend_memnstr(char *haystack, char *needle, int needle_len, char *end) char *p = haystack; char ne = needle[needle_len-1]; + if (needle_len == 1) { + return (char *)memchr(p, *needle, (end-p)); + } + if(needle_len > end-haystack) { return NULL; } + end -= needle_len; while (p <= end) { @@ -275,8 +302,8 @@ ZEND_API void convert_to_object(zval *op); ZEND_API void multi_convert_to_long_ex(int argc, ...); ZEND_API void multi_convert_to_double_ex(int argc, ...); ZEND_API void multi_convert_to_string_ex(int argc, ...); -ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2); -ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2); +ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2); +ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2); #define convert_to_string(op) if ((op)->type != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); } ZEND_API double zend_string_to_double(const char *number, zend_uint length); @@ -304,10 +331,10 @@ ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2); ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2); ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); -ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2); -ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length); -ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2); -ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length); +ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint len2); +ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length); +ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, uint len2); +ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length); ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC); @@ -315,6 +342,7 @@ ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC); ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC); ZEND_API int zend_atoi(const char *str, int str_len); +ZEND_API long zend_atol(const char *str, int str_len); ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC); END_EXTERN_C() @@ -370,7 +398,7 @@ END_EXTERN_C() #define convert_scalar_to_number_ex(ppzv) \ if (Z_TYPE_PP(ppzv)!=IS_LONG && Z_TYPE_PP(ppzv)!=IS_DOUBLE) { \ - if (!(*ppzv)->is_ref) { \ + if (!Z_ISREF_PP(ppzv)) { \ SEPARATE_ZVAL(ppzv); \ } \ convert_scalar_to_number(*ppzv TSRMLS_CC); \ @@ -390,6 +418,7 @@ END_EXTERN_C() #define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC) #define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf #define Z_RESVAL(zval) (zval).value.lval +#define Z_OBJDEBUG(zval,is_tmp) (Z_OBJ_HANDLER((zval),get_debug_info)?Z_OBJ_HANDLER((zval),get_debug_info)(&(zval),&is_tmp TSRMLS_CC):(is_tmp=0,Z_OBJ_HANDLER((zval),get_properties)?Z_OBJPROP(zval):NULL)) #define Z_LVAL_P(zval_p) Z_LVAL(*zval_p) #define Z_BVAL_P(zval_p) Z_BVAL(*zval_p) @@ -404,6 +433,7 @@ END_EXTERN_C() #define Z_OBJ_HANDLE_P(zval_p) Z_OBJ_HANDLE(*zval_p) #define Z_OBJ_HT_P(zval_p) Z_OBJ_HT(*zval_p) #define Z_OBJ_HANDLER_P(zval_p, h) Z_OBJ_HANDLER(*zval_p, h) +#define Z_OBJDEBUG_P(zval_p,is_tmp) Z_OBJDEBUG(*zval_p,is_tmp) #define Z_LVAL_PP(zval_pp) Z_LVAL(**zval_pp) #define Z_BVAL_PP(zval_pp) Z_BVAL(**zval_pp) @@ -418,6 +448,7 @@ END_EXTERN_C() #define Z_OBJ_HANDLE_PP(zval_p) Z_OBJ_HANDLE(**zval_p) #define Z_OBJ_HT_PP(zval_p) Z_OBJ_HT(**zval_p) #define Z_OBJ_HANDLER_PP(zval_p, h) Z_OBJ_HANDLER(**zval_p, h) +#define Z_OBJDEBUG_PP(zval_pp,is_tmp) Z_OBJDEBUG(**zval_pp,is_tmp) #define Z_TYPE(zval) (zval).type #define Z_TYPE_P(zval_p) Z_TYPE(*zval_p) diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c index 74150e052..54296c740 100644 --- a/Zend/zend_ptr_stack.c +++ b/Zend/zend_ptr_stack.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ptr_stack.c,v 1.23.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_ptr_stack.c,v 1.23.2.1.2.1.2.3 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" #include "zend_ptr_stack.h" @@ -25,11 +25,17 @@ # include #endif -ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack) +ZEND_API void zend_ptr_stack_init_ex(zend_ptr_stack *stack, zend_bool persistent) { - stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE); + stack->top_element = stack->elements = (void **) pemalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE, persistent); stack->max = PTR_STACK_BLOCK_SIZE; stack->top = 0; + stack->persistent = persistent; +} + +ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack) +{ + zend_ptr_stack_init_ex(stack, 0); } @@ -71,7 +77,7 @@ ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...) ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack) { if (stack->elements) { - efree(stack->elements); + pefree(stack->elements, stack->persistent); } } @@ -93,7 +99,7 @@ ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), int i = stack->top; while (--i >= 0) { - efree(stack->elements[i]); + pefree(stack->elements[i], stack->persistent); } } stack->top = 0; diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h index 09274562c..9df4490da 100644 --- a/Zend/zend_ptr_stack.h +++ b/Zend/zend_ptr_stack.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ptr_stack.h,v 1.22.2.2.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_ptr_stack.h,v 1.22.2.2.2.1.2.3 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_PTR_STACK_H #define ZEND_PTR_STACK_H @@ -26,6 +26,7 @@ typedef struct _zend_ptr_stack { int top, max; void **elements; void **top_element; + zend_bool persistent; } zend_ptr_stack; @@ -33,6 +34,7 @@ typedef struct _zend_ptr_stack { BEGIN_EXTERN_C() ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack); +ZEND_API void zend_ptr_stack_init_ex(zend_ptr_stack *stack, zend_bool persistent); ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...); ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...); ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack); @@ -46,7 +48,7 @@ END_EXTERN_C() /* we need to allocate more memory */ \ stack->max *= 2; \ stack->max += count; \ - stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max))); \ + stack->elements = (void **) perealloc(stack->elements, (sizeof(void *) * (stack->max)), stack->persistent); \ stack->top_element = stack->elements+stack->top; \ } diff --git a/Zend/zend_qsort.c b/Zend/zend_qsort.c index bc2a6522a..33c2d12cc 100644 --- a/Zend/zend_qsort.c +++ b/Zend/zend_qsort.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_qsort.c,v 1.8.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_qsort.c,v 1.8.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" diff --git a/Zend/zend_qsort.h b/Zend/zend_qsort.h index 920605911..b2981d828 100644 --- a/Zend/zend_qsort.h +++ b/Zend/zend_qsort.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_qsort.h,v 1.8.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_qsort.h,v 1.8.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_QSORT_H #define ZEND_QSORT_H diff --git a/Zend/zend_sprintf.c b/Zend/zend_sprintf.c index f415ee48d..e6a871833 100644 --- a/Zend/zend_sprintf.c +++ b/Zend/zend_sprintf.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_sprintf.c,v 1.16.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_sprintf.c,v 1.16.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #include diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c index 478ed8288..688aced3c 100644 --- a/Zend/zend_stack.c +++ b/Zend/zend_stack.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_stack.c,v 1.16.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_stack.c,v 1.16.2.1.2.1.2.4 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend.h" #include "zend_stack.h" @@ -34,7 +34,7 @@ ZEND_API int zend_stack_init(zend_stack *stack) } } -ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size) +ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size) { if (stack->top >= stack->max) { /* we need to allocate more memory */ stack->elements = (void **) erealloc(stack->elements, @@ -49,7 +49,7 @@ ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size) } -ZEND_API int zend_stack_top(zend_stack *stack, void **element) +ZEND_API int zend_stack_top(const zend_stack *stack, void **element) { if (stack->top > 0) { *element = stack->elements[stack->top - 1]; @@ -70,7 +70,7 @@ ZEND_API int zend_stack_del_top(zend_stack *stack) } -ZEND_API int zend_stack_int_top(zend_stack *stack) +ZEND_API int zend_stack_int_top(const zend_stack *stack) { int *e; @@ -82,7 +82,7 @@ ZEND_API int zend_stack_int_top(zend_stack *stack) } -ZEND_API int zend_stack_is_empty(zend_stack *stack) +ZEND_API int zend_stack_is_empty(const zend_stack *stack) { if (stack->top == 0) { return 1; @@ -94,26 +94,27 @@ ZEND_API int zend_stack_is_empty(zend_stack *stack) ZEND_API int zend_stack_destroy(zend_stack *stack) { - register int i; - - for (i = 0; i < stack->top; i++) { - efree(stack->elements[i]); - } + int i; if (stack->elements) { + for (i = 0; i < stack->top; i++) { + efree(stack->elements[i]); + } + efree(stack->elements); } + return SUCCESS; } -ZEND_API void **zend_stack_base(zend_stack *stack) +ZEND_API void **zend_stack_base(const zend_stack *stack) { return stack->elements; } -ZEND_API int zend_stack_count(zend_stack *stack) +ZEND_API int zend_stack_count(const zend_stack *stack) { return stack->top; } diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h index b159d1f33..8c8adf279 100644 --- a/Zend/zend_stack.h +++ b/Zend/zend_stack.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_stack.h,v 1.19.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_stack.h,v 1.19.2.1.2.1.2.3 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_STACK_H #define ZEND_STACK_H @@ -32,14 +32,14 @@ typedef struct _zend_stack { BEGIN_EXTERN_C() ZEND_API int zend_stack_init(zend_stack *stack); -ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size); -ZEND_API int zend_stack_top(zend_stack *stack, void **element); +ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size); +ZEND_API int zend_stack_top(const zend_stack *stack, void **element); ZEND_API int zend_stack_del_top(zend_stack *stack); -ZEND_API int zend_stack_int_top(zend_stack *stack); -ZEND_API int zend_stack_is_empty(zend_stack *stack); +ZEND_API int zend_stack_int_top(const zend_stack *stack); +ZEND_API int zend_stack_is_empty(const zend_stack *stack); ZEND_API int zend_stack_destroy(zend_stack *stack); -ZEND_API void **zend_stack_base(zend_stack *stack); -ZEND_API int zend_stack_count(zend_stack *stack); +ZEND_API void **zend_stack_base(const zend_stack *stack); +ZEND_API int zend_stack_count(const zend_stack *stack); ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element)); ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg); END_EXTERN_C() diff --git a/Zend/zend_static_allocator.c b/Zend/zend_static_allocator.c index 68403adc7..a0c0ddf2c 100644 --- a/Zend/zend_static_allocator.c +++ b/Zend/zend_static_allocator.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_static_allocator.c,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_static_allocator.c,v 1.13.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #include "zend_static_allocator.h" diff --git a/Zend/zend_static_allocator.h b/Zend/zend_static_allocator.h index 465179dfc..e037a4399 100644 --- a/Zend/zend_static_allocator.h +++ b/Zend/zend_static_allocator.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_static_allocator.h,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_static_allocator.h,v 1.13.2.1.2.1.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_STATIC_ALLOCATOR_H #define ZEND_STATIC_ALLOCATOR_H diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 19cd9bb26..ff8a5d25b 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -5,7 +5,7 @@ | Copyright (c) 1998-2009 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 | + | 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 | @@ -13,94 +13,132 @@ | license@zend.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Wez Furlong | + | Scott MacVicar | + | Nuno Lopes | + | Marcus Boerger | +----------------------------------------------------------------------+ */ -/* $Id: zend_stream.c,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_stream.c,v 1.13.2.1.2.1.2.10 2009/01/28 23:18:49 nlopess Exp $ */ #include "zend.h" #include "zend_compile.h" +#include +#include +#if HAVE_SYS_MMAN_H +# include +#endif + ZEND_DLIMPORT int isatty(int fd); -static size_t zend_stream_stdio_reader(void *handle, char *buf, size_t len TSRMLS_DC) +static size_t zend_stream_stdio_reader(void *handle, char *buf, size_t len TSRMLS_DC) /* {{{ */ { return fread(buf, 1, len, (FILE*)handle); -} +} /* }}} */ -static void zend_stream_stdio_closer(void *handle TSRMLS_DC) +static void zend_stream_stdio_closer(void *handle TSRMLS_DC) /* {{{ */ { - if ((FILE*)handle != stdin) + if (handle && (FILE*)handle != stdin) { fclose((FILE*)handle); -} + } +} /* }}} */ -static long zend_stream_stdio_fteller(void *handle TSRMLS_DC) +static size_t zend_stream_stdio_fsizer(void *handle TSRMLS_DC) /* {{{ */ { - return ftell((FILE*) handle); -} + struct stat buf; + if (handle && fstat(fileno((FILE*)handle), &buf) == 0) { +#ifdef S_ISREG + if (!S_ISREG(buf.st_mode)) { + return 0; + } +#endif + return buf.st_size; + } + return 0; +} /* }}} */ + +static void zend_stream_unmap(zend_stream *stream TSRMLS_DC) { /* {{{ */ +#if HAVE_MMAP + if (stream->mmap.map) { + munmap(stream->mmap.map, stream->mmap.len); + } else +#endif + if (stream->mmap.buf) { + efree(stream->mmap.buf); + } + stream->mmap.len = 0; + stream->mmap.pos = 0; + stream->mmap.map = 0; + stream->mmap.buf = 0; + stream->handle = stream->mmap.old_handle; +} /* }}} */ + +static void zend_stream_mmap_closer(zend_stream *stream TSRMLS_DC) /* {{{ */ +{ + zend_stream_unmap(stream TSRMLS_CC); + if (stream->mmap.old_closer && stream->handle) { + stream->mmap.old_closer(stream->handle TSRMLS_CC); + } +} /* }}} */ +static inline int zend_stream_is_mmap(zend_file_handle *file_handle) { /* {{{ */ + return file_handle->type == ZEND_HANDLE_MAPPED; +} /* }}} */ -ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC) +static size_t zend_stream_fsize(zend_file_handle *file_handle TSRMLS_DC) /* {{{ */ +{ + struct stat buf; + + if (zend_stream_is_mmap(file_handle)) { + return file_handle->handle.stream.mmap.len; + } + if (file_handle->type == ZEND_HANDLE_STREAM || file_handle->type == ZEND_HANDLE_MAPPED) { + return file_handle->handle.stream.fsizer(file_handle->handle.stream.handle TSRMLS_CC); + } + if (file_handle->handle.fp && fstat(fileno(file_handle->handle.fp), &buf) == 0) { +#ifdef S_ISREG + if (!S_ISREG(buf.st_mode)) { + return 0; + } +#endif + return buf.st_size; + } + + return -1; +} /* }}} */ + +ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC) /* {{{ */ { if (zend_stream_open_function) { return zend_stream_open_function(filename, handle TSRMLS_CC); } handle->type = ZEND_HANDLE_FP; handle->opened_path = NULL; - handle->handle.fp = zend_fopen(filename, &handle->opened_path); + handle->handle.fp = zend_fopen(filename, &handle->opened_path TSRMLS_CC); handle->filename = (char *)filename; handle->free_filename = 0; + memset(&handle->handle.stream.mmap, 0, sizeof(zend_mmap)); return (handle->handle.fp) ? SUCCESS : FAILURE; -} +} /* }}} */ -ZEND_API int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC) +static int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC) /* {{{ */ { - switch (file_handle->type) { - case ZEND_HANDLE_FILENAME: - if (FAILURE == zend_stream_open(file_handle->filename, file_handle TSRMLS_CC)) { - return FAILURE; - } - break; - - case ZEND_HANDLE_FD: - file_handle->handle.fp = fdopen(file_handle->handle.fd, "rb"); - file_handle->type = ZEND_HANDLE_FP; - break; - - case ZEND_HANDLE_FP: - file_handle->handle.fp = file_handle->handle.fp; - break; - - case ZEND_HANDLE_STREAM: - /* nothing to do */ - return SUCCESS; - - default: - return FAILURE; - } - if (file_handle->type == ZEND_HANDLE_FP) { - if (!file_handle->handle.fp) { - return FAILURE; - } - - /* make compatible with stream */ - file_handle->handle.stream.handle = file_handle->handle.fp; - file_handle->handle.stream.reader = zend_stream_stdio_reader; - file_handle->handle.stream.closer = zend_stream_stdio_closer; - file_handle->handle.stream.fteller = zend_stream_stdio_fteller; + char buf; - file_handle->handle.stream.interactive = isatty(fileno((FILE *)file_handle->handle.stream.handle)); + if (file_handle->handle.stream.reader(file_handle->handle.stream.handle, &buf, sizeof(buf) TSRMLS_CC)) { + return (int)buf; } - return SUCCESS; -} + return EOF; +} /* }}} */ -ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC) +static size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC) /* {{{ */ { - if (file_handle->handle.stream.interactive) { + if (!zend_stream_is_mmap(file_handle) && file_handle->handle.stream.isatty) { int c = '*'; - size_t n; + size_t n; #ifdef NETWARE /* @@ -108,35 +146,190 @@ ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_ Ascii value 4 is actually EOT character which is not defined anywhere in the LibC or else we can use instead of hardcoded 4. */ - for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != 4 && c != '\n'; ++n ) + for (n = 0; n < len && (c = zend_stream_getc(file_handle TSRMLS_CC)) != EOF && c != 4 && c != '\n'; ++n) { #else - for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != '\n'; ++n ) + for (n = 0; n < len && (c = zend_stream_getc(file_handle TSRMLS_CC)) != EOF && c != '\n'; ++n) { #endif - buf[n] = (char) c; - if ( c == '\n' ) - buf[n++] = (char) c; + buf[n] = (char)c; + } + if (c == '\n') { + buf[n++] = (char)c; + } return n; } return file_handle->handle.stream.reader(file_handle->handle.stream.handle, buf, len TSRMLS_CC); -} +} /* }}} */ -ZEND_API int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC) +ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len TSRMLS_DC) /* {{{ */ { - char buf; + size_t size; + zend_stream_type old_type; - if (file_handle->handle.stream.reader(file_handle->handle.stream.handle, &buf, sizeof(buf) TSRMLS_CC)) { - return (int)buf; + if (file_handle->type == ZEND_HANDLE_FILENAME) { + if (zend_stream_open(file_handle->filename, file_handle TSRMLS_CC) == FAILURE) { + return FAILURE; + } } - return EOF; -} -ZEND_API int zend_stream_ferror(zend_file_handle *file_handle TSRMLS_DC) + switch (file_handle->type) { + case ZEND_HANDLE_FD: + file_handle->type = ZEND_HANDLE_FP; + file_handle->handle.fp = fdopen(file_handle->handle.fd, "rb"); + /* no break; */ + case ZEND_HANDLE_FP: + if (!file_handle->handle.fp) { + return FAILURE; + } + memset(&file_handle->handle.stream.mmap, 0, sizeof(zend_mmap)); + file_handle->handle.stream.isatty = isatty(fileno((FILE *)file_handle->handle.stream.handle)) ? 1 : 0; + file_handle->handle.stream.reader = (zend_stream_reader_t)zend_stream_stdio_reader; + file_handle->handle.stream.closer = (zend_stream_closer_t)zend_stream_stdio_closer; + file_handle->handle.stream.fsizer = (zend_stream_fsizer_t)zend_stream_stdio_fsizer; + memset(&file_handle->handle.stream.mmap, 0, sizeof(file_handle->handle.stream.mmap)); + /* no break; */ + case ZEND_HANDLE_STREAM: + /* nothing to do */ + break; + + case ZEND_HANDLE_MAPPED: + file_handle->handle.stream.mmap.pos = 0; + *buf = file_handle->handle.stream.mmap.buf; + *len = file_handle->handle.stream.mmap.len; + return SUCCESS; + + default: + return FAILURE; + } + + size = zend_stream_fsize(file_handle TSRMLS_CC); + if (size == (size_t)-1) { + return FAILURE; + } + + old_type = file_handle->type; + file_handle->type = ZEND_HANDLE_STREAM; /* we might still be _FP but we need fsize() work */ + + if (old_type == ZEND_HANDLE_FP && !file_handle->handle.stream.isatty && size) { +#if HAVE_MMAP + if (file_handle->handle.fp) { + /* *buf[size] is zeroed automatically by the kernel */ + *buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0); + if (*buf != MAP_FAILED) { + long offset = ftell(file_handle->handle.fp); + file_handle->handle.stream.mmap.map = *buf; + + if (offset != -1) { + *buf += offset; + size -= offset; + } + file_handle->handle.stream.mmap.buf = *buf; + file_handle->handle.stream.mmap.len = size; + + goto return_mapped; + } + } +#endif + file_handle->handle.stream.mmap.map = 0; + file_handle->handle.stream.mmap.buf = *buf = safe_emalloc(1, size, ZEND_MMAP_AHEAD); + file_handle->handle.stream.mmap.len = zend_stream_read(file_handle, *buf, size TSRMLS_CC); + } else { + size_t read, remain = 4*1024; + *buf = emalloc(remain); + size = 0; + + while ((read = zend_stream_read(file_handle, *buf + size, remain TSRMLS_CC)) > 0) { + size += read; + remain -= read; + + if (remain == 0) { + *buf = safe_erealloc(*buf, size, 2, 0); + remain = size; + } + } + file_handle->handle.stream.mmap.map = 0; + file_handle->handle.stream.mmap.len = size; + if (size && remain < ZEND_MMAP_AHEAD) { + *buf = safe_erealloc(*buf, size, 1, ZEND_MMAP_AHEAD); + } + file_handle->handle.stream.mmap.buf = *buf; + } + + if (file_handle->handle.stream.mmap.len == 0) { + *buf = erealloc(*buf, ZEND_MMAP_AHEAD); + file_handle->handle.stream.mmap.buf = *buf; + } + + if (ZEND_MMAP_AHEAD) { + memset(file_handle->handle.stream.mmap.buf + file_handle->handle.stream.mmap.len, 0, ZEND_MMAP_AHEAD); + } + +return_mapped: + file_handle->type = ZEND_HANDLE_MAPPED; + file_handle->handle.stream.mmap.pos = 0; + file_handle->handle.stream.mmap.old_handle = file_handle->handle.stream.handle; + file_handle->handle.stream.mmap.old_closer = file_handle->handle.stream.closer; + file_handle->handle.stream.handle = &file_handle->handle.stream; + file_handle->handle.stream.closer = (zend_stream_closer_t)zend_stream_mmap_closer; + + *buf = file_handle->handle.stream.mmap.buf; + *len = file_handle->handle.stream.mmap.len; + + return SUCCESS; +} /* }}} */ + +ZEND_API void zend_file_handle_dtor(zend_file_handle *fh TSRMLS_DC) /* {{{ */ { - return 0; + switch (fh->type) { + case ZEND_HANDLE_FD: + /* nothing to do */ + break; + case ZEND_HANDLE_FP: + fclose(fh->handle.fp); + break; + case ZEND_HANDLE_STREAM: + case ZEND_HANDLE_MAPPED: + if (fh->handle.stream.closer && fh->handle.stream.handle) { + fh->handle.stream.closer(fh->handle.stream.handle TSRMLS_CC); + } + fh->handle.stream.handle = NULL; + break; + case ZEND_HANDLE_FILENAME: + /* We're only supposed to get here when destructing the used_files hash, + * which doesn't really contain open files, but references to their names/paths + */ + break; + } + if (fh->opened_path) { + efree(fh->opened_path); + fh->opened_path = NULL; + } + if (fh->free_filename && fh->filename) { + efree(fh->filename); + fh->filename = NULL; + } } +/* }}} */ -ZEND_API long zend_stream_ftell(zend_file_handle *file_handle TSRMLS_DC) +ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) /* {{{ */ { - return file_handle->handle.stream.fteller(file_handle->handle.stream.handle TSRMLS_CC); -} + if (fh1->type != fh2->type) { + return 0; + } + switch (fh1->type) { + case ZEND_HANDLE_FD: + return fh1->handle.fd == fh2->handle.fd; + case ZEND_HANDLE_FP: + return fh1->handle.fp == fh2->handle.fp; + case ZEND_HANDLE_STREAM: + return fh1->handle.stream.handle == fh2->handle.stream.handle; + case ZEND_HANDLE_MAPPED: + return (fh1->handle.stream.handle == &fh1->handle.stream && + fh2->handle.stream.handle == &fh2->handle.stream && + fh1->handle.stream.mmap.old_handle == fh2->handle.stream.mmap.old_handle) + || fh1->handle.stream.handle == fh2->handle.stream.handle; + default: + return 0; + } + return 0; +} /* }}} */ diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h index 482cc043d..9c9bdefdf 100644 --- a/Zend/zend_stream.h +++ b/Zend/zend_stream.h @@ -5,7 +5,7 @@ | Copyright (c) 1998-2009 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 | + | 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 | @@ -13,10 +13,13 @@ | license@zend.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Wez Furlong | + | Scott MacVicar | + | Nuno Lopes | + | Marcus Boerger | +----------------------------------------------------------------------+ */ -/* $Id: zend_stream.h,v 1.8.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_stream.h,v 1.8.2.1.2.1.2.5 2009/03/11 22:11:53 shire Exp $ */ #ifndef ZEND_STREAM_H #define ZEND_STREAM_H @@ -24,41 +27,55 @@ /* Lightweight stream implementation for the ZE scanners. * These functions are private to the engine. * */ +typedef size_t (*zend_stream_fsizer_t)(void* handle TSRMLS_DC); +typedef size_t (*zend_stream_reader_t)(void* handle, char *buf, size_t len TSRMLS_DC); +typedef void (*zend_stream_closer_t)(void* handle TSRMLS_DC); -typedef size_t (*zend_stream_reader_t)(void *handle, char *buf, size_t len TSRMLS_DC); -typedef void (*zend_stream_closer_t)(void *handle TSRMLS_DC); -typedef long (*zend_stream_fteller_t)(void *handle TSRMLS_DC); +#define ZEND_MMAP_AHEAD 32 + +typedef enum { + ZEND_HANDLE_FILENAME, + ZEND_HANDLE_FD, + ZEND_HANDLE_FP, + ZEND_HANDLE_STREAM, + ZEND_HANDLE_MAPPED, +} zend_stream_type; + +typedef struct _zend_mmap { + size_t len; + size_t pos; + void *map; + char *buf; + void *old_handle; + zend_stream_closer_t old_closer; +} zend_mmap; typedef struct _zend_stream { - void *handle; - zend_stream_reader_t reader; - zend_stream_closer_t closer; - zend_stream_fteller_t fteller; - int interactive; + void *handle; + int isatty; + zend_mmap mmap; + zend_stream_reader_t reader; + zend_stream_fsizer_t fsizer; + zend_stream_closer_t closer; } zend_stream; typedef struct _zend_file_handle { - zend_uchar type; - char *filename; - char *opened_path; + zend_stream_type type; + char *filename; + char *opened_path; union { - int fd; - FILE *fp; - zend_stream stream; + int fd; + FILE *fp; + zend_stream stream; } handle; zend_bool free_filename; } zend_file_handle; BEGIN_EXTERN_C() ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC); -ZEND_API int zend_stream_ferror(zend_file_handle *file_handle TSRMLS_DC); -ZEND_API int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC); -ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC); -ZEND_API long zend_stream_ftell(zend_file_handle *file_handle TSRMLS_DC); -ZEND_API int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC); +ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len TSRMLS_DC); +ZEND_API void zend_file_handle_dtor(zend_file_handle *fh TSRMLS_DC); +ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); END_EXTERN_C() -#define zend_stream_close(handle) zend_file_handle_dtor((handle)) - #endif - diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 4552640a9..85c59a3d5 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -89,7 +89,7 @@ * directly -- and assumed always to succeed. */ -/* $Id: zend_strtod.c,v 1.17.2.2.2.15 2008/09/15 11:47:03 dmitry Exp $ */ +/* $Id: zend_strtod.c,v 1.17.2.2.2.13.2.5 2009/03/18 10:18:10 dmitry Exp $ */ #include #include @@ -2621,7 +2621,7 @@ ZEND_API double zend_oct_strtod(const char *str, char **endptr) s++; while ((c = *s++)) { - if (c > '7') { + if (c < '0' || c > '7') { /* break and return the current value if the number is not well-formed * that's what Linux strtol() does */ diff --git a/Zend/zend_strtod.h b/Zend/zend_strtod.h index 76fa5e473..8c7aaa276 100644 --- a/Zend/zend_strtod.h +++ b/Zend/zend_strtod.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_strtod.h,v 1.3.2.1.2.6 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_strtod.h,v 1.3.2.1.2.4.2.2 2008/12/31 11:15:32 sebastian Exp $ */ /* This is a header file for the strtod implementation by David M. Gay which * can be found in zend_strtod.c */ diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index 0b5fa570e..01b2a8d05 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ts_hash.c,v 1.14.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_ts_hash.c,v 1.14.2.1.2.2.2.4 2009/01/09 19:16:55 tony2001 Exp $ */ #include "zend.h" #include "zend_ts_hash.h" @@ -169,13 +169,13 @@ ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t end_write(ht); } -ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int num_args, ...) +ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht TSRMLS_DC, apply_func_args_t apply_func, int num_args, ...) { va_list args; va_start(args, num_args); begin_write(ht); - zend_hash_apply_with_arguments(TS_HASH(ht), apply_func, num_args, args); + zend_hash_apply_with_arguments(TS_HASH(ht) TSRMLS_CC, apply_func, num_args, args); end_write(ht); va_end(args); } @@ -273,6 +273,13 @@ ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_c end_read(source); } +ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size) +{ + begin_read(source); + zend_hash_copy(target, TS_HASH(source), pCopyConstructor, tmp, size); + end_read(source); +} + ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite) { begin_read(source); diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h index 43081df8a..c01c23236 100644 --- a/Zend/zend_ts_hash.h +++ b/Zend/zend_ts_hash.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ts_hash.h,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_ts_hash.h,v 1.13.2.1.2.1.2.4 2009/01/09 19:16:55 tony2001 Exp $ */ #ifndef ZEND_TS_HASH_H #define ZEND_TS_HASH_H @@ -72,7 +72,7 @@ ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint n ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht); ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC); ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC); -ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int, ...); +ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht TSRMLS_DC, apply_func_args_t apply_func, int, ...); ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC); @@ -97,6 +97,7 @@ ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h); /* Copying, merging and sorting */ ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size); +ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size); ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite); ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, 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 TSRMLS_DC); diff --git a/Zend/zend_types.h b/Zend/zend_types.h index ef5a5ac5b..e8260aac6 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_types.h,v 1.6.2.2.2.5 2008/12/31 11:17:33 sebastian Exp $ */ +/* $Id: zend_types.h,v 1.6.2.2.2.3.2.3 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_TYPES_H #define ZEND_TYPES_H @@ -28,6 +28,20 @@ typedef unsigned int zend_uint; typedef unsigned long zend_ulong; typedef unsigned short zend_ushort; +#define HAVE_ZEND_LONG64 +#ifdef ZEND_WIN32 +typedef __int64 zend_long64; +typedef unsigned __int64 zend_ulong64; +#elif SIZEOF_LONG_LONG_INT == 8 +typedef long long int zend_long64; +typedef unsigned long long int zend_ulong64; +#elif SIZEOF_LONG_LONG == 8 +typedef long long zend_long64; +typedef unsigned long long zend_ulong64; +#else +# undef HAVE_ZEND_LONG64 +#endif + #ifdef _WIN64 typedef __int64 zend_intptr_t; typedef unsigned __int64 zend_uintptr_t; diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index ce9304c96..743207cac 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_variables.c,v 1.62.2.1.2.4 2008/12/31 11:17:34 sebastian Exp $ */ +/* $Id: zend_variables.c,v 1.62.2.1.2.2.2.4 2008/12/31 11:15:32 sebastian Exp $ */ #include #include "zend.h" @@ -29,7 +29,7 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) { - switch (zvalue->type & ~IS_CONSTANT_INDEX) { + switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { case IS_STRING: case IS_CONSTANT: CHECK_ZVAL_STRING_REL(zvalue); @@ -73,7 +73,7 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) { - switch (zvalue->type & ~IS_CONSTANT_INDEX) { + switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { case IS_STRING: case IS_CONSTANT: CHECK_ZVAL_STRING_REL(zvalue); @@ -97,13 +97,13 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) ZEND_API void zval_add_ref(zval **p) { - (*p)->refcount++; + Z_ADDREF_PP(p); } ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) { - switch (zvalue->type) { + switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { case IS_RESOURCE: { TSRMLS_FETCH(); diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h index abd613078..43dcc4589 100644 --- a/Zend/zend_variables.h +++ b/Zend/zend_variables.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_variables.h,v 1.34.2.1.2.3 2008/12/31 11:17:34 sebastian Exp $ */ +/* $Id: zend_variables.h,v 1.34.2.1.2.1.2.4 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_VARIABLES_H #define ZEND_VARIABLES_H @@ -29,9 +29,9 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC); static inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) { - if (zvalue->type <= IS_BOOL) { - return; - } + if (zvalue->type <= IS_BOOL) { + return; + } _zval_dtor_func(zvalue ZEND_FILE_LINE_CC); } @@ -39,9 +39,9 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC); static inline void _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC) { - if (zvalue->type <= IS_BOOL) { - return; - } + if (zvalue->type <= IS_BOOL) { + return; + } _zval_copy_ctor_func(zvalue ZEND_FILE_LINE_CC); } diff --git a/Zend/zend_vm.h b/Zend/zend_vm.h index e79541c2f..5974b317c 100644 --- a/Zend/zend_vm.h +++ b/Zend/zend_vm.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm.h,v 1.7.2.1.2.4 2008/12/31 11:17:34 sebastian Exp $ */ +/* $Id: zend_vm.h,v 1.7.2.1.2.2.2.2 2008/12/31 11:15:32 sebastian Exp $ */ #ifndef ZEND_VM_H #define ZEND_VM_H diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 7eabc5c67..3f8adbad2 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.65 2009/02/15 14:31:17 iliaa Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.88 2009/03/18 18:49:27 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -146,10 +146,12 @@ ZEND_VM_HANDLER(16, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, GET_OP1_ZVAL_PTR(BP_VAR_R), GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); FREE_OP1(); FREE_OP2(); ZEND_VM_NEXT_OPCODE(); @@ -159,10 +161,12 @@ ZEND_VM_HANDLER(17, ZEND_IS_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, GET_OP1_ZVAL_PTR(BP_VAR_R), GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); FREE_OP1(); FREE_OP2(); ZEND_VM_NEXT_OPCODE(); @@ -172,10 +176,12 @@ ZEND_VM_HANDLER(18, ZEND_IS_NOT_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, GET_OP1_ZVAL_PTR(BP_VAR_R), GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); FREE_OP1(); FREE_OP2(); ZEND_VM_NEXT_OPCODE(); @@ -185,10 +191,12 @@ ZEND_VM_HANDLER(19, ZEND_IS_SMALLER, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, GET_OP1_ZVAL_PTR(BP_VAR_R), GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); FREE_OP1(); FREE_OP2(); ZEND_VM_NEXT_OPCODE(); @@ -198,10 +206,12 @@ ZEND_VM_HANDLER(20, ZEND_IS_SMALLER_OR_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, GET_OP1_ZVAL_PTR(BP_VAR_R), GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); FREE_OP1(); FREE_OP2(); ZEND_VM_NEXT_OPCODE(); @@ -291,9 +301,12 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (OP1_TYPE == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -304,8 +317,9 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -323,8 +337,9 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -332,49 +347,46 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -399,29 +411,29 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU zend_free_op free_op1, free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_obj_helper, binary_op, binary_op); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); + zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW); - if (object_ptr && OP1_TYPE != IS_CV && !OP1_FREE) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } - - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (OP1_TYPE == IS_VAR && !OP1_FREE) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_obj_helper, binary_op, binary_op); } else { zend_op *op_data = opline+1; zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW), dim, IS_OP2_TMP_FREE(), BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -438,15 +450,11 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } FREE_OP2(); FREE_OP1_VAR_PTR(); - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -456,7 +464,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -465,14 +473,12 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } FREE_OP2(); - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -545,6 +551,10 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR| zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (OP1_TYPE == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -586,13 +596,14 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR| if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -637,6 +648,10 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (OP1_TYPE == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -676,7 +691,8 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -689,7 +705,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -724,14 +740,13 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY) zend_free_op free_op1; zval **var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); - if (!var_ptr) { + if (OP1_TYPE == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (OP1_TYPE == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } FREE_OP1_VAR_PTR(); ZEND_VM_NEXT_OPCODE(); @@ -743,7 +758,7 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); increment_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -752,9 +767,8 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY) } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } FREE_OP1_VAR_PTR(); @@ -767,14 +781,13 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY) zend_free_op free_op1; zval **var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); - if (!var_ptr) { + if (OP1_TYPE == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (OP1_TYPE == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } FREE_OP1_VAR_PTR(); ZEND_VM_NEXT_OPCODE(); @@ -786,7 +799,7 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); decrement_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -795,9 +808,8 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY) } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } FREE_OP1_VAR_PTR(); @@ -810,10 +822,10 @@ ZEND_VM_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY) zend_free_op free_op1; zval **var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); - if (!var_ptr) { + if (OP1_TYPE == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (OP1_TYPE == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).tmp_var = *EG(uninitialized_zval_ptr); } @@ -830,7 +842,7 @@ ZEND_VM_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); increment_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -848,10 +860,10 @@ ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY) zend_free_op free_op1; zval **var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); - if (!var_ptr) { + if (OP1_TYPE == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (OP1_TYPE == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).tmp_var = *EG(uninitialized_zval_ptr); } @@ -868,7 +880,7 @@ ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); decrement_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -918,7 +930,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, ANY, int type zval tmp_varname; HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { + if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_string(&tmp_varname); @@ -949,7 +961,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, ANY, int type case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); - new_zval->refcount++; + Z_ADDREF_P(new_zval); zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval); } break; @@ -977,20 +989,23 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, ANY, int type } - if (varname == &tmp_varname) { + if (OP1_TYPE != IS_CONST && varname == &tmp_varname) { zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = retval; + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } PZVAL_LOCK(*retval); switch (type) { case BP_VAR_R: case BP_VAR_IS: - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, *retval); break; case BP_VAR_UNSET: { zend_free_op free_res; + EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res); if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr); @@ -998,6 +1013,9 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, ANY, int type PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); FREE_OP_VAR_PTR(free_res); break; + default: + EX_T(opline->result.u.var).var.ptr_ptr = retval; + break; } } } @@ -1040,13 +1058,18 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, VAR|CV, CONST|TMP|VAR|CV) zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **container; if (opline->extended_value == ZEND_FETCH_ADD_LOCK && OP1_TYPE != IS_CV && EX_T(opline->op1.u.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(BP_VAR_R), dim, IS_OP2_TMP_FREE(), BP_VAR_R TSRMLS_CC); + container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_R TSRMLS_CC); FREE_OP2(); FREE_OP1_VAR_PTR(); ZEND_VM_NEXT_OPCODE(); @@ -1057,19 +1080,30 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMP|VAR|UNUSED|CV) zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(BP_VAR_W), dim, IS_OP2_TMP_FREE(), BP_VAR_W TSRMLS_CC); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_W TSRMLS_CC); FREE_OP2(); if (OP1_TYPE == IS_VAR && OP1_FREE && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } FREE_OP1_VAR_PTR(); + + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -1078,15 +1112,18 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|UNUSED|CV) zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW), dim, IS_OP2_TMP_FREE(), BP_VAR_RW TSRMLS_CC); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_RW TSRMLS_CC); FREE_OP2(); if (OP1_TYPE == IS_VAR && OP1_FREE && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -1099,8 +1136,12 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV) zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_IS); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(BP_VAR_IS), dim, IS_OP2_TMP_FREE(), BP_VAR_IS TSRMLS_CC); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_IS TSRMLS_CC); FREE_OP2(); FREE_OP1_VAR_PTR(); ZEND_VM_NEXT_OPCODE(); @@ -1110,24 +1151,34 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; + zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **container; - if (OP2_TYPE == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = GET_OP2_ZVAL_PTR(BP_VAR_R); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(type), dim, IS_OP2_TMP_FREE(), type TSRMLS_CC); - FREE_OP2(); - if (OP1_TYPE == IS_VAR && type == BP_VAR_W && OP1_FREE && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_W TSRMLS_CC); + if (OP1_TYPE == IS_VAR && OP1_FREE && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (OP2_TYPE == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); + } + container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_R TSRMLS_CC); } + FREE_OP2(); FREE_OP1_VAR_PTR(); ZEND_VM_NEXT_OPCODE(); } @@ -1149,14 +1200,16 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV) SEPARATE_ZVAL_IF_NOT_REF(container); } } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_UNSET TSRMLS_CC); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_UNSET TSRMLS_CC); FREE_OP2(); if (OP1_TYPE == IS_VAR && OP1_FREE && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -1179,51 +1232,39 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV) ZEND_VM_HELPER_EX(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP|VAR|CV, int type) { zend_op *opline = EX(opline); - zval *container; - zval **retval; zend_free_op free_op1; + zval *container = GET_OP1_OBJ_ZVAL_PTR(type); zend_free_op free_op2; zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = GET_OP1_OBJ_ZVAL_PTR(type); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - FREE_OP2(); - FREE_OP1(); - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } FREE_OP2(); } else { + zval *retval; + if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (IS_OP2_TMP_FREE()) { @@ -1247,8 +1288,9 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV) zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && OP1_TYPE != IS_CV) { + if (OP1_TYPE == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -1256,22 +1298,33 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV) if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W), property, BP_VAR_W TSRMLS_CC); + container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&property); } else { FREE_OP2(); } if (OP1_TYPE == IS_VAR && OP1_FREE && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } FREE_OP1_VAR_PTR(); + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } @@ -1280,22 +1333,25 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMP|VAR|CV) zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW); if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW), property, BP_VAR_RW TSRMLS_CC); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&property); } else { FREE_OP2(); } if (OP1_TYPE == IS_VAR && OP1_FREE && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -1316,22 +1372,25 @@ ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, VAR|UNUSED|CV, CONST|TMP|VAR|CV) /* Behave like FETCH_OBJ_W */ zend_free_op free_op1, free_op2; zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W), property, BP_VAR_W TSRMLS_CC); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&property); } else { FREE_OP2(); } if (OP1_TYPE == IS_VAR && OP1_FREE && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -1357,18 +1416,20 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV) if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (OP1_TYPE == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&property); } else { FREE_OP2(); } if (OP1_TYPE == IS_VAR && OP1_FREE && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -1391,18 +1452,17 @@ ZEND_VM_HANDLER(98, ZEND_FETCH_DIM_TMP_VAR, CONST|TMP, CONST) if (Z_TYPE_P(container) != IS_ARRAY) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { zend_free_op free_op2; zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); - EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC); - SELECTIVE_PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &opline->result); + AI_SET_PTR(EX_T(opline->result.u.var).var, *zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC)); + SELECTIVE_PZVAL_LOCK(EX_T(opline->result.u.var).var.ptr, &opline->result); FREE_OP2(); } - AI_USE_PTR(EX_T(opline->result.u.var).var); ZEND_VM_NEXT_OPCODE(); } @@ -1410,10 +1470,22 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - zend_free_op free_op1; + zend_free_op free_op1, free_op2; zval **object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); + zval *property_name = GET_OP2_ZVAL_PTR(BP_VAR_R); - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (IS_OP2_TMP_FREE()) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (OP1_TYPE == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (IS_OP2_TMP_FREE()) { + zval_ptr_dtor(&property_name); + } else { + FREE_OP2(); + } FREE_OP1_VAR_PTR(); /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); @@ -1425,27 +1497,55 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV) zend_op *opline = EX(opline); zend_op *op_data = opline+1; zend_free_op free_op1; - zval **object_ptr; + zval **object_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); - if (OP1_TYPE == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); - } else { - object_ptr = NULL; + if (OP1_TYPE == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + zend_free_op free_op2; + zval *property_name = GET_OP2_ZVAL_PTR(BP_VAR_R); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (IS_OP2_TMP_FREE()) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (IS_OP2_TMP_FREE()) { + zval_ptr_dtor(&property_name); + } else { + FREE_OP2(); + } } else { - zend_free_op free_op2, free_op_data1; + zend_free_op free_op2, free_op_data1, free_op_data2; zval *value; zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, IS_OP2_TMP_FREE(), BP_VAR_W TSRMLS_CC); FREE_OP2(); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } FREE_OP1_VAR_PTR(); @@ -1457,10 +1557,32 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV) ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV) { zend_op *opline = EX(opline); - zend_free_op free_op2; + zend_free_op free_op1, free_op2; zval *value = GET_OP2_ZVAL_PTR(BP_VAR_R); + zval **variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); + + if (OP1_TYPE == IS_VAR && !variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, OP2_TYPE TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_OP2_TMP_FREE() TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + + FREE_OP1_VAR_PTR(); - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (IS_OP2_TMP_FREE()?IS_TMP_VAR:OP2_TYPE), EX(Ts) TSRMLS_CC); /* zend_assign_to_variable() always takes care of op2, never free it! */ FREE_OP2_IF_VAR(); @@ -1476,14 +1598,14 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV) if (OP2_TYPE == IS_VAR && value_ptr_ptr && - !(*value_ptr_ptr)->is_ref && + !Z_ISREF_PP(value_ptr_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op2.u.var).var.fcall_returned_reference) { if (free_op2.var == NULL) { PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); - if (EG(exception)) { + if (UNEXPECTED(EG(exception) != NULL)) { FREE_OP2_VAR_PTR(); ZEND_VM_NEXT_OPCODE(); } @@ -1492,20 +1614,23 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV) PZVAL_LOCK(*value_ptr_ptr); } if (OP1_TYPE == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { - zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); + zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object"); } variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); + if ((OP2_TYPE == IS_VAR && !value_ptr_ptr) || + (OP1_TYPE == IS_VAR && !variable_ptr_ptr)) { + zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects"); + } zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); if (OP2_TYPE == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { - (*variable_ptr_ptr)->refcount--; + Z_DELREF_PP(variable_ptr_ptr); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *variable_ptr_ptr); PZVAL_LOCK(*variable_ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } FREE_OP1_VAR_PTR(); @@ -1527,14 +1652,24 @@ ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); zend_free_op free_op1; - int ret = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); + zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); + int ret; - FREE_OP1(); + if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + FREE_OP1(); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (!ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); @@ -1544,14 +1679,24 @@ ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); zend_free_op free_op1; - int ret = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); + zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); + int ret; - FREE_OP1(); + if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + FREE_OP1(); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); @@ -1561,19 +1706,30 @@ ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); zend_free_op free_op1; - int retval = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); + zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); + int retval; - FREE_OP1(); - if (retval) { + if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + FREE_OP1(); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } + if (EXPECTED(retval != 0)) { #if DEBUG_ZEND>=2 printf("Conditional jmp on true to %d\n", opline->extended_value); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } else { #if DEBUG_ZEND>=2 printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } } @@ -1581,16 +1737,26 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); zend_free_op free_op1; - int retval = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); + zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); + int retval; - FREE_OP1(); + if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + FREE_OP1(); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } @@ -1599,16 +1765,26 @@ ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); zend_free_op free_op1; - int retval = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); + zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); + int retval; - FREE_OP1(); + if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + FREE_OP1(); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } @@ -1626,44 +1802,70 @@ ZEND_VM_HANDLER(53, ZEND_INIT_STRING, ANY, ANY) tmp->value.str.val = emalloc(1); tmp->value.str.val[0] = 0; tmp->value.str.len = 0; - tmp->refcount = 1; + Z_SET_REFCOUNT_P(tmp, 1); tmp->type = IS_STRING; - tmp->is_ref = 0; + Z_UNSET_ISREF_P(tmp); ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP, CONST) +ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST) { zend_op *opline = EX(opline); - zend_free_op free_op1; + zval *str = &EX_T(opline->result.u.var).tmp_var; + + if (OP1_TYPE == IS_UNUSED) { + /* Initialize for erealloc in add_char_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + + add_char_to_string(str, str, &opline->op2.u.constant); - add_char_to_string(&EX_T(opline->result.u.var).tmp_var, - GET_OP1_ZVAL_PTR(BP_VAR_NA), - &opline->op2.u.constant); /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP, CONST) +ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST) { zend_op *opline = EX(opline); - zend_free_op free_op1; + zval *str = &EX_T(opline->result.u.var).tmp_var; + + if (OP1_TYPE == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + + add_string_to_string(str, str, &opline->op2.u.constant); - add_string_to_string(&EX_T(opline->result.u.var).tmp_var, - GET_OP1_ZVAL_PTR(BP_VAR_NA), - &opline->op2.u.constant); /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP, TMP|VAR|CV) +ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op2; + zend_free_op free_op2; + zval *str = &EX_T(opline->result.u.var).tmp_var; zval *var = GET_OP2_ZVAL_PTR(BP_VAR_R); zval var_copy; int use_copy = 0; + if (OP1_TYPE == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + if (Z_TYPE_P(var) != IS_STRING) { zend_make_printable_zval(var, &var_copy, &use_copy); @@ -1671,9 +1873,8 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP, TMP|VAR|CV) var = &var_copy; } } - add_string_to_string( &EX_T(opline->result.u.var).tmp_var, - GET_OP1_ZVAL_PTR(BP_VAR_NA), - var); + add_string_to_string(str, str, var); + if (use_copy) { zval_dtor(var); } @@ -1726,7 +1927,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) int function_name_strlen; zend_free_op free_op1, free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); @@ -1749,15 +1950,17 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; - } else { + } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -1773,22 +1976,36 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV) +ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUSED|CV) { zend_op *opline = EX(opline); zval *function_name; zend_class_entry *ce; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - ce = EX_T(opline->op1.u.var).class_entry; + if (OP1_TYPE == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } if(OP2_TYPE != IS_UNUSED) { - char *function_name_strval; - int function_name_strlen; - zend_bool is_const = (OP2_TYPE == IS_CONST); + char *function_name_strval = NULL; + int function_name_strlen = 0; zend_free_op free_op2; - if (is_const) { + if (OP2_TYPE == IS_CONST) { function_name_strval = Z_STRVAL(opline->op2.u.constant); function_name_strlen = Z_STRLEN(opline->op2.u.constant); } else { @@ -1796,15 +2013,24 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV) if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } - if (!is_const) { - efree(function_name_strval); + if (OP2_TYPE != IS_CONST) { FREE_OP2(); } } else { @@ -1820,8 +2046,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV) if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { EX(object) = NULL; } else { - if (OP2_TYPE != IS_UNUSED && - EG(This) && + if (EG(This) && Z_OBJ_HT_P(EG(This))->get_class_entry && !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, @@ -1840,7 +2065,8 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV) } if ((EX(object) = EG(This))) { - EX(object)->refcount++; + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); } } @@ -1851,54 +2077,182 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) { zend_op *opline = EX(opline); zval *function_name; - zend_function *function; char *function_name_strval, *lcname; int function_name_strlen; zend_free_op free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (OP2_TYPE == IS_CONST) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, opline->extended_value, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL(opline->op2.u.constant)); + } } else { function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); + if (Z_TYPE_P(function_name) == IS_OBJECT && + Z_OBJ_HANDLER_P(function_name, get_closure) && + Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) { + if (EX(object)) { + Z_ADDREF_P(EX(object)); + } + FREE_OP2(); + ZEND_VM_NEXT_OPCODE(); + } + if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; - } + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + if (function_name_strval[0] == '\\') { - lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); - if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) { + function_name_strlen -= 1; + lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); + } else { + lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); + } + if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); + } efree(lcname); - zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); - } - - efree(lcname); - if (OP2_TYPE != IS_CONST) { FREE_OP2(); } EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); +} + + +ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST) +{ + zend_op *opline = EX(opline); + zend_op *op_data = opline + 1; + + ZEND_VM_INC_OPCODE(); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - EX(fbc) = function; + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, opline->extended_value, (void **) &EX(fbc))==FAILURE) { + char *short_name = Z_STRVAL(opline->op1.u.constant)+Z_LVAL(op_data->op1.u.constant); + if (zend_hash_quick_find(EG(function_table), short_name, Z_STRLEN(opline->op1.u.constant)-Z_LVAL(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL(opline->op2.u.constant)); + } + } + EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HELPER(zend_leave_helper, ANY, ANY) +{ + zend_bool nested; + zend_op_array *op_array = EX(op_array); + + EG(current_execute_data) = EX(prev_execute_data); + EG(opline_ptr) = NULL; + if (!EG(active_symbol_table)) { + zval ***cv = EX(CVs); + zval ***end = cv + EX(op_array)->last_var; + while (cv != end) { + if (*cv) { + zval_ptr_dtor(*cv); + } + cv++; + } + } + + nested = EX(nested); + + zend_vm_stack_free(execute_data TSRMLS_CC); + + if (nested) { + execute_data = EG(current_execute_data); + + if (EX(call_opline)->opcode == ZEND_INCLUDE_OR_EVAL) { + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + EX(object) = EX(current_object); + + if (RETURN_VALUE_USED(EX(call_opline))) { + if (!EX_T(EX(call_opline)->result.u.var).var.ptr) { /* there was no return statement */ + ALLOC_ZVAL(EX_T(EX(call_opline)->result.u.var).var.ptr); + INIT_PZVAL(EX_T(EX(call_opline)->result.u.var).var.ptr); + Z_LVAL_P(EX_T(EX(call_opline)->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(EX(call_opline)->result.u.var).var.ptr) = IS_BOOL; + } + } + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + destroy_op_array(op_array TSRMLS_CC); + efree(op_array); + if (EG(exception)) { + zend_throw_exception_internal(NULL TSRMLS_CC); + } + + EX(opline)++; + ZEND_VM_LEAVE(); + } else { + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + if (EG(active_symbol_table)) { + if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { + zend_hash_destroy(EG(active_symbol_table)); + FREE_HASHTABLE(EG(active_symbol_table)); + } else { + /* clean before putting into the cache, since clean + could call dtors, which could use cached hash */ + zend_hash_clean(EG(active_symbol_table)); + *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); + } + } + EG(active_symbol_table) = EX(symbol_table); + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + + if (EG(This)) { + if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) { + if (IS_CTOR_USED(EX(called_scope))) { + Z_DELREF_P(EG(This)); + } + if (Z_REFCOUNT_P(EG(This)) == 1) { + zend_object_store_ctor_failed(EG(This) TSRMLS_CC); + } + } + zval_ptr_dtor(&EG(This)); + } + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); + + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); + + zend_vm_stack_clear_multiple(TSRMLS_C); + + if (EG(exception)) { + zend_throw_exception_internal(NULL TSRMLS_CC); + if (RETURN_VALUE_USED(EX(call_opline)) && EX_T(EX(call_opline)->result.u.var).var.ptr) { + zval_ptr_dtor(&EX_T(EX(call_opline)->result.u.var).var.ptr); + } + } + + EX(opline)++; + ZEND_VM_LEAVE(); + } + } + ZEND_VM_RETURN(); +} ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) { zend_op *opline = EX(opline); - zval **original_return_value; - zend_class_entry *current_scope = NULL; - zval *current_this = NULL; - int return_value_used = RETURN_VALUE_USED(opline); - zend_bool should_change_scope; - zend_op *ctor_opline; + zend_bool should_change_scope = 0; if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) { if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) { @@ -1906,131 +2260,109 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) ZEND_VM_NEXT_OPCODE(); /* Never reached */ } if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { - zend_error(E_STRICT, "Function %s%s%s() is deprecated", + zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.function_name); } } + if (EX(function_state).function->common.scope && + !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC) && + !EX(object)) { - zend_ptr_stack_2_push(&EG(argument_stack), (void *)(zend_uintptr_t)opline->extended_value, NULL); - - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + if (EX(function_state).function->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + /* FIXME: output identifiers properly */ + zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); + } else { + /* FIXME: output identifiers properly */ + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); + } + } - if (EX(function_state).function->type == ZEND_USER_FUNCTION - || EX(function_state).function->common.scope) { + if (EX(function_state).function->type == ZEND_USER_FUNCTION || + EX(function_state).function->common.scope) { should_change_scope = 1; - current_this = EG(This); + EX(current_this) = EG(This); + EX(current_scope) = EG(scope); + EX(current_called_scope) = EG(called_scope); EG(This) = EX(object); - current_scope = EG(scope); EG(scope) = (EX(function_state).function->type == ZEND_USER_FUNCTION || !EX(object)) ? EX(function_state).function->common.scope : NULL; - } else { - should_change_scope = 0; + EG(called_scope) = EX(called_scope); } - EX_T(opline->result.u.var).var.fcall_returned_reference = 0; + zend_ptr_stack_3_pop(&EG(arg_types_stack), (void*)&EX(called_scope), (void**)&EX(current_object), (void**)&EX(fbc)); + EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC); - if (EX(function_state).function->common.scope) { - if (!EG(This) && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) { - int severity; - char *severity_word; - if (EX(function_state).function->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_STRICT; - severity_word = "should not"; - } else { - severity = E_ERROR; - severity_word = "cannot"; - } - zend_error(severity, "Non-static method %s::%s() %s be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name, severity_word); - } - } if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { - unsigned char return_reference = EX(function_state).function->common.return_reference; - - ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr)); + ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr); + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference; if (EX(function_state).function->common.arg_info) { zend_uint i=0; - zval **p; - ulong arg_count; - - p = (zval **) EG(argument_stack).top_element-2; - arg_count = (ulong)(zend_uintptr_t) *p; + zval **p = (zval**)EX(function_state).arguments; + ulong arg_count = opline->extended_value; while (arg_count>0) { - zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count) TSRMLS_CC); + zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count), 0 TSRMLS_CC); arg_count--; } } if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ - ((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), return_value_used TSRMLS_CC); + ((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); } else { - zend_execute_internal(EXECUTE_DATA, return_value_used TSRMLS_CC); + zend_execute_internal(EXECUTE_DATA, RETURN_VALUE_USED(opline) TSRMLS_CC); } - EG(current_execute_data) = EXECUTE_DATA; - -/* We shouldn't fix bad extensions here, - because it can break proper ones (Bug #34045) - if (!EX(function_state).function->common.return_reference) { - EX_T(opline->result.u.var).var.ptr->is_ref = 0; - EX_T(opline->result.u.var).var.ptr->refcount = 1; - } -*/ - if (!return_value_used) { + if (!RETURN_VALUE_USED(opline)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); - } else { - EX_T(opline->result.u.var).var.fcall_returned_reference = return_reference; } } else if (EX(function_state).function->type == ZEND_USER_FUNCTION) { - EX_T(opline->result.u.var).var.ptr = NULL; - if (EG(symtable_cache_ptr)>=EG(symtable_cache)) { - /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/ - EX(function_state).function_symbol_table = *(EG(symtable_cache_ptr)--); - } else { - ALLOC_HASHTABLE(EX(function_state).function_symbol_table); - zend_hash_init(EX(function_state).function_symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0); - /*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/ + EX(original_return_value) = EG(return_value_ptr_ptr); + EG(active_symbol_table) = NULL; + EG(active_op_array) = &EX(function_state).function->op_array; + EG(return_value_ptr_ptr) = NULL; + if (RETURN_VALUE_USED(opline)) { + EG(return_value_ptr_ptr) = &EX_T(opline->result.u.var).var.ptr; + EX_T(opline->result.u.var).var.ptr = NULL; + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference; } - EG(active_symbol_table) = EX(function_state).function_symbol_table; - original_return_value = EG(return_value_ptr_ptr); - EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr; - EG(active_op_array) = (zend_op_array *) EX(function_state).function; - zend_execute(EG(active_op_array) TSRMLS_CC); - EX_T(opline->result.u.var).var.fcall_returned_reference = EG(active_op_array)->return_reference; - - if (return_value_used && !EX_T(opline->result.u.var).var.ptr) { - if (!EG(exception)) { - ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - } - } else if (!return_value_used && EX_T(opline->result.u.var).var.ptr) { - zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); +#ifndef ZEND_VM_EXPORT + if (zend_execute == execute && !EG(exception)) { + EX(call_opline) = opline; + ZEND_VM_ENTER(); + } else { + zend_execute(EG(active_op_array) TSRMLS_CC); } +#else + zend_execute(EG(active_op_array) TSRMLS_CC); +#endif EG(opline_ptr) = &EX(opline); EG(active_op_array) = EX(op_array); - EG(return_value_ptr_ptr)=original_return_value; - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(EX(function_state).function_symbol_table); - FREE_HASHTABLE(EX(function_state).function_symbol_table); - } else { - /* clean before putting into the cache, since clean - could call dtors, which could use cached hash */ - zend_hash_clean(EX(function_state).function_symbol_table); - *(++EG(symtable_cache_ptr)) = EX(function_state).function_symbol_table; + EG(return_value_ptr_ptr) = EX(original_return_value); + if (EG(active_symbol_table)) { + if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { + zend_hash_destroy(EG(active_symbol_table)); + FREE_HASHTABLE(EG(active_symbol_table)); + } else { + /* clean before putting into the cache, since clean + could call dtors, which could use cached hash */ + zend_hash_clean(EG(active_symbol_table)); + *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); + } } EG(active_symbol_table) = EX(symbol_table); } else { /* ZEND_OVERLOADED_FUNCTION */ - ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr)); + ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr); /* Not sure what should be done here if it's a static method */ if (EX(object)) { - Z_OBJ_HT_P(EX(object))->call_method(EX(fbc)->common.function_name, opline->extended_value, EX_T(opline->result.u.var).var.ptr, &EX_T(opline->result.u.var).var.ptr, EX(object), return_value_used TSRMLS_CC); + Z_OBJ_HT_P(EX(object))->call_method(EX(function_state).function->common.function_name, opline->extended_value, EX_T(opline->result.u.var).var.ptr, &EX_T(opline->result.u.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); } else { zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object"); } @@ -2038,45 +2370,46 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { efree(EX(function_state).function->common.function_name); } - efree(EX(fbc)); + efree(EX(function_state).function); - if (!return_value_used) { + if (!RETURN_VALUE_USED(opline)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->is_ref = 0; - EX_T(opline->result.u.var).var.ptr->refcount = 1; + Z_UNSET_ISREF_P(EX_T(opline->result.u.var).var.ptr); + Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); + EX_T(opline->result.u.var).var.fcall_returned_reference = 0; + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; } } EX(function_state).function = (zend_function *) EX(op_array); - EG(function_state_ptr) = &EX(function_state); - ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack)); + EX(function_state).arguments = NULL; - if (EG(This)) { - if (EG(exception) && ctor_opline) { - if (RETURN_VALUE_USED(ctor_opline)) { - EG(This)->refcount--; - } - if (EG(This)->refcount == 1) { - zend_object_store_ctor_failed(EG(This) TSRMLS_CC); + if (should_change_scope) { + if (EG(This)) { + if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) { + if (IS_CTOR_USED(EX(called_scope))) { + Z_DELREF_P(EG(This)); + } + if (Z_REFCOUNT_P(EG(This)) == 1) { + zend_object_store_ctor_failed(EG(This) TSRMLS_CC); + } } - } - if (should_change_scope) { zval_ptr_dtor(&EG(This)); } + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); } - if (should_change_scope) { - EG(This) = current_this; - EG(scope) = current_scope; - } - zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc)); + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); - zend_ptr_stack_clear_multiple(TSRMLS_C); + zend_vm_stack_clear_multiple(TSRMLS_C); if (EG(exception)) { zend_throw_exception_internal(NULL TSRMLS_CC); - if (return_value_used && EX_T(opline->result.u.var).var.ptr) { + if (RETURN_VALUE_USED(opline) && EX_T(opline->result.u.var).var.ptr) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } } @@ -2096,9 +2429,9 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY) zend_free_op free_op1; zval *fname = GET_OP1_ZVAL_PTR(BP_VAR_R); - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) { + if (zend_hash_quick_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, Z_LVAL(opline->op2.u.constant), (void **) &EX(function_state).function)==FAILURE) { zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); } EX(object) = NULL; @@ -2125,11 +2458,11 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) retval_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); - if (!retval_ptr_ptr) { + if (OP1_TYPE == IS_VAR && !retval_ptr_ptr) { zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference"); } - if (OP1_TYPE == IS_VAR && !(*retval_ptr_ptr)->is_ref) { + if (OP1_TYPE == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && EX_T(opline->op1.u.var).var.fcall_returned_reference) { } else if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { @@ -2141,36 +2474,25 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) } } - SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); - (*retval_ptr_ptr)->refcount++; + if (EG(return_value_ptr_ptr)) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); + Z_ADDREF_PP(retval_ptr_ptr); - (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + } } else { ZEND_VM_C_LABEL(return_by_value): retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); + if (!EG(return_value_ptr_ptr)) { + if (OP1_TYPE == IS_TMP_VAR) { + FREE_OP1(); } } else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ - if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || - (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0)) { + if (OP1_TYPE == IS_CONST || + EG(active_op_array)->return_reference == ZEND_RETURN_REF || + (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; ALLOC_ZVAL(ret); @@ -2179,7 +2501,7 @@ ZEND_VM_C_LABEL(return_by_value): *EG(return_value_ptr_ptr) = ret; } else { *EG(return_value_ptr_ptr) = retval_ptr; - retval_ptr->refcount++; + Z_ADDREF_P(retval_ptr); } } else { zval *ret; @@ -2190,7 +2512,7 @@ ZEND_VM_C_LABEL(return_by_value): } } FREE_OP1_IF_VAR(); - ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) @@ -2205,6 +2527,7 @@ ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } + zend_exception_save(TSRMLS_C); /* Not sure if a complete copy is what we want here */ ALLOC_ZVAL(exception); INIT_PZVAL_COPY(exception, value); @@ -2213,16 +2536,18 @@ ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) } zend_throw_exception_object(exception TSRMLS_CC); + zend_exception_restore(TSRMLS_C); FREE_OP1_IF_VAR(); ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(107, ZEND_CATCH, ANY, ANY) +ZEND_VM_HANDLER(107, ZEND_CATCH, ANY, CV) { zend_op *opline = EX(opline); zend_class_entry *ce; /* Check whether an exception has been thrown, if not, jump over code */ + zend_exception_restore(TSRMLS_C); if (EG(exception) == NULL) { ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); ZEND_VM_CONTINUE(); /* CHECK_ME */ @@ -2239,8 +2564,17 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, ANY, ANY) } } - zend_hash_update(EG(active_symbol_table), opline->op2.u.constant.value.str.val, - opline->op2.u.constant.value.str.len+1, &EG(exception), sizeof(zval *), (void **) NULL); + if (!EG(active_symbol_table)) { + if (EX(CVs)[opline->op2.u.var]) { + zval_ptr_dtor(EX(CVs)[opline->op2.u.var]); + } + EX(CVs)[opline->op2.u.var] = (zval**)EX(CVs) + (EX(op_array)->last_var + opline->op2.u.var); + *EX(CVs)[opline->op2.u.var] = EG(exception); + } else { + zend_compiled_variable *cv = &CV_DEF_OF(opline->op2.u.var); + zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, + &EG(exception), sizeof(zval *), (void**)&EX(CVs)[opline->op2.u.var]); + } EG(exception) = NULL; ZEND_VM_NEXT_OPCODE(); } @@ -2264,7 +2598,7 @@ ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP|VAR|CV, ANY) if (!IS_OP1_TMP_FREE()) { zval_copy_ctor(valptr); } - zend_ptr_stack_push(&EG(argument_stack), valptr); + zend_vm_stack_push(valptr TSRMLS_CC); FREE_OP1_IF_VAR(); } ZEND_VM_NEXT_OPCODE(); @@ -2280,18 +2614,18 @@ ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY) if (varptr == &EG(uninitialized_zval)) { ALLOC_ZVAL(varptr); INIT_ZVAL(*varptr); - varptr->refcount = 0; + Z_SET_REFCOUNT_P(varptr, 0); } else if (PZVAL_IS_REF(varptr)) { zval *original_var = varptr; ALLOC_ZVAL(varptr); *varptr = *original_var; - varptr->is_ref = 0; - varptr->refcount = 0; + Z_UNSET_ISREF_P(varptr); + Z_SET_REFCOUNT_P(varptr, 0); zval_copy_ctor(varptr); } - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + Z_ADDREF_P(varptr); + zend_vm_stack_push(varptr TSRMLS_CC); FREE_OP1(); /* for string offsets */ ZEND_VM_NEXT_OPCODE(); @@ -2324,10 +2658,10 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) EX_T(opline->op1.u.var).var.fcall_returned_reference) && varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || - (varptr->refcount == 1 && (OP1_TYPE == IS_CV || free_op1.var)))) { - varptr->is_ref = 1; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + (Z_REFCOUNT_P(varptr) == 1 && (OP1_TYPE == IS_CV || free_op1.var)))) { + Z_SET_ISREF_P(varptr); + Z_ADDREF_P(varptr); + zend_vm_stack_push(varptr TSRMLS_CC); } else { zval *valptr; @@ -2339,7 +2673,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) if (!IS_OP1_TMP_FREE()) { zval_copy_ctor(valptr); } - zend_ptr_stack_push(&EG(argument_stack), valptr); + zend_vm_stack_push(valptr TSRMLS_CC); } FREE_OP1_IF_VAR(); ZEND_VM_NEXT_OPCODE(); @@ -2353,14 +2687,14 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY) zval *varptr; varptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); - if (!varptr_ptr) { + if (OP1_TYPE == IS_VAR && !varptr_ptr) { zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); } SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr_ptr); varptr = *varptr_ptr; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + Z_ADDREF_P(varptr); + zend_vm_stack_push(varptr TSRMLS_CC); FREE_OP1_VAR_PTR(); ZEND_VM_NEXT_OPCODE(); @@ -2380,19 +2714,20 @@ ZEND_VM_HANDLER(66, ZEND_SEND_VAR, VAR|CV, ANY) ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) { zend_op *opline = EX(opline); - zval **param; zend_uint arg_num = Z_LVAL(opline->op1.u.constant); + zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); - if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { + if (param == NULL) { char *space; char *class_name = get_active_class_name(&space TSRMLS_CC); zend_execute_data *ptr = EX(prev_execute_data); - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC); - if(ptr && ptr->op_array) { - zend_error(E_WARNING, "Missing argument %ld for %s%s%s(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); - } else { - zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) { + if(ptr && ptr->op_array) { + zend_error(E_WARNING, "Missing argument %ld for %s%s%s(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); + } else { + zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + } } if (opline->result.op_type == IS_VAR) { PZVAL_UNLOCK_FREE(*EX_T(opline->result.u.var).var.ptr_ptr); @@ -2401,13 +2736,11 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) zend_free_op free_res; zval **var_ptr; - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W); - if (PZVAL_IS_REF(*param)) { - zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC); - } else { - zend_receive(var_ptr, *param TSRMLS_CC); - } + Z_DELREF_PP(var_ptr); + *var_ptr = *param; + Z_ADDREF_PP(var_ptr); } ZEND_VM_NEXT_OPCODE(); @@ -2416,40 +2749,32 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) { zend_op *opline = EX(opline); - zval **param, *assignment_value; + zval *assignment_value; zend_uint arg_num = Z_LVAL(opline->op1.u.constant); zend_free_op free_res; + zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); + zval **var_ptr; - if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { - if (Z_TYPE(opline->op2.u.constant) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { - zval *default_value; - - ALLOC_ZVAL(default_value); - *default_value = opline->op2.u.constant; - default_value->refcount=1; - zval_update_constant(&default_value, 0 TSRMLS_CC); - default_value->refcount=0; - default_value->is_ref=0; - param = &default_value; - assignment_value = default_value; + if (param == NULL) { + ALLOC_ZVAL(assignment_value); + *assignment_value = opline->op2.u.constant; + if ((Z_TYPE(opline->op2.u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { + Z_SET_REFCOUNT_P(assignment_value, 1); + zval_update_constant(&assignment_value, 0 TSRMLS_CC); } else { - param = NULL; - assignment_value = &opline->op2.u.constant; + zval_copy_ctor(assignment_value); } - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC); - zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, EX(Ts) TSRMLS_CC); + INIT_PZVAL(assignment_value); } else { - zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W); - assignment_value = *param; - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC); - if (PZVAL_IS_REF(assignment_value)) { - zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC); - } else { - zend_receive(var_ptr, assignment_value TSRMLS_CC); - } + Z_ADDREF_P(assignment_value); } + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); + var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W); + Z_DELREF_PP(var_ptr); + *var_ptr = assignment_value; + ZEND_VM_NEXT_OPCODE(); } @@ -2490,6 +2815,32 @@ ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST|TMP|VAR|CV) ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } +ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST) +{ + zend_op *brk_opline; + zend_op *opline = EX(opline); + zend_brk_cont_element *el; + + el = zend_brk_cont(&opline->op2.u.constant, opline->extended_value, + EX(op_array), EX(Ts) TSRMLS_CC); + + brk_opline = EX(op_array)->opcodes + el->brk; + + switch (brk_opline->opcode) { + case ZEND_SWITCH_FREE: + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zend_switch_free(&EX_T(brk_opline->op1.u.var), brk_opline->extended_value TSRMLS_CC); + } + break; + case ZEND_FREE: + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var); + } + break; + } + ZEND_VM_JMP(opline->op1.u.jmp_addr); +} + ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) { zend_op *opline = EX(opline); @@ -2501,7 +2852,7 @@ ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -2517,14 +2868,16 @@ ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) */ FREE_OP1(); EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(49, ZEND_SWITCH_FREE, TMP|VAR, ANY) +ZEND_VM_HANDLER(49, ZEND_SWITCH_FREE, VAR, ANY) { - zend_switch_free(EX(opline), EX(Ts) TSRMLS_CC); + zend_op *opline = EX(opline); + + zend_switch_free(&EX_T(opline->op1.u.var), opline->extended_value TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } @@ -2552,22 +2905,23 @@ ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY) if (constructor == NULL) { if (RETURN_VALUE_USED(opline)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr = object_zval; + AI_SET_PTR(EX_T(opline->result.u.var).var, object_zval); } else { zval_ptr_dtor(&object_zval); } ZEND_VM_JMP(EX(op_array)->opcodes + opline->op2.u.opline_num); } else { - SELECTIVE_PZVAL_LOCK(object_zval, &opline->result); - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr = object_zval; + if (RETURN_VALUE_USED(opline)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, object_zval); + PZVAL_LOCK(object_zval); + } - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), opline); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), ENCODE_CTOR(EX(called_scope), RETURN_VALUE_USED(opline))); /* We are not handling overloaded classes right now */ EX(object) = object_zval; EX(fbc) = constructor; + EX(called_scope) = EX_T(opline->op1.u.var).class_entry; ZEND_VM_NEXT_OPCODE(); } @@ -2584,10 +2938,6 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY) if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "__clone method called on non-object"); - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; - FREE_OP1_IF_VAR(); - ZEND_VM_NEXT_OPCODE(); } ce = Z_OBJCE_P(obj); @@ -2599,8 +2949,6 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY) } else { zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object"); } - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; } if (ce && clone) { @@ -2624,8 +2972,8 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY) ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; - EX_T(opline->result.u.var).var.ptr->refcount=1; - EX_T(opline->result.u.var).var.ptr->is_ref=1; + Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); + Z_SET_ISREF_P(EX_T(opline->result.u.var).var.ptr); if (!RETURN_VALUE_USED(opline) || EG(exception)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } @@ -2634,49 +2982,61 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY) ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, CONST|UNUSED, CONST) +ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) { zend_op *opline = EX(opline); - zend_class_entry *ce = NULL; - zval **value; if (OP1_TYPE == IS_UNUSED) { -/* This seems to be a reminant of namespaces - if (EG(scope)) { - ce = EG(scope); - if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { - zval_update_constant(value, (void *) 1 TSRMLS_CC); - EX_T(opline->result.u.var).tmp_var = **value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - ZEND_VM_NEXT_OPCODE(); + /* namespaced constant */ + if (!zend_get_constant_ex(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var, NULL, opline->extended_value TSRMLS_CC)) { + if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { + char *actual = (char *)zend_memrchr(Z_STRVAL(opline->op2.u.constant), '\\', Z_STRLEN(opline->op2.u.constant)); + if(!actual) { + actual = Z_STRVAL(opline->op2.u.constant); + } else { + actual++; + } + /* non-qualified constant - allow text substitution */ + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); + ZVAL_STRINGL(&EX_T(opline->result.u.var).tmp_var, actual, Z_STRLEN(opline->op2.u.constant)-(actual - Z_STRVAL(opline->op2.u.constant)), 1); + } else { + zend_error_noreturn(E_ERROR, "Undefined constant '%s'", + Z_STRVAL(opline->op2.u.constant), Z_STRVAL(opline->op2.u.constant)); } } -*/ - if (!zend_get_constant(opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len, &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - opline->op2.u.constant.value.str.val, - opline->op2.u.constant.value.str.val); - EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - } ZEND_VM_NEXT_OPCODE(); - } + } else { + /* class constant */ + zend_class_entry *ce; + zval **value; + + if (OP1_TYPE == IS_CONST) { + + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + } else { + ce = EX_T(opline->op1.u.var).class_entry; + } - ce = EX_T(opline->op1.u.var).class_entry; + if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { + if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || + (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + zend_class_entry *old_scope = EG(scope); - if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { - zend_class_entry *old_scope = EG(scope); + EG(scope) = ce; + zval_update_constant(value, (void *) 1 TSRMLS_CC); + EG(scope) = old_scope; + } + EX_T(opline->result.u.var).tmp_var = **value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } else { + zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } - EG(scope) = ce; - zval_update_constant(value, (void *) 1 TSRMLS_CC); - EG(scope) = old_scope; - EX_T(opline->result.u.var).tmp_var = **value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - } else { - zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", opline->op2.u.constant.value.str.val); + ZEND_VM_NEXT_OPCODE(); } - - ZEND_VM_NEXT_OPCODE(); } ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUSED|CV) @@ -2711,10 +3071,10 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; - } else + Z_ADDREF_P(expr_ptr); + } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (OP1_TYPE == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -2722,13 +3082,15 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -2831,7 +3193,6 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); zend_op_array *new_op_array=NULL; - zval **original_return_value = EG(return_value_ptr_ptr); int return_value_used; zend_free_op free_op1; zval *inc_filename = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -2851,42 +3212,40 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { zend_file_handle file_handle; + char *resolved_path; - if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) { - cwd_state state; - - state.cwd_length = 0; - state.cwd = malloc(1); - state.cwd[0] = 0; - - failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) && - zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)); - - free(state.cwd); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + if (resolved_path) { + failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); + } else { + resolved_path = Z_STRVAL_P(inc_filename); } if (failure_retval) { - /* do nothing */ - } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { + /* do nothing, file already included */ + } else if (SUCCESS == zend_stream_open(resolved_path, &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); + file_handle.opened_path = estrdup(resolved_path); } if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) { new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { - zend_file_handle_dtor(&file_handle); + zend_file_handle_dtor(&file_handle TSRMLS_CC); failure_retval=1; } } else { if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } } + if (resolved_path != Z_STRVAL_P(inc_filename)) { + efree(resolved_path); + } } break; case ZEND_INCLUDE: @@ -2905,31 +3264,34 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) if (inc_filename==&tmp_inc_filename) { zval_dtor(&tmp_inc_filename); } + FREE_OP1(); EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; - if (new_op_array) { - zval *saved_object; - zend_function *saved_function; - - EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr; + if (new_op_array && !EG(exception)) { + EX(original_return_value) = EG(return_value_ptr_ptr); + EG(return_value_ptr_ptr) = return_value_used ? EX_T(opline->result.u.var).var.ptr_ptr : NULL; EG(active_op_array) = new_op_array; EX_T(opline->result.u.var).var.ptr = NULL; - saved_object = EX(object); - saved_function = EX(function_state).function; + EX(current_object) = EX(object); EX(function_state).function = (zend_function *) new_op_array; EX(object) = NULL; - zend_execute(new_op_array TSRMLS_CC); + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + + if (zend_execute == execute) { + EX(call_opline) = opline; + ZEND_VM_ENTER(); + } else { + zend_execute(new_op_array TSRMLS_CC); + } - EX(function_state).function = saved_function; - EX(object) = saved_object; + EX(function_state).function = (zend_function *) EX(op_array); + EX(object) = EX(current_object); - if (!return_value_used) { - if (EX_T(opline->result.u.var).var.ptr) { - zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); - } - } else { /* return value is used */ + if (return_value_used) { if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); @@ -2940,7 +3302,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) EG(opline_ptr) = &EX(opline); EG(active_op_array) = EX(op_array); - EG(function_state_ptr) = &EX(function_state); + EG(return_value_ptr_ptr) = EX(original_return_value); destroy_op_array(new_op_array TSRMLS_CC); efree(new_op_array); if (EG(exception)) { @@ -2954,8 +3316,6 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } - FREE_OP1(); - EG(return_value_ptr_ptr) = original_return_value; ZEND_VM_NEXT_OPCODE(); } @@ -2966,6 +3326,36 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY) HashTable *target_symbol_table; zend_free_op free_op1; + if (OP1_TYPE == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EG(active_symbol_table)) { + zend_execute_data *ex = EX(prev_execute_data); + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); + + if (zend_hash_quick_del(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + while (ex && ex->symbol_table == EG(active_symbol_table)) { + int i; + + if (ex->op_array) { + for (i = 0; i < ex->op_array->last_var; i++) { + if (ex->op_array->vars[i].hash_value == cv->hash_value && + ex->op_array->vars[i].name_len == cv->name_len && + !memcmp(ex->op_array->vars[i].name, cv->name, cv->name_len)) { + ex->CVs[i] = NULL; + break; + } + } + } + ex = ex->prev_execute_data; + } + } + EX(CVs)[opline->op1.u.var] = NULL; + } else if (EX(CVs)[opline->op1.u.var]) { + zval_ptr_dtor(EX(CVs)[opline->op1.u.var]); + EX(CVs)[opline->op1.u.var] = NULL; + } + ZEND_VM_NEXT_OPCODE(); + } + varname = GET_OP1_ZVAL_PTR(BP_VAR_R); if (Z_TYPE_P(varname) != IS_STRING) { @@ -2973,17 +3363,18 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY) zval_copy_ctor(&tmp); convert_to_string(&tmp); varname = &tmp; - } else if (OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) { - varname->refcount++; + } else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { + Z_ADDREF_P(varname); } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); } else { + ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1) == SUCCESS) { - zend_execute_data *ex = EXECUTE_DATA; - ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); + if (zend_hash_quick_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value) == SUCCESS) { + zend_execute_data *ex = EXECUTE_DATA; do { int i; @@ -3005,7 +3396,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY) if (varname == &tmp) { zval_dtor(&tmp); - } else if (OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) { + } else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { zval_ptr_dtor(&varname); } FREE_OP1(); @@ -3020,7 +3411,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); long index; - if (container) { + if (OP1_TYPE != IS_VAR || container) { if (OP1_TYPE == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -3041,7 +3432,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) break; case IS_STRING: if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -3113,7 +3504,7 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV) zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET); zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); - if (container) { + if (OP1_TYPE != IS_VAR || container) { if (OP1_TYPE == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -3121,7 +3512,11 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV) if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&offset); } else { @@ -3161,18 +3556,18 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) ce = Z_OBJCE_PP(array_ptr_ptr); if (!ce || ce->get_iterator == NULL) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); - (*array_ptr_ptr)->refcount++; + Z_ADDREF_PP(array_ptr_ptr); } array_ptr = *array_ptr_ptr; } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); if (opline->extended_value & ZEND_FE_FETCH_BYREF) { - (*array_ptr_ptr)->is_ref = 1; + Z_SET_ISREF_PP(array_ptr_ptr); } } array_ptr = *array_ptr_ptr; - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { array_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -3185,12 +3580,12 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); if (!ce || !ce->get_iterator) { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && - !array_ptr->is_ref && - array_ptr->refcount > 1) { + !Z_ISREF_P(array_ptr) && + Z_REFCOUNT_P(array_ptr) > 1) { zval *tmp; ALLOC_ZVAL(tmp); @@ -3198,7 +3593,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) zval_copy_ctor(tmp); array_ptr = tmp; } else { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } } @@ -3222,16 +3617,15 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) } } + AI_SET_PTR(EX_T(opline->result.u.var).var, array_ptr); PZVAL_LOCK(array_ptr); - EX_T(opline->result.u.var).var.ptr = array_ptr; - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; if (iter) { iter->index = 0; if (iter->funcs->rewind) { iter->funcs->rewind(iter TSRMLS_CC); if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { FREE_OP1_VAR_PTR(); @@ -3243,7 +3637,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) } is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS; if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { FREE_OP1_VAR_PTR(); @@ -3361,7 +3755,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) * In case that ever happens we need an additional flag. */ iter->funcs->move_forward(iter TSRMLS_CC); if (EG(exception)) { - array->refcount--; + Z_DELREF_P(array); zval_ptr_dtor(&array); ZEND_VM_NEXT_OPCODE(); } @@ -3370,7 +3764,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) if (!iter || (iter->index > 0 && iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) { /* reached end of iteration */ if (EG(exception)) { - array->refcount--; + Z_DELREF_P(array); zval_ptr_dtor(&array); ZEND_VM_NEXT_OPCODE(); } @@ -3378,7 +3772,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) } iter->funcs->get_current_data(iter, &value TSRMLS_CC); if (EG(exception)) { - array->refcount--; + Z_DELREF_P(array); zval_ptr_dtor(&array); ZEND_VM_NEXT_OPCODE(); } @@ -3390,7 +3784,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) if (iter->funcs->get_current_key) { key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC); if (EG(exception)) { - array->refcount--; + Z_DELREF_P(array); zval_ptr_dtor(&array); ZEND_VM_NEXT_OPCODE(); } @@ -3404,13 +3798,12 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) if (opline->extended_value & ZEND_FE_FETCH_BYREF) { SEPARATE_ZVAL_IF_NOT_REF(value); - (*value)->is_ref = 1; + Z_SET_ISREF_PP(value); EX_T(opline->result.u.var).var.ptr_ptr = value; - (*value)->refcount++; + Z_ADDREF_PP(value); } else { - EX_T(opline->result.u.var).var.ptr_ptr = value; - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, *value); + PZVAL_LOCK(*value); } if (use_key) { @@ -3441,34 +3834,54 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); - zend_free_op free_op1; - zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS); zval **value; zend_bool isset = 1; - HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { - tmp = *varname; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - varname = &tmp; - } + if (OP1_TYPE == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EX(CVs)[opline->op1.u.var]) { + value = EX(CVs)[opline->op1.u.var]; + } else if (EG(active_symbol_table)) { + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); - if (!value) { + if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + isset = 0; + } + } else { isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { - isset = 0; + HashTable *target_symbol_table; + zend_free_op free_op1; + zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS); + + if (Z_TYPE_P(varname) != IS_STRING) { + tmp = *varname; + zval_copy_ctor(&tmp); + convert_to_string(&tmp); + varname = &tmp; + } + + if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { + value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); + if (!value) { + isset = 0; + } + } else { + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); + if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { + isset = 0; + } + } + + if (varname == &tmp) { + zval_dtor(&tmp); } + FREE_OP1(); } Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; - switch (opline->extended_value) { + switch (opline->extended_value & ZEND_ISSET_ISEMPTY_MASK) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; @@ -3485,11 +3898,6 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, ANY) break; } - if (varname == &tmp) { - zval_dtor(&tmp); - } - FREE_OP1(); - ZEND_VM_NEXT_OPCODE(); } @@ -3502,7 +3910,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| int result = 0; long index; - if (container) { + if (OP1_TYPE != IS_VAR || container) { zend_free_op free_op2; zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); @@ -3565,9 +3973,19 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&offset); @@ -3660,7 +4078,7 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) } if (EG(error_reporting)) { - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); } ZEND_VM_NEXT_OPCODE(); } @@ -3680,7 +4098,7 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.u.var).tmp_var); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) { @@ -3689,6 +4107,26 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ANY) +{ + zend_op *opline = EX(opline); + zend_free_op free_op1; + zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R); + + if (i_zend_is_true(value)) { + EX_T(opline->result.u.var).tmp_var = *value; + zendi_zval_copy_ctor(EX_T(opline->result.u.var).tmp_var); + FREE_OP1(); +#if DEBUG_ZEND>=2 + printf("Conditional jmp to %d\n", opline->op2.u.opline_num); +#endif + ZEND_VM_JMP(opline->op2.u.jmp_addr); + } + + FREE_OP1(); + ZEND_VM_NEXT_OPCODE(); +} + ZEND_VM_HANDLER(22, ZEND_QM_ASSIGN, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); @@ -3743,6 +4181,19 @@ ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, ANY, ANY) ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY) +{ + zend_op *opline = EX(opline); + zend_class_entry **pce, **pce_orig; + + if (zend_hash_find(EG(class_table), Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void**)&pce) == FAILURE || + (zend_hash_find(EG(class_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), (void**)&pce_orig) == SUCCESS && + *pce != *pce_orig)) { + do_bind_inherited_class(opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); + } + ZEND_VM_NEXT_OPCODE(); +} + ZEND_VM_HANDLER(141, ZEND_DECLARE_FUNCTION, ANY, ANY) { do_bind_function(EX(opline), EG(function_table), 0); @@ -3789,11 +4240,11 @@ ZEND_VM_HANDLER(0, ZEND_NOP, ANY, ANY) ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, ANY) +ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST) { zend_op *opline = EX(opline); zend_class_entry *ce = EX_T(opline->op1.u.var).class_entry; - zend_class_entry *iface = EX_T(opline->op2.u.var).class_entry; + zend_class_entry *iface = zend_fetch_class(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), opline->extended_value TSRMLS_CC); if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) { zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name); @@ -3810,15 +4261,14 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) int i; zend_uint catch_op_num; int catched = 0; - zval **stack_zval_pp; zval restored_error_reporting; + + void **stack_frame = (void**)EX(Ts) + + (sizeof(temp_variable) * EX(op_array)->T) / sizeof(void*); - stack_zval_pp = (zval **) EG(argument_stack).top_element - 1; - while (*stack_zval_pp != NULL) { - zval_ptr_dtor(stack_zval_pp); - EG(argument_stack).top_element--; - EG(argument_stack).top--; - stack_zval_pp--; + while (zend_vm_stack_top(TSRMLS_C) != stack_frame) { + zval *stack_zval_p = zend_vm_stack_pop(TSRMLS_C); + zval_ptr_dtor(&stack_zval_p); } for (i=0; ilast_try_catch; i++) { @@ -3834,14 +4284,14 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) } while (EX(fbc)) { - zend_op *ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack)); - + EX(called_scope) = (zend_class_entry*)zend_ptr_stack_pop(&EG(arg_types_stack)); if (EX(object)) { - if (ctor_opline && RETURN_VALUE_USED(ctor_opline)) { - EX(object)->refcount--; + if (IS_CTOR_USED(EX(called_scope))) { + Z_DELREF_P(EX(object)); } zval_ptr_dtor(&EX(object)); } + EX(called_scope) = DECODE_CTOR(EX(called_scope)); zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc)); } @@ -3858,10 +4308,14 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) switch (brk_opline->opcode) { case ZEND_SWITCH_FREE: - zend_switch_free(brk_opline, EX(Ts) TSRMLS_CC); + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zend_switch_free(&EX_T(brk_opline->op1.u.var), brk_opline->extended_value TSRMLS_CC); + } break; case ZEND_FREE: - zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var); + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var); + } break; } } @@ -3873,13 +4327,13 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; if (!catched) { - ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } else { ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); ZEND_VM_CONTINUE(); @@ -3900,12 +4354,62 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY) case ZEND_USER_OPCODE_CONTINUE: ZEND_VM_CONTINUE(); case ZEND_USER_OPCODE_RETURN: - ZEND_VM_RETURN(); + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); case ZEND_USER_OPCODE_DISPATCH: ZEND_VM_DISPATCH(EX(opline)->opcode, EX(opline)); default: - ZEND_VM_DISPATCH(ret & 0xff, EX(opline)); + ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), EX(opline)); + } +} + +ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) +{ + zend_op *opline = EX(opline); + zend_free_op free_op1, free_op2; + zval *name = GET_OP1_ZVAL_PTR(BP_VAR_R); + zval *val = GET_OP2_ZVAL_PTR(BP_VAR_R); + zend_constant c; + + if ((Z_TYPE_P(val) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { + zval tmp = *val; + zval *tmp_ptr = &tmp; + + if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { + zval_copy_ctor(&tmp); + } + INIT_PZVAL(&tmp); + zval_update_constant(&tmp_ptr, NULL TSRMLS_CC); + c.value = *tmp_ptr; + } else { + c.value = *val; + zval_copy_ctor(&c.value); } + c.flags = CONST_CS; /* non persistent, case sensetive */ + c.name = zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + c.name_len = Z_STRLEN_P(name)+1; + c.module_number = PHP_USER_CONSTANT; + + if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { + } + + FREE_OP1(); + FREE_OP2(); + ZEND_VM_NEXT_OPCODE(); +} + +ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, CONST) +{ + zend_op *opline = EX(opline); + zend_function *op_array; + + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), Z_LVAL(opline->op2.u.constant), (void *) &op_array) == FAILURE || + op_array->type != ZEND_USER_FUNCTION) { + zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); + } + + zend_create_closure(&EX_T(opline->result.u.var).tmp_var, op_array TSRMLS_CC); + + ZEND_VM_NEXT_OPCODE(); } ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 50176ad13..11bd18b9a 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -static opcode_handler_t zend_user_opcode_handlers[256] = {(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL}; +static user_opcode_handler_t zend_user_opcode_handlers[256] = {(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL,(user_opcode_handler_t)NULL}; static zend_uchar zend_user_opcodes[256] = {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,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,157,158,159,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,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}; @@ -27,80 +27,100 @@ static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* o #define ZEND_VM_CONTINUE() return 0 #define ZEND_VM_RETURN() return 1 +#define ZEND_VM_ENTER() return 2 +#define ZEND_VM_LEAVE() return 3 #define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); #define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC +#undef EX +#define EX(element) execute_data->element + ZEND_API void execute(zend_op_array *op_array TSRMLS_DC) { - zend_execute_data execute_data; + zend_execute_data *execute_data; + zend_bool nested = 0; + zend_bool original_in_execution = EG(in_execution); if (EG(exception)) { return; } + EG(in_execution) = 1; + +zend_vm_enter: /* Initialize execute_data */ + execute_data = (zend_execute_data *)zend_vm_stack_alloc( + sizeof(zend_execute_data) + + sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2) + + sizeof(temp_variable) * op_array->T TSRMLS_CC); + + EX(CVs) = (zval***)((char*)execute_data + sizeof(zend_execute_data)); + memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); + EX(Ts) = (temp_variable *)(EX(CVs) + op_array->last_var * (EG(active_symbol_table) ? 1 : 2)); EX(fbc) = NULL; + EX(called_scope) = NULL; EX(object) = NULL; EX(old_error_reporting) = NULL; - if (op_array->T < TEMP_VAR_STACK_LIMIT) { - EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T); - } else { - EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0); - } - EX(CVs) = (zval***)do_alloca(sizeof(zval**) * op_array->last_var); - memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); EX(op_array) = op_array; - EX(original_in_execution) = EG(in_execution); EX(symbol_table) = EG(active_symbol_table); EX(prev_execute_data) = EG(current_execute_data); - EG(current_execute_data) = &execute_data; + EG(current_execute_data) = execute_data; + EX(nested) = nested; + nested = 1; - EG(in_execution) = 1; if (op_array->start_op) { ZEND_VM_SET_OPCODE(op_array->start_op); } else { ZEND_VM_SET_OPCODE(op_array->opcodes); } - if (op_array->uses_this && EG(This)) { - EG(This)->refcount++; /* For $this pointer */ - if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), NULL)==FAILURE) { - EG(This)->refcount--; + if (op_array->this_var != -1 && EG(This)) { + Z_ADDREF_P(EG(This)); /* For $this pointer */ + if (!EG(active_symbol_table)) { + EX(CVs)[op_array->this_var] = (zval**)EX(CVs) + (op_array->last_var + op_array->this_var); + *EX(CVs)[op_array->this_var] = EG(This); + } else { + if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void**)&EX(CVs)[op_array->this_var])==FAILURE) { + Z_DELREF_P(EG(This)); + } } } EG(opline_ptr) = &EX(opline); EX(function_state).function = (zend_function *) op_array; - EG(function_state_ptr) = &EX(function_state); -#if ZEND_DEBUG - /* function_state.function_symbol_table is saved as-is to a stack, - * which is an intentional UMR. Shut it up if we're in DEBUG. - */ - EX(function_state).function_symbol_table = NULL; -#endif + EX(function_state).arguments = NULL; while (1) { + int ret; #ifdef ZEND_WIN32 if (EG(timed_out)) { zend_timeout(0); } #endif - if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) { - return; + if ((ret = EX(opline)->handler(execute_data TSRMLS_CC)) > 0) { + switch (ret) { + case 1: + EG(in_execution) = original_in_execution; + return; + case 2: + op_array = EG(active_op_array); + goto zend_vm_enter; + case 3: + execute_data = EG(current_execute_data); + default: + break; + } } } zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen"); } -#undef EX -#define EX(element) execute_data->element - -static int ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { #if DEBUG_ZEND>=2 printf("Jumping to %d\n", EX(opline)->op1.u.opline_num); @@ -109,28 +129,129 @@ static int ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_CONTINUE(); /* CHECK_ME */ } -static int ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zval *tmp = &EX_T(EX(opline)->result.u.var).tmp_var; tmp->value.str.val = emalloc(1); tmp->value.str.val[0] = 0; tmp->value.str.len = 0; - tmp->refcount = 1; + Z_SET_REFCOUNT_P(tmp, 1); tmp->type = IS_STRING; - tmp->is_ref = 0; + Z_UNSET_ISREF_P(tmp); ZEND_VM_NEXT_OPCODE(); } -static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_bool nested; + zend_op_array *op_array = EX(op_array); + + EG(current_execute_data) = EX(prev_execute_data); + EG(opline_ptr) = NULL; + if (!EG(active_symbol_table)) { + zval ***cv = EX(CVs); + zval ***end = cv + EX(op_array)->last_var; + while (cv != end) { + if (*cv) { + zval_ptr_dtor(*cv); + } + cv++; + } + } + + nested = EX(nested); + + zend_vm_stack_free(execute_data TSRMLS_CC); + + if (nested) { + execute_data = EG(current_execute_data); + + if (EX(call_opline)->opcode == ZEND_INCLUDE_OR_EVAL) { + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + EX(object) = EX(current_object); + + if (RETURN_VALUE_USED(EX(call_opline))) { + if (!EX_T(EX(call_opline)->result.u.var).var.ptr) { /* there was no return statement */ + ALLOC_ZVAL(EX_T(EX(call_opline)->result.u.var).var.ptr); + INIT_PZVAL(EX_T(EX(call_opline)->result.u.var).var.ptr); + Z_LVAL_P(EX_T(EX(call_opline)->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(EX(call_opline)->result.u.var).var.ptr) = IS_BOOL; + } + } + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + destroy_op_array(op_array TSRMLS_CC); + efree(op_array); + if (EG(exception)) { + zend_throw_exception_internal(NULL TSRMLS_CC); + } + + EX(opline)++; + ZEND_VM_LEAVE(); + } else { + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + if (EG(active_symbol_table)) { + if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { + zend_hash_destroy(EG(active_symbol_table)); + FREE_HASHTABLE(EG(active_symbol_table)); + } else { + /* clean before putting into the cache, since clean + could call dtors, which could use cached hash */ + zend_hash_clean(EG(active_symbol_table)); + *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); + } + } + EG(active_symbol_table) = EX(symbol_table); + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + + if (EG(This)) { + if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) { + if (IS_CTOR_USED(EX(called_scope))) { + Z_DELREF_P(EG(This)); + } + if (Z_REFCOUNT_P(EG(This)) == 1) { + zend_object_store_ctor_failed(EG(This) TSRMLS_CC); + } + } + zval_ptr_dtor(&EG(This)); + } + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); + + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); + + zend_vm_stack_clear_multiple(TSRMLS_C); + + if (EG(exception)) { + zend_throw_exception_internal(NULL TSRMLS_CC); + if (RETURN_VALUE_USED(EX(call_opline)) && EX_T(EX(call_opline)->result.u.var).var.ptr) { + zval_ptr_dtor(&EX_T(EX(call_opline)->result.u.var).var.ptr); + } + } + + EX(opline)++; + ZEND_VM_LEAVE(); + } + } + ZEND_VM_RETURN(); +} + +static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval **original_return_value; - zend_class_entry *current_scope = NULL; - zval *current_this = NULL; - int return_value_used = RETURN_VALUE_USED(opline); - zend_bool should_change_scope; - zend_op *ctor_opline; + zend_bool should_change_scope = 0; if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) { if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) { @@ -138,131 +259,109 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); /* Never reached */ } if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { - zend_error(E_STRICT, "Function %s%s%s() is deprecated", + zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.function_name); } } + if (EX(function_state).function->common.scope && + !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC) && + !EX(object)) { - zend_ptr_stack_2_push(&EG(argument_stack), (void *)(zend_uintptr_t)opline->extended_value, NULL); - - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + if (EX(function_state).function->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + /* FIXME: output identifiers properly */ + zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); + } else { + /* FIXME: output identifiers properly */ + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); + } + } - if (EX(function_state).function->type == ZEND_USER_FUNCTION - || EX(function_state).function->common.scope) { + if (EX(function_state).function->type == ZEND_USER_FUNCTION || + EX(function_state).function->common.scope) { should_change_scope = 1; - current_this = EG(This); + EX(current_this) = EG(This); + EX(current_scope) = EG(scope); + EX(current_called_scope) = EG(called_scope); EG(This) = EX(object); - current_scope = EG(scope); EG(scope) = (EX(function_state).function->type == ZEND_USER_FUNCTION || !EX(object)) ? EX(function_state).function->common.scope : NULL; - } else { - should_change_scope = 0; + EG(called_scope) = EX(called_scope); } - EX_T(opline->result.u.var).var.fcall_returned_reference = 0; + zend_ptr_stack_3_pop(&EG(arg_types_stack), (void*)&EX(called_scope), (void**)&EX(current_object), (void**)&EX(fbc)); + EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC); - if (EX(function_state).function->common.scope) { - if (!EG(This) && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) { - int severity; - char *severity_word; - if (EX(function_state).function->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_STRICT; - severity_word = "should not"; - } else { - severity = E_ERROR; - severity_word = "cannot"; - } - zend_error(severity, "Non-static method %s::%s() %s be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name, severity_word); - } - } if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { - unsigned char return_reference = EX(function_state).function->common.return_reference; - - ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr)); + ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr); + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference; if (EX(function_state).function->common.arg_info) { zend_uint i=0; - zval **p; - ulong arg_count; - - p = (zval **) EG(argument_stack).top_element-2; - arg_count = (ulong)(zend_uintptr_t) *p; + zval **p = (zval**)EX(function_state).arguments; + ulong arg_count = opline->extended_value; while (arg_count>0) { - zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count) TSRMLS_CC); + zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count), 0 TSRMLS_CC); arg_count--; } } if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ - ((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), return_value_used TSRMLS_CC); + ((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); } else { - zend_execute_internal(execute_data, return_value_used TSRMLS_CC); + zend_execute_internal(execute_data, RETURN_VALUE_USED(opline) TSRMLS_CC); } - EG(current_execute_data) = execute_data; - -/* We shouldn't fix bad extensions here, - because it can break proper ones (Bug #34045) - if (!EX(function_state).function->common.return_reference) { - EX_T(opline->result.u.var).var.ptr->is_ref = 0; - EX_T(opline->result.u.var).var.ptr->refcount = 1; - } -*/ - if (!return_value_used) { + if (!RETURN_VALUE_USED(opline)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); - } else { - EX_T(opline->result.u.var).var.fcall_returned_reference = return_reference; } } else if (EX(function_state).function->type == ZEND_USER_FUNCTION) { - EX_T(opline->result.u.var).var.ptr = NULL; - if (EG(symtable_cache_ptr)>=EG(symtable_cache)) { - /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/ - EX(function_state).function_symbol_table = *(EG(symtable_cache_ptr)--); - } else { - ALLOC_HASHTABLE(EX(function_state).function_symbol_table); - zend_hash_init(EX(function_state).function_symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0); - /*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/ + EX(original_return_value) = EG(return_value_ptr_ptr); + EG(active_symbol_table) = NULL; + EG(active_op_array) = &EX(function_state).function->op_array; + EG(return_value_ptr_ptr) = NULL; + if (RETURN_VALUE_USED(opline)) { + EG(return_value_ptr_ptr) = &EX_T(opline->result.u.var).var.ptr; + EX_T(opline->result.u.var).var.ptr = NULL; + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference; } - EG(active_symbol_table) = EX(function_state).function_symbol_table; - original_return_value = EG(return_value_ptr_ptr); - EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr; - EG(active_op_array) = (zend_op_array *) EX(function_state).function; - - zend_execute(EG(active_op_array) TSRMLS_CC); - EX_T(opline->result.u.var).var.fcall_returned_reference = EG(active_op_array)->return_reference; - if (return_value_used && !EX_T(opline->result.u.var).var.ptr) { - if (!EG(exception)) { - ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - } - } else if (!return_value_used && EX_T(opline->result.u.var).var.ptr) { - zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); +#if 1 + if (zend_execute == execute && !EG(exception)) { + EX(call_opline) = opline; + ZEND_VM_ENTER(); + } else { + zend_execute(EG(active_op_array) TSRMLS_CC); } +#else + zend_execute(EG(active_op_array) TSRMLS_CC); +#endif EG(opline_ptr) = &EX(opline); EG(active_op_array) = EX(op_array); - EG(return_value_ptr_ptr)=original_return_value; - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(EX(function_state).function_symbol_table); - FREE_HASHTABLE(EX(function_state).function_symbol_table); - } else { - /* clean before putting into the cache, since clean - could call dtors, which could use cached hash */ - zend_hash_clean(EX(function_state).function_symbol_table); - *(++EG(symtable_cache_ptr)) = EX(function_state).function_symbol_table; + EG(return_value_ptr_ptr) = EX(original_return_value); + if (EG(active_symbol_table)) { + if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { + zend_hash_destroy(EG(active_symbol_table)); + FREE_HASHTABLE(EG(active_symbol_table)); + } else { + /* clean before putting into the cache, since clean + could call dtors, which could use cached hash */ + zend_hash_clean(EG(active_symbol_table)); + *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); + } } EG(active_symbol_table) = EX(symbol_table); } else { /* ZEND_OVERLOADED_FUNCTION */ - ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr)); + ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr); /* Not sure what should be done here if it's a static method */ if (EX(object)) { - Z_OBJ_HT_P(EX(object))->call_method(EX(fbc)->common.function_name, opline->extended_value, EX_T(opline->result.u.var).var.ptr, &EX_T(opline->result.u.var).var.ptr, EX(object), return_value_used TSRMLS_CC); + Z_OBJ_HT_P(EX(object))->call_method(EX(function_state).function->common.function_name, opline->extended_value, EX_T(opline->result.u.var).var.ptr, &EX_T(opline->result.u.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); } else { zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object"); } @@ -270,45 +369,46 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { efree(EX(function_state).function->common.function_name); } - efree(EX(fbc)); + efree(EX(function_state).function); - if (!return_value_used) { + if (!RETURN_VALUE_USED(opline)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->is_ref = 0; - EX_T(opline->result.u.var).var.ptr->refcount = 1; + Z_UNSET_ISREF_P(EX_T(opline->result.u.var).var.ptr); + Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); + EX_T(opline->result.u.var).var.fcall_returned_reference = 0; + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; } } EX(function_state).function = (zend_function *) EX(op_array); - EG(function_state_ptr) = &EX(function_state); - ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack)); + EX(function_state).arguments = NULL; - if (EG(This)) { - if (EG(exception) && ctor_opline) { - if (RETURN_VALUE_USED(ctor_opline)) { - EG(This)->refcount--; - } - if (EG(This)->refcount == 1) { - zend_object_store_ctor_failed(EG(This) TSRMLS_CC); + if (should_change_scope) { + if (EG(This)) { + if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) { + if (IS_CTOR_USED(EX(called_scope))) { + Z_DELREF_P(EG(This)); + } + if (Z_REFCOUNT_P(EG(This)) == 1) { + zend_object_store_ctor_failed(EG(This) TSRMLS_CC); + } } - } - if (should_change_scope) { zval_ptr_dtor(&EG(This)); } + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); } - if (should_change_scope) { - EG(This) = current_this; - EG(scope) = current_scope; - } - zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc)); + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); - zend_ptr_stack_clear_multiple(TSRMLS_C); + zend_vm_stack_clear_multiple(TSRMLS_C); if (EG(exception)) { zend_throw_exception_internal(NULL TSRMLS_CC); - if (return_value_used && EX_T(opline->result.u.var).var.ptr) { + if (RETURN_VALUE_USED(opline) && EX_T(opline->result.u.var).var.ptr) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } } @@ -316,56 +416,29 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { EX(function_state).function = EX(fbc); return zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_CATCH_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *opline = EX(opline); - zend_class_entry *ce; - - /* Check whether an exception has been thrown, if not, jump over code */ - if (EG(exception) == NULL) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); - ZEND_VM_CONTINUE(); /* CHECK_ME */ - } - ce = Z_OBJCE_P(EG(exception)); - if (ce != EX_T(opline->op1.u.var).class_entry) { - if (!instanceof_function(ce, EX_T(opline->op1.u.var).class_entry TSRMLS_CC)) { - if (opline->op1.u.EA.type) { - zend_throw_exception_internal(NULL TSRMLS_CC); - ZEND_VM_NEXT_OPCODE(); - } - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); - ZEND_VM_CONTINUE(); /* CHECK_ME */ - } - } - - zend_hash_update(EG(active_symbol_table), opline->op2.u.constant.value.str.val, - opline->op2.u.constant.value.str.len+1, &EG(exception), sizeof(zval *), (void **) NULL); - EG(exception) = NULL; - ZEND_VM_NEXT_OPCODE(); -} - -static int ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval **param; zend_uint arg_num = Z_LVAL(opline->op1.u.constant); + zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); - if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { + if (param == NULL) { char *space; char *class_name = get_active_class_name(&space TSRMLS_CC); zend_execute_data *ptr = EX(prev_execute_data); - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC); - if(ptr && ptr->op_array) { - zend_error(E_WARNING, "Missing argument %ld for %s%s%s(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); - } else { - zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) { + if(ptr && ptr->op_array) { + zend_error(E_WARNING, "Missing argument %ld for %s%s%s(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); + } else { + zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + } } if (opline->result.op_type == IS_VAR) { PZVAL_UNLOCK_FREE(*EX_T(opline->result.u.var).var.ptr_ptr); @@ -374,19 +447,17 @@ static int ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_res; zval **var_ptr; - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W); - if (PZVAL_IS_REF(*param)) { - zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC); - } else { - zend_receive(var_ptr, *param TSRMLS_CC); - } + Z_DELREF_PP(var_ptr); + *var_ptr = *param; + Z_ADDREF_PP(var_ptr); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *object_zval; @@ -410,28 +481,29 @@ static int ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (constructor == NULL) { if (RETURN_VALUE_USED(opline)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr = object_zval; + AI_SET_PTR(EX_T(opline->result.u.var).var, object_zval); } else { zval_ptr_dtor(&object_zval); } ZEND_VM_JMP(EX(op_array)->opcodes + opline->op2.u.opline_num); } else { - SELECTIVE_PZVAL_LOCK(object_zval, &opline->result); - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr = object_zval; + if (RETURN_VALUE_USED(opline)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, object_zval); + PZVAL_LOCK(object_zval); + } - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), opline); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), ENCODE_CTOR(EX(called_scope), RETURN_VALUE_USED(opline))); /* We are not handling overloaded classes right now */ EX(object) = object_zval; EX(fbc) = constructor; + EX(called_scope) = EX_T(opline->op1.u.var).class_entry; ZEND_VM_NEXT_OPCODE(); } } -static int ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -442,18 +514,18 @@ static int ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (EG(error_reporting)) { - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EG(scope)->name, EX(op_array)->function_name); ZEND_VM_NEXT_OPCODE(); /* Never reached */ } -static int ZEND_EXT_STMT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_EXT_STMT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { if (!EG(no_extensions)) { zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, EX(op_array) TSRMLS_CC); @@ -461,7 +533,7 @@ static int ZEND_EXT_STMT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_EXT_FCALL_BEGIN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_EXT_FCALL_BEGIN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { if (!EG(no_extensions)) { zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, EX(op_array) TSRMLS_CC); @@ -469,7 +541,7 @@ static int ZEND_EXT_FCALL_BEGIN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_EXT_FCALL_END_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_EXT_FCALL_END_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { if (!EG(no_extensions)) { zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, EX(op_array) TSRMLS_CC); @@ -477,7 +549,7 @@ static int ZEND_EXT_FCALL_END_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DECLARE_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DECLARE_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -485,7 +557,7 @@ static int ZEND_DECLARE_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DECLARE_INHERITED_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -493,52 +565,49 @@ static int ZEND_DECLARE_INHERITED_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DECLARE_FUNCTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - do_bind_function(EX(opline), EG(function_table), 0); + zend_op *opline = EX(opline); + zend_class_entry **pce, **pce_orig; + + if (zend_hash_find(EG(class_table), Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void**)&pce) == FAILURE || + (zend_hash_find(EG(class_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), (void**)&pce_orig) == SUCCESS && + *pce != *pce_orig)) { + do_bind_inherited_class(opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); + } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_EXT_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DECLARE_FUNCTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + do_bind_function(EX(opline), EG(function_table), 0); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_EXT_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_INTERFACE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - zend_op *opline = EX(opline); - zend_class_entry *ce = EX_T(opline->op1.u.var).class_entry; - zend_class_entry *iface = EX_T(opline->op2.u.var).class_entry; - - if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) { - zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name); - } - - zend_do_implement_interface(ce, iface TSRMLS_CC); - ZEND_VM_NEXT_OPCODE(); } -static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes; int i; zend_uint catch_op_num; int catched = 0; - zval **stack_zval_pp; zval restored_error_reporting; - stack_zval_pp = (zval **) EG(argument_stack).top_element - 1; - while (*stack_zval_pp != NULL) { - zval_ptr_dtor(stack_zval_pp); - EG(argument_stack).top_element--; - EG(argument_stack).top--; - stack_zval_pp--; + void **stack_frame = (void**)EX(Ts) + + (sizeof(temp_variable) * EX(op_array)->T) / sizeof(void*); + + while (zend_vm_stack_top(TSRMLS_C) != stack_frame) { + zval *stack_zval_p = zend_vm_stack_pop(TSRMLS_C); + zval_ptr_dtor(&stack_zval_p); } for (i=0; ilast_try_catch; i++) { @@ -554,14 +623,14 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } while (EX(fbc)) { - zend_op *ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack)); - + EX(called_scope) = (zend_class_entry*)zend_ptr_stack_pop(&EG(arg_types_stack)); if (EX(object)) { - if (ctor_opline && RETURN_VALUE_USED(ctor_opline)) { - EX(object)->refcount--; + if (IS_CTOR_USED(EX(called_scope))) { + Z_DELREF_P(EX(object)); } zval_ptr_dtor(&EX(object)); } + EX(called_scope) = DECODE_CTOR(EX(called_scope)); zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc)); } @@ -578,10 +647,14 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) switch (brk_opline->opcode) { case ZEND_SWITCH_FREE: - zend_switch_free(brk_opline, EX(Ts) TSRMLS_CC); + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zend_switch_free(&EX_T(brk_opline->op1.u.var), brk_opline->extended_value TSRMLS_CC); + } break; case ZEND_FREE: - zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var); + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var); + } break; } } @@ -593,26 +666,26 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; if (!catched) { - ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); ZEND_VM_CONTINUE(); } } -static int ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_verify_abstract_class(EX_T(EX(opline)->op1.u.var).class_entry TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { int ret = zend_user_opcode_handlers[EX(opline)->opcode](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL); @@ -620,15 +693,15 @@ static int ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case ZEND_USER_OPCODE_CONTINUE: ZEND_VM_CONTINUE(); case ZEND_USER_OPCODE_RETURN: - ZEND_VM_RETURN(); + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); case ZEND_USER_OPCODE_DISPATCH: ZEND_VM_DISPATCH(EX(opline)->opcode, EX(opline)); default: - ZEND_VM_DISPATCH(ret & 0xff, EX(opline)); + ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), EX(opline)); } } -static int ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *class_name; @@ -657,164 +730,109 @@ static int ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; - zend_class_entry *ce; - - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); - - ce = EX_T(opline->op1.u.var).class_entry; - if(IS_CONST != IS_UNUSED) { - char *function_name_strval; - int function_name_strlen; - zend_bool is_const = (IS_CONST == IS_CONST); + char *function_name_strval, *lcname; + int function_name_strlen; - if (is_const) { - function_name_strval = Z_STRVAL(opline->op2.u.constant); - function_name_strlen = Z_STRLEN(opline->op2.u.constant); - } else { - function_name = &opline->op2.u.constant; + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (Z_TYPE_P(function_name) != IS_STRING) { - zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + if (IS_CONST == IS_CONST) { + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, opline->extended_value, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL(opline->op2.u.constant)); } + } else { + function_name = &opline->op2.u.constant; - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - - if (!is_const) { - efree(function_name_strval); + if (Z_TYPE_P(function_name) == IS_OBJECT && + Z_OBJ_HANDLER_P(function_name, get_closure) && + Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) { + if (EX(object)) { + Z_ADDREF_P(EX(object)); + } + ZEND_VM_NEXT_OPCODE(); } - } else { - if(!ce->constructor) { - zend_error_noreturn(E_ERROR, "Can not call constructor"); - } - if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); - } - EX(fbc) = ce->constructor; - } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { - EX(object) = NULL; - } else { - if (IS_CONST != IS_UNUSED && - EG(This) && - Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - int severity; - char *verb; - if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_STRICT; - 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"; - } - zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + if (function_name_strval[0] == '\\') { + function_name_strlen -= 1; + lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); + } else { + lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); } - if ((EX(object) = EG(This))) { - EX(object)->refcount++; + if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); } + efree(lcname); + } + EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) + +static int ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *function_name; - zend_function *function; - char *function_name_strval, *lcname; - int function_name_strlen; - + zend_op *op_data = opline + 1; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); - - if (IS_CONST == IS_CONST) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; - } else { - function_name = &opline->op2.u.constant; + ZEND_VM_INC_OPCODE(); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (Z_TYPE_P(function_name) != IS_STRING) { - zend_error_noreturn(E_ERROR, "Function name must be a string"); + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, opline->extended_value, (void **) &EX(fbc))==FAILURE) { + char *short_name = Z_STRVAL(opline->op1.u.constant)+Z_LVAL(op_data->op1.u.constant); + if (zend_hash_quick_find(EG(function_table), short_name, Z_STRLEN(opline->op1.u.constant)-Z_LVAL(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL(opline->op2.u.constant)); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; - } - - lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); - if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) { - efree(lcname); - zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); - } - - efree(lcname); - if (IS_CONST != IS_CONST) { - } EX(object) = NULL; - - EX(fbc) = function; - ZEND_VM_NEXT_OPCODE(); } - -static int ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval **param, *assignment_value; + zval *assignment_value; zend_uint arg_num = Z_LVAL(opline->op1.u.constant); zend_free_op free_res; + zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); + zval **var_ptr; - if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { - if (Z_TYPE(opline->op2.u.constant) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { - zval *default_value; - - ALLOC_ZVAL(default_value); - *default_value = opline->op2.u.constant; - default_value->refcount=1; - zval_update_constant(&default_value, 0 TSRMLS_CC); - default_value->refcount=0; - default_value->is_ref=0; - param = &default_value; - assignment_value = default_value; + if (param == NULL) { + ALLOC_ZVAL(assignment_value); + *assignment_value = opline->op2.u.constant; + if ((Z_TYPE(opline->op2.u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { + Z_SET_REFCOUNT_P(assignment_value, 1); + zval_update_constant(&assignment_value, 0 TSRMLS_CC); } else { - param = NULL; - assignment_value = &opline->op2.u.constant; + zval_copy_ctor(assignment_value); } - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC); - zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, EX(Ts) TSRMLS_CC); + INIT_PZVAL(assignment_value); } else { - zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W); - assignment_value = *param; - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC); - if (PZVAL_IS_REF(assignment_value)) { - zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC); - } else { - zend_receive(var_ptr, assignment_value TSRMLS_CC); - } + Z_ADDREF_P(assignment_value); } + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); + var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W); + Z_DELREF_PP(var_ptr); + *var_ptr = assignment_value; + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -826,7 +844,7 @@ static int ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } -static int ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -838,190 +856,60 @@ static int ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } -static int ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *opline = EX(opline); - zval *class_name; - zend_free_op free_op2; - - - if (IS_TMP_VAR == IS_UNUSED) { - EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); - ZEND_VM_NEXT_OPCODE(); - } - - class_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - - switch (Z_TYPE_P(class_name)) { - case IS_OBJECT: - EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); - break; - case IS_STRING: - EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); - break; - default: - zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string"); - break; - } - - zval_dtor(free_op2.var); - ZEND_VM_NEXT_OPCODE(); -} - -static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + zend_op *brk_opline; zend_op *opline = EX(opline); - zval *function_name; - zend_class_entry *ce; - - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_brk_cont_element *el; - ce = EX_T(opline->op1.u.var).class_entry; - if(IS_TMP_VAR != IS_UNUSED) { - char *function_name_strval; - int function_name_strlen; - zend_bool is_const = (IS_TMP_VAR == IS_CONST); - zend_free_op free_op2; + el = zend_brk_cont(&opline->op2.u.constant, opline->extended_value, + EX(op_array), EX(Ts) TSRMLS_CC); - if (is_const) { - function_name_strval = Z_STRVAL(opline->op2.u.constant); - function_name_strlen = Z_STRLEN(opline->op2.u.constant); - } else { - function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + brk_opline = EX(op_array)->opcodes + el->brk; - if (Z_TYPE_P(function_name) != IS_STRING) { - zend_error_noreturn(E_ERROR, "Function name must be a string"); + switch (brk_opline->opcode) { + case ZEND_SWITCH_FREE: + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zend_switch_free(&EX_T(brk_opline->op1.u.var), brk_opline->extended_value TSRMLS_CC); } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; - } - - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - - if (!is_const) { - efree(function_name_strval); - zval_dtor(free_op2.var); - } - } else { - if(!ce->constructor) { - zend_error_noreturn(E_ERROR, "Can not call constructor"); - } - if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); - } - EX(fbc) = ce->constructor; - } - - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { - EX(object) = NULL; - } else { - if (IS_TMP_VAR != IS_UNUSED && - EG(This) && - Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - int severity; - char *verb; - if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_STRICT; - 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"; + break; + case ZEND_FREE: + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var); } - zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); - - } - if ((EX(object) = EG(This))) { - EX(object)->refcount++; - } + break; } - - ZEND_VM_NEXT_OPCODE(); + ZEND_VM_JMP(opline->op1.u.jmp_addr); } -static int ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *function_name; - zend_function *function; - char *function_name_strval, *lcname; - int function_name_strlen; - zend_free_op free_op2; - - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); - - if (IS_TMP_VAR == IS_CONST) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; - } else { - function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - - if (Z_TYPE_P(function_name) != IS_STRING) { - zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; - } - - lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); - if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) { - efree(lcname); - zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); - } + zend_class_entry *ce = EX_T(opline->op1.u.var).class_entry; + zend_class_entry *iface = zend_fetch_class(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), opline->extended_value TSRMLS_CC); - efree(lcname); - if (IS_TMP_VAR != IS_CONST) { - zval_dtor(free_op2.var); + if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) { + zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name); } - EX(object) = NULL; - - EX(fbc) = function; + zend_do_implement_interface(ce, iface TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } - -static int ZEND_BRK_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *opline = EX(opline); - zend_free_op free_op2; - zend_brk_cont_element *el; - - el = zend_brk_cont(_get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num, - EX(op_array), EX(Ts) TSRMLS_CC); - zval_dtor(free_op2.var); - ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); -} - -static int ZEND_CONT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *opline = EX(opline); - zend_free_op free_op2; - zend_brk_cont_element *el; - - el = zend_brk_cont(_get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num, - EX(op_array), EX(Ts) TSRMLS_CC); - zval_dtor(free_op2.var); - ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); -} - -static int ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *class_name; zend_free_op free_op2; - if (IS_VAR == IS_UNUSED) { + if (IS_TMP_VAR == IS_UNUSED) { EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } - class_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + class_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); switch (Z_TYPE_P(class_name)) { case IS_OBJECT: @@ -1035,164 +923,98 @@ static int ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; } - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; - zend_class_entry *ce; - - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); - - ce = EX_T(opline->op1.u.var).class_entry; - if(IS_VAR != IS_UNUSED) { - char *function_name_strval; - int function_name_strlen; - zend_bool is_const = (IS_VAR == IS_CONST); - zend_free_op free_op2; - - if (is_const) { - function_name_strval = Z_STRVAL(opline->op2.u.constant); - function_name_strlen = Z_STRLEN(opline->op2.u.constant); - } else { - function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - - if (Z_TYPE_P(function_name) != IS_STRING) { - zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; - } + char *function_name_strval, *lcname; + int function_name_strlen; + zend_free_op free_op2; - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (!is_const) { - efree(function_name_strval); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (IS_TMP_VAR == IS_CONST) { + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, opline->extended_value, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL(opline->op2.u.constant)); } } else { - if(!ce->constructor) { - zend_error_noreturn(E_ERROR, "Can not call constructor"); - } - if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); - } - EX(fbc) = ce->constructor; - } + function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { - EX(object) = NULL; - } else { - if (IS_VAR != IS_UNUSED && - EG(This) && - Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - int severity; - char *verb; - if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_STRICT; - 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 (Z_TYPE_P(function_name) == IS_OBJECT && + Z_OBJ_HANDLER_P(function_name, get_closure) && + Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) { + if (EX(object)) { + Z_ADDREF_P(EX(object)); } - zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); - - } - if ((EX(object) = EG(This))) { - EX(object)->refcount++; + zval_dtor(free_op2.var); + ZEND_VM_NEXT_OPCODE(); } - } - - ZEND_VM_NEXT_OPCODE(); -} - -static int ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *opline = EX(opline); - zval *function_name; - zend_function *function; - char *function_name_strval, *lcname; - int function_name_strlen; - zend_free_op free_op2; - - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); - - if (IS_VAR == IS_CONST) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; - } else { - function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; - } + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + if (function_name_strval[0] == '\\') { - lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); - if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) { + function_name_strlen -= 1; + lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); + } else { + lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); + } + if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); + } efree(lcname); - zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); - } - - efree(lcname); - if (IS_VAR != IS_CONST) { - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + zval_dtor(free_op2.var); } EX(object) = NULL; - - EX(fbc) = function; - ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BRK_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BRK_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zend_brk_cont_element *el; - el = zend_brk_cont(_get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num, + el = zend_brk_cont(_get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num, EX(op_array), EX(Ts) TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + zval_dtor(free_op2.var); ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } -static int ZEND_CONT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zend_brk_cont_element *el; - el = zend_brk_cont(_get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num, + el = zend_brk_cont(_get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num, EX(op_array), EX(Ts) TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + zval_dtor(free_op2.var); ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } -static int ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *class_name; + zend_free_op free_op2; - - if (IS_UNUSED == IS_UNUSED) { + if (IS_VAR == IS_UNUSED) { EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } - class_name = NULL; + class_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); switch (Z_TYPE_P(class_name)) { case IS_OBJECT: @@ -1206,96 +1028,98 @@ static int ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; - zend_class_entry *ce; - - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); - - ce = EX_T(opline->op1.u.var).class_entry; - if(IS_UNUSED != IS_UNUSED) { - char *function_name_strval; - int function_name_strlen; - zend_bool is_const = (IS_UNUSED == IS_CONST); - - - if (is_const) { - function_name_strval = Z_STRVAL(opline->op2.u.constant); - function_name_strlen = Z_STRLEN(opline->op2.u.constant); - } else { - function_name = NULL; - - if (Z_TYPE_P(function_name) != IS_STRING) { - zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; - } - - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + char *function_name_strval, *lcname; + int function_name_strlen; + zend_free_op free_op2; - if (!is_const) { - efree(function_name_strval); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + if (IS_VAR == IS_CONST) { + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, opline->extended_value, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL(opline->op2.u.constant)); } } else { - if(!ce->constructor) { - zend_error_noreturn(E_ERROR, "Can not call constructor"); - } - if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); - } - EX(fbc) = ce->constructor; - } - - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { - EX(object) = NULL; - } else { - if (IS_UNUSED != IS_UNUSED && - EG(This) && - Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - int severity; - char *verb; - if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_STRICT; - 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"; + function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + + if (Z_TYPE_P(function_name) == IS_OBJECT && + Z_OBJ_HANDLER_P(function_name, get_closure) && + Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) { + if (EX(object)) { + Z_ADDREF_P(EX(object)); } - zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + ZEND_VM_NEXT_OPCODE(); + } + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + if (function_name_strval[0] == '\\') { + function_name_strlen -= 1; + lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); + } else { + lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); } - if ((EX(object) = EG(This))) { - EX(object)->refcount++; + if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); } + efree(lcname); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } + EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) + +static int ZEND_FASTCALL ZEND_BRK_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_free_op free_op2; + zend_brk_cont_element *el; + + el = zend_brk_cont(_get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num, + EX(op_array), EX(Ts) TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); +} + +static int ZEND_FASTCALL ZEND_CONT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_free_op free_op2; + zend_brk_cont_element *el; + + el = zend_brk_cont(_get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num, + EX(op_array), EX(Ts) TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); +} + +static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *class_name; - if (IS_CV == IS_UNUSED) { + if (IS_UNUSED == IS_UNUSED) { EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } - class_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + class_name = NULL; switch (Z_TYPE_P(class_name)) { case IS_OBJECT: @@ -1312,124 +1136,125 @@ static int ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *function_name; - zend_class_entry *ce; - - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); - - ce = EX_T(opline->op1.u.var).class_entry; - if(IS_CV != IS_UNUSED) { - char *function_name_strval; - int function_name_strlen; - zend_bool is_const = (IS_CV == IS_CONST); - - - if (is_const) { - function_name_strval = Z_STRVAL(opline->op2.u.constant); - function_name_strlen = Z_STRLEN(opline->op2.u.constant); - } else { - function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - - if (Z_TYPE_P(function_name) != IS_STRING) { - zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; - } + zval *class_name; - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - if (!is_const) { - efree(function_name_strval); - } - } else { - if(!ce->constructor) { - zend_error_noreturn(E_ERROR, "Can not call constructor"); - } - if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); - } - EX(fbc) = ce->constructor; + if (IS_CV == IS_UNUSED) { + EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); + ZEND_VM_NEXT_OPCODE(); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { - EX(object) = NULL; - } else { - if (IS_CV != IS_UNUSED && - EG(This) && - Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - int severity; - char *verb; - if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_STRICT; - 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"; - } - zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + class_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - } - if ((EX(object) = EG(This))) { - EX(object)->refcount++; - } + switch (Z_TYPE_P(class_name)) { + case IS_OBJECT: + EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); + break; + case IS_STRING: + EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + break; + default: + zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string"); + break; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; - zend_function *function; char *function_name_strval, *lcname; int function_name_strlen; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_CV == IS_CONST) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, opline->extended_value, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL(opline->op2.u.constant)); + } } else { function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + if (Z_TYPE_P(function_name) == IS_OBJECT && + Z_OBJ_HANDLER_P(function_name, get_closure) && + Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) { + if (EX(object)) { + Z_ADDREF_P(EX(object)); + } + + ZEND_VM_NEXT_OPCODE(); + } + if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; - } + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + if (function_name_strval[0] == '\\') { - lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); - if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) { + function_name_strlen -= 1; + lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); + } else { + lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); + } + if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) { + zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); + } efree(lcname); - zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); - } - - efree(lcname); - if (IS_CV != IS_CONST) { } EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); +} + + +static int ZEND_FASTCALL ZEND_CATCH_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_class_entry *ce; - EX(fbc) = function; + /* Check whether an exception has been thrown, if not, jump over code */ + zend_exception_restore(TSRMLS_C); + if (EG(exception) == NULL) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ + } + ce = Z_OBJCE_P(EG(exception)); + if (ce != EX_T(opline->op1.u.var).class_entry) { + if (!instanceof_function(ce, EX_T(opline->op1.u.var).class_entry TSRMLS_CC)) { + if (opline->op1.u.EA.type) { + zend_throw_exception_internal(NULL TSRMLS_CC); + ZEND_VM_NEXT_OPCODE(); + } + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ + } + } + if (!EG(active_symbol_table)) { + if (EX(CVs)[opline->op2.u.var]) { + zval_ptr_dtor(EX(CVs)[opline->op2.u.var]); + } + EX(CVs)[opline->op2.u.var] = (zval**)EX(CVs) + (EX(op_array)->last_var + opline->op2.u.var); + *EX(CVs)[opline->op2.u.var] = EG(exception); + } else { + zend_compiled_variable *cv = &CV_DEF_OF(opline->op2.u.var); + zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, + &EG(exception), sizeof(zval *), (void**)&EX(CVs)[opline->op2.u.var]); + } + EG(exception) = NULL; ZEND_VM_NEXT_OPCODE(); } - -static int ZEND_BRK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BRK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -1441,7 +1266,7 @@ static int ZEND_BRK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } -static int ZEND_CONT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -1453,7 +1278,7 @@ static int ZEND_CONT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } -static int ZEND_BW_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -1464,7 +1289,7 @@ static int ZEND_BW_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -1475,7 +1300,7 @@ static int ZEND_BOOL_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -1493,7 +1318,7 @@ static int ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -1503,7 +1328,7 @@ static int ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -1512,7 +1337,7 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE zval tmp_varname; HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { + if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_string(&tmp_varname); @@ -1543,7 +1368,7 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); - new_zval->refcount++; + Z_ADDREF_P(new_zval); zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval); } break; @@ -1571,20 +1396,23 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE } - if (varname == &tmp_varname) { + if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = retval; + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } PZVAL_LOCK(*retval); switch (type) { case BP_VAR_R: case BP_VAR_IS: - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, *retval); break; case BP_VAR_UNSET: { zend_free_op free_res; + EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res); if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr); @@ -1592,136 +1420,195 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); FREE_OP_VAR_PTR(free_res); break; + default: + EX_T(opline->result.u.var).var.ptr_ptr = retval; + break; } } } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_R_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_R_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_W_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_W_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_W, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_RW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_RW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_RW, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_FUNC_ARG_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_FUNC_ARG_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CONST(ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), EX(opline)->extended_value)?BP_VAR_W:BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_UNSET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_UNSET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_UNSET, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_IS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_IS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_JMPZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int ret = i_zend_is_true(&opline->op1.u.constant); + zval *val = &opline->op1.u.constant; + int ret; + + if (IS_CONST == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (!ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int ret = i_zend_is_true(&opline->op1.u.constant); + zval *val = &opline->op1.u.constant; + int ret; + if (IS_CONST == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPZNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int retval = i_zend_is_true(&opline->op1.u.constant); + zval *val = &opline->op1.u.constant; + int retval; - if (retval) { + if (IS_CONST == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } + if (EXPECTED(retval != 0)) { #if DEBUG_ZEND>=2 printf("Conditional jmp on true to %d\n", opline->extended_value); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } else { #if DEBUG_ZEND>=2 printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } } -static int ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int retval = i_zend_is_true(&opline->op1.u.constant); + zval *val = &opline->op1.u.constant; + int retval; + + if (IS_CONST == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int retval = i_zend_is_true(&opline->op1.u.constant); + zval *val = &opline->op1.u.constant; + int retval; + + if (IS_CONST == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *fname = &opline->op1.u.constant; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); - if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) { + if (zend_hash_quick_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, Z_LVAL(opline->op2.u.constant), (void **) &EX(function_state).function)==FAILURE) { zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); } EX(object) = NULL; @@ -1729,7 +1616,7 @@ static int ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *retval_ptr; @@ -1746,11 +1633,11 @@ static int ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) retval_ptr_ptr = NULL; - if (!retval_ptr_ptr) { + if (IS_CONST == IS_VAR && !retval_ptr_ptr) { zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference"); } - if (IS_CONST == IS_VAR && !(*retval_ptr_ptr)->is_ref) { + if (IS_CONST == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && EX_T(opline->op1.u.var).var.fcall_returned_reference) { } else if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { @@ -1762,36 +1649,25 @@ static int ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); - (*retval_ptr_ptr)->refcount++; + if (EG(return_value_ptr_ptr)) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); + Z_ADDREF_PP(retval_ptr_ptr); - (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + } } else { return_by_value: retval_ptr = &opline->op1.u.constant; - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; + if (!EG(return_value_ptr_ptr)) { + if (IS_CONST == IS_TMP_VAR) { - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); } } else if (!0) { /* Not a temp var */ - if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || - (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0)) { + if (IS_CONST == IS_CONST || + EG(active_op_array)->return_reference == ZEND_RETURN_REF || + (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; ALLOC_ZVAL(ret); @@ -1800,7 +1676,7 @@ return_by_value: *EG(return_value_ptr_ptr) = ret; } else { *EG(return_value_ptr_ptr) = retval_ptr; - retval_ptr->refcount++; + Z_ADDREF_P(retval_ptr); } } else { zval *ret; @@ -1811,10 +1687,10 @@ return_by_value: } } - ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *value; @@ -1826,6 +1702,7 @@ static int ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } + zend_exception_save(TSRMLS_C); /* Not sure if a complete copy is what we want here */ ALLOC_ZVAL(exception); INIT_PZVAL_COPY(exception, value); @@ -1834,11 +1711,12 @@ static int ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zend_throw_exception_object(exception TSRMLS_CC); + zend_exception_restore(TSRMLS_C); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); if (opline->extended_value==ZEND_DO_FCALL_BY_NAME @@ -1857,13 +1735,13 @@ static int ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!0) { zval_copy_ctor(valptr); } - zend_ptr_stack_push(&EG(argument_stack), valptr); + zend_vm_stack_push(valptr TSRMLS_CC); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -1875,7 +1753,7 @@ static int ZEND_BOOL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -1886,10 +1764,6 @@ static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "__clone method called on non-object"); - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; - - ZEND_VM_NEXT_OPCODE(); } ce = Z_OBJCE_P(obj); @@ -1901,8 +1775,6 @@ static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object"); } - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; } if (ce && clone) { @@ -1926,8 +1798,8 @@ static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; - EX_T(opline->result.u.var).var.ptr->refcount=1; - EX_T(opline->result.u.var).var.ptr->is_ref=1; + Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); + Z_SET_ISREF_P(EX_T(opline->result.u.var).var.ptr); if (!RETURN_VALUE_USED(opline) || EG(exception)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } @@ -1936,7 +1808,7 @@ static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -1991,11 +1863,10 @@ static int ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op_array *new_op_array=NULL; - zval **original_return_value = EG(return_value_ptr_ptr); int return_value_used; zval *inc_filename = &opline->op1.u.constant; @@ -2015,42 +1886,40 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { zend_file_handle file_handle; + char *resolved_path; - if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) { - cwd_state state; - - state.cwd_length = 0; - state.cwd = malloc(1); - state.cwd[0] = 0; - - failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) && - zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)); - - free(state.cwd); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + if (resolved_path) { + failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); + } else { + resolved_path = Z_STRVAL_P(inc_filename); } if (failure_retval) { - /* do nothing */ - } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { + /* do nothing, file already included */ + } else if (SUCCESS == zend_stream_open(resolved_path, &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); + file_handle.opened_path = estrdup(resolved_path); } if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) { new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { - zend_file_handle_dtor(&file_handle); + zend_file_handle_dtor(&file_handle TSRMLS_CC); failure_retval=1; } } else { if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } } + if (resolved_path != Z_STRVAL_P(inc_filename)) { + efree(resolved_path); + } } break; case ZEND_INCLUDE: @@ -2069,31 +1938,34 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (inc_filename==&tmp_inc_filename) { zval_dtor(&tmp_inc_filename); } - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; - if (new_op_array) { - zval *saved_object; - zend_function *saved_function; - EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr; + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + if (new_op_array && !EG(exception)) { + EX(original_return_value) = EG(return_value_ptr_ptr); + EG(return_value_ptr_ptr) = return_value_used ? EX_T(opline->result.u.var).var.ptr_ptr : NULL; EG(active_op_array) = new_op_array; EX_T(opline->result.u.var).var.ptr = NULL; - saved_object = EX(object); - saved_function = EX(function_state).function; + EX(current_object) = EX(object); EX(function_state).function = (zend_function *) new_op_array; EX(object) = NULL; - zend_execute(new_op_array TSRMLS_CC); + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + + if (zend_execute == execute) { + EX(call_opline) = opline; + ZEND_VM_ENTER(); + } else { + zend_execute(new_op_array TSRMLS_CC); + } - EX(function_state).function = saved_function; - EX(object) = saved_object; + EX(function_state).function = (zend_function *) EX(op_array); + EX(object) = EX(current_object); - if (!return_value_used) { - if (EX_T(opline->result.u.var).var.ptr) { - zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); - } - } else { /* return value is used */ + if (return_value_used) { if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); @@ -2104,7 +1976,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EG(opline_ptr) = &EX(opline); EG(active_op_array) = EX(op_array); - EG(function_state_ptr) = &EX(function_state); + EG(return_value_ptr_ptr) = EX(original_return_value); destroy_op_array(new_op_array TSRMLS_CC); efree(new_op_array); if (EG(exception)) { @@ -2118,18 +1990,46 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } - - EG(return_value_ptr_ptr) = original_return_value; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval tmp, *varname; HashTable *target_symbol_table; + if (IS_CONST == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EG(active_symbol_table)) { + zend_execute_data *ex = EX(prev_execute_data); + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); + + if (zend_hash_quick_del(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + while (ex && ex->symbol_table == EG(active_symbol_table)) { + int i; + + if (ex->op_array) { + for (i = 0; i < ex->op_array->last_var; i++) { + if (ex->op_array->vars[i].hash_value == cv->hash_value && + ex->op_array->vars[i].name_len == cv->name_len && + !memcmp(ex->op_array->vars[i].name, cv->name, cv->name_len)) { + ex->CVs[i] = NULL; + break; + } + } + } + ex = ex->prev_execute_data; + } + } + EX(CVs)[opline->op1.u.var] = NULL; + } else if (EX(CVs)[opline->op1.u.var]) { + zval_ptr_dtor(EX(CVs)[opline->op1.u.var]); + EX(CVs)[opline->op1.u.var] = NULL; + } + ZEND_VM_NEXT_OPCODE(); + } + varname = &opline->op1.u.constant; if (Z_TYPE_P(varname) != IS_STRING) { @@ -2137,17 +2037,18 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_copy_ctor(&tmp); convert_to_string(&tmp); varname = &tmp; - } else if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { - varname->refcount++; + } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) { + Z_ADDREF_P(varname); } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); } else { + ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1) == SUCCESS) { + if (zend_hash_quick_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value) == SUCCESS) { zend_execute_data *ex = execute_data; - ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); do { int i; @@ -2169,14 +2070,14 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (varname == &tmp) { zval_dtor(&tmp); - } else if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { + } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) { zval_ptr_dtor(&varname); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2199,18 +2100,18 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ce = Z_OBJCE_PP(array_ptr_ptr); if (!ce || ce->get_iterator == NULL) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); - (*array_ptr_ptr)->refcount++; + Z_ADDREF_PP(array_ptr_ptr); } array_ptr = *array_ptr_ptr; } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); if (opline->extended_value & ZEND_FE_FETCH_BYREF) { - (*array_ptr_ptr)->is_ref = 1; + Z_SET_ISREF_PP(array_ptr_ptr); } } array_ptr = *array_ptr_ptr; - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { array_ptr = &opline->op1.u.constant; @@ -2223,12 +2124,12 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); if (!ce || !ce->get_iterator) { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && - !array_ptr->is_ref && - array_ptr->refcount > 1) { + !Z_ISREF_P(array_ptr) && + Z_REFCOUNT_P(array_ptr) > 1) { zval *tmp; ALLOC_ZVAL(tmp); @@ -2236,7 +2137,7 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_copy_ctor(tmp); array_ptr = tmp; } else { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } } @@ -2260,16 +2161,15 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } + AI_SET_PTR(EX_T(opline->result.u.var).var, array_ptr); PZVAL_LOCK(array_ptr); - EX_T(opline->result.u.var).var.ptr = array_ptr; - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; if (iter) { iter->index = 0; if (iter->funcs->rewind) { iter->funcs->rewind(iter TSRMLS_CC); if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { @@ -2281,7 +2181,7 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS; if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { @@ -2329,37 +2229,57 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - - zval tmp, *varname = &opline->op1.u.constant; zval **value; zend_bool isset = 1; - HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { - tmp = *varname; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - varname = &tmp; - } + if (IS_CONST == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EX(CVs)[opline->op1.u.var]) { + value = EX(CVs)[opline->op1.u.var]; + } else if (EG(active_symbol_table)) { + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); - if (!value) { + if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + isset = 0; + } + } else { isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { - isset = 0; + HashTable *target_symbol_table; + + zval tmp, *varname = &opline->op1.u.constant; + + if (Z_TYPE_P(varname) != IS_STRING) { + tmp = *varname; + zval_copy_ctor(&tmp); + convert_to_string(&tmp); + varname = &tmp; + } + + if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { + value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); + if (!value) { + isset = 0; + } + } else { + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); + if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { + isset = 0; + } + } + + if (varname == &tmp) { + zval_dtor(&tmp); } + } Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; - switch (opline->extended_value) { + switch (opline->extended_value & ZEND_ISSET_ISEMPTY_MASK) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; @@ -2376,14 +2296,10 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; } - if (varname == &tmp) { - zval_dtor(&tmp); - } - ZEND_VM_NEXT_OPCODE(); } -static int ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { #if 0 || (IS_CONST != IS_UNUSED) zend_op *opline = EX(opline); @@ -2403,7 +2319,26 @@ static int ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + + zval *value = &opline->op1.u.constant; + + if (i_zend_is_true(value)) { + EX_T(opline->result.u.var).tmp_var = *value; + zendi_zval_copy_ctor(EX_T(opline->result.u.var).tmp_var); + +#if DEBUG_ZEND>=2 + printf("Conditional jmp to %d\n", opline->op2.u.opline_num); +#endif + ZEND_VM_JMP(opline->op2.u.jmp_addr); + } + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2417,7 +2352,7 @@ static int ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_TICKS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_TICKS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2430,7 +2365,7 @@ static int ZEND_TICKS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2443,7 +2378,7 @@ static int ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2456,7 +2391,7 @@ static int ZEND_SUB_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2469,7 +2404,7 @@ static int ZEND_MUL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2482,7 +2417,7 @@ static int ZEND_DIV_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2495,7 +2430,7 @@ static int ZEND_MOD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2508,7 +2443,7 @@ static int ZEND_SL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2521,7 +2456,7 @@ static int ZEND_SR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2534,7 +2469,7 @@ static int ZEND_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2547,72 +2482,82 @@ static int ZEND_IS_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, &opline->op1.u.constant, &opline->op2.u.constant TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2625,7 +2570,7 @@ static int ZEND_BW_OR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2638,7 +2583,7 @@ static int ZEND_BW_AND_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2651,7 +2596,7 @@ static int ZEND_BW_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2664,7 +2609,7 @@ static int ZEND_BOOL_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2672,22 +2617,118 @@ static int ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A if (Z_TYPE_P(container) != IS_ARRAY) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { zval *dim = &opline->op2.u.constant; - EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC); - SELECTIVE_PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &opline->result); + AI_SET_PTR(EX_T(opline->result.u.var).var, *zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC)); + SELECTIVE_PZVAL_LOCK(EX_T(opline->result.u.var).var.ptr, &opline->result); + + } + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_CONST == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_CONST != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + + + if (IS_CONST == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = &opline->op2.u.constant; + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } + + if (IS_CONST != IS_CONST) { + + } + } else { + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; + } + + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; + } else { + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); + } } - AI_USE_PTR(EX_T(opline->result.u.var).var); + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -2698,7 +2739,7 @@ static int ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -2713,57 +2754,69 @@ static int ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_class_entry *ce = NULL; - zval **value; if (IS_CONST == IS_UNUSED) { -/* This seems to be a reminant of namespaces - if (EG(scope)) { - ce = EG(scope); - if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { - zval_update_constant(value, (void *) 1 TSRMLS_CC); - EX_T(opline->result.u.var).tmp_var = **value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - ZEND_VM_NEXT_OPCODE(); + /* namespaced constant */ + if (!zend_get_constant_ex(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var, NULL, opline->extended_value TSRMLS_CC)) { + if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { + char *actual = (char *)zend_memrchr(Z_STRVAL(opline->op2.u.constant), '\\', Z_STRLEN(opline->op2.u.constant)); + if(!actual) { + actual = Z_STRVAL(opline->op2.u.constant); + } else { + actual++; + } + /* non-qualified constant - allow text substitution */ + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); + ZVAL_STRINGL(&EX_T(opline->result.u.var).tmp_var, actual, Z_STRLEN(opline->op2.u.constant)-(actual - Z_STRVAL(opline->op2.u.constant)), 1); + } else { + zend_error_noreturn(E_ERROR, "Undefined constant '%s'", + Z_STRVAL(opline->op2.u.constant), Z_STRVAL(opline->op2.u.constant)); } } -*/ - if (!zend_get_constant(opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len, &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - opline->op2.u.constant.value.str.val, - opline->op2.u.constant.value.str.val); - EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - } ZEND_VM_NEXT_OPCODE(); - } + } else { + /* class constant */ + zend_class_entry *ce; + zval **value; - ce = EX_T(opline->op1.u.var).class_entry; + if (IS_CONST == IS_CONST) { - if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { - zend_class_entry *old_scope = EG(scope); + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + } else { + ce = EX_T(opline->op1.u.var).class_entry; + } - EG(scope) = ce; - zval_update_constant(value, (void *) 1 TSRMLS_CC); - EG(scope) = old_scope; - EX_T(opline->result.u.var).tmp_var = **value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - } else { - zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", opline->op2.u.constant.value.str.val); - } + if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { + if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || + (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + zend_class_entry *old_scope = EG(scope); - ZEND_VM_NEXT_OPCODE(); + EG(scope) = ce; + zval_update_constant(value, (void *) 1 TSRMLS_CC); + EG(scope) = old_scope; + } + EX_T(opline->result.u.var).tmp_var = **value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } else { + zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + + ZEND_VM_NEXT_OPCODE(); + } } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2795,10 +2848,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -2806,13 +2859,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -2842,7 +2897,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2856,7 +2911,56 @@ static int ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + + zval *name = &opline->op1.u.constant; + zval *val = &opline->op2.u.constant; + zend_constant c; + + if ((Z_TYPE_P(val) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { + zval tmp = *val; + zval *tmp_ptr = &tmp; + + if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { + zval_copy_ctor(&tmp); + } + INIT_PZVAL(&tmp); + zval_update_constant(&tmp_ptr, NULL TSRMLS_CC); + c.value = *tmp_ptr; + } else { + c.value = *val; + zval_copy_ctor(&c.value); + } + c.flags = CONST_CS; /* non persistent, case sensetive */ + c.name = zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + c.name_len = Z_STRLEN_P(name)+1; + c.module_number = PHP_USER_CONSTANT; + + if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { + } + + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_function *op_array; + + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), Z_LVAL(opline->op2.u.constant), (void *) &op_array) == FAILURE || + op_array->type != ZEND_USER_FUNCTION) { + zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); + } + + zend_create_closure(&EX_T(opline->result.u.var).tmp_var, op_array TSRMLS_CC); + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -2869,7 +2973,7 @@ static int ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -2882,7 +2986,7 @@ static int ZEND_SUB_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -2895,7 +2999,7 @@ static int ZEND_MUL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -2908,7 +3012,7 @@ static int ZEND_DIV_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -2921,7 +3025,7 @@ static int ZEND_MOD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -2934,7 +3038,7 @@ static int ZEND_SL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -2947,7 +3051,7 @@ static int ZEND_SR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -2960,7 +3064,7 @@ static int ZEND_CONCAT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -2973,72 +3077,82 @@ static int ZEND_IS_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, &opline->op1.u.constant, _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3051,7 +3165,7 @@ static int ZEND_BW_OR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3064,7 +3178,7 @@ static int ZEND_BW_AND_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3077,7 +3191,7 @@ static int ZEND_BW_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3090,7 +3204,104 @@ static int ZEND_BOOL_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_CONST == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_TMP_VAR != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + zend_free_op free_op2; + + if (IS_TMP_VAR == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } + + if (IS_TMP_VAR != IS_CONST) { + zval_dtor(free_op2.var); + } + } else { + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; + } + + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; + } else { + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); + } + } + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -3101,7 +3312,7 @@ static int ZEND_CASE_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -3117,12 +3328,12 @@ static int ZEND_CASE_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3154,10 +3365,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -3165,13 +3376,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -3201,7 +3414,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3215,7 +3428,7 @@ static int ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3228,7 +3441,7 @@ static int ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3241,7 +3454,7 @@ static int ZEND_SUB_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3254,7 +3467,7 @@ static int ZEND_MUL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3267,7 +3480,7 @@ static int ZEND_DIV_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3280,7 +3493,7 @@ static int ZEND_MOD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3293,7 +3506,7 @@ static int ZEND_SL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3306,7 +3519,7 @@ static int ZEND_SR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3319,7 +3532,7 @@ static int ZEND_CONCAT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3332,72 +3545,82 @@ static int ZEND_IS_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, &opline->op1.u.constant, _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3410,7 +3633,7 @@ static int ZEND_BW_OR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3423,7 +3646,7 @@ static int ZEND_BW_AND_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3436,20 +3659,117 @@ static int ZEND_BW_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *opline = EX(opline); - zend_free_op free_op2; +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_free_op free_op2; + + boolean_xor_function(&EX_T(opline->result.u.var).tmp_var, + &opline->op1.u.constant, + _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_CONST == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_VAR != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + zend_free_op free_op2; + + if (IS_VAR == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } + + if (IS_VAR != IS_CONST) { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } + } else { + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; + } + + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; + } else { + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); - boolean_xor_function(&EX_T(opline->result.u.var).tmp_var, - &opline->op1.u.constant, - _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); + } + } - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -3460,7 +3780,7 @@ static int ZEND_CASE_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -3476,12 +3796,12 @@ static int ZEND_CASE_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -3513,10 +3833,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -3524,13 +3844,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -3560,7 +3882,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3574,7 +3896,104 @@ static int ZEND_INIT_ARRAY_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_CONST == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_UNUSED != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + + + if (IS_UNUSED == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = NULL; + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } + + if (IS_UNUSED != IS_CONST) { + + } + } else { + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; + } + + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; + } else { + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); + } + } + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3606,10 +4025,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -3617,13 +4036,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -3653,7 +4074,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3667,7 +4088,7 @@ static int ZEND_INIT_ARRAY_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3680,7 +4101,7 @@ static int ZEND_ADD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3693,7 +4114,7 @@ static int ZEND_SUB_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3706,7 +4127,7 @@ static int ZEND_MUL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3719,7 +4140,7 @@ static int ZEND_DIV_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3732,7 +4153,7 @@ static int ZEND_MOD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3745,7 +4166,7 @@ static int ZEND_SL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3758,7 +4179,7 @@ static int ZEND_SR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3771,7 +4192,7 @@ static int ZEND_CONCAT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3784,72 +4205,82 @@ static int ZEND_IS_IDENTICAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, &opline->op1.u.constant, _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, &opline->op1.u.constant, _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3862,7 +4293,7 @@ static int ZEND_BW_OR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3875,7 +4306,7 @@ static int ZEND_BW_AND_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3888,7 +4319,7 @@ static int ZEND_BW_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3901,7 +4332,104 @@ static int ZEND_BOOL_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_CONST == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_CV != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + + + if (IS_CV == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } + + if (IS_CV != IS_CONST) { + + } + } else { + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; + } + + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; + } else { + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); + } + } + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -3912,7 +4440,7 @@ static int ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -3927,12 +4455,12 @@ static int ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3964,10 +4492,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -3975,13 +4503,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -4011,7 +4541,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -4025,7 +4555,7 @@ static int ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -4036,7 +4566,7 @@ static int ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -4047,7 +4577,7 @@ static int ZEND_BOOL_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -4066,7 +4596,7 @@ static int ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRINT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRINT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -4076,7 +4606,7 @@ static int ZEND_PRINT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -4085,7 +4615,7 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ zval tmp_varname; HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { + if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_string(&tmp_varname); @@ -4116,7 +4646,7 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); - new_zval->refcount++; + Z_ADDREF_P(new_zval); zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval); } break; @@ -4144,20 +4674,23 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ } - if (varname == &tmp_varname) { + if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = retval; + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } PZVAL_LOCK(*retval); switch (type) { case BP_VAR_R: case BP_VAR_IS: - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, *retval); break; case BP_VAR_UNSET: { zend_free_op free_res; + EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res); if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr); @@ -4165,139 +4698,193 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); FREE_OP_VAR_PTR(free_res); break; + default: + EX_T(opline->result.u.var).var.ptr_ptr = retval; + break; } } } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_R_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_R_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_W_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_W_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_W, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_RW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_RW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_RW, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_FUNC_ARG_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_FUNC_ARG_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_TMP(ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), EX(opline)->extended_value)?BP_VAR_W:BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_UNSET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_UNSET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_UNSET, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_IS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_IS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_JMPZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int ret = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int ret; - zval_dtor(free_op1.var); + if (IS_TMP_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + zval_dtor(free_op1.var); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (!ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPNZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPNZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int ret = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int ret; - zval_dtor(free_op1.var); + if (IS_TMP_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + zval_dtor(free_op1.var); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPZNZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZNZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int retval; - zval_dtor(free_op1.var); - if (retval) { + if (IS_TMP_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + zval_dtor(free_op1.var); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } + if (EXPECTED(retval != 0)) { #if DEBUG_ZEND>=2 printf("Conditional jmp on true to %d\n", opline->extended_value); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } else { #if DEBUG_ZEND>=2 printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } } -static int ZEND_JMPZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int retval; - zval_dtor(free_op1.var); + if (IS_TMP_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + zval_dtor(free_op1.var); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPNZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int retval; - zval_dtor(free_op1.var); + if (IS_TMP_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + zval_dtor(free_op1.var); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FREE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FREE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zendi_zval_dtor(EX_T(EX(opline)->op1.u.var).tmp_var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *retval_ptr; @@ -4314,11 +4901,11 @@ static int ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) retval_ptr_ptr = NULL; - if (!retval_ptr_ptr) { + if (IS_TMP_VAR == IS_VAR && !retval_ptr_ptr) { zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference"); } - if (IS_TMP_VAR == IS_VAR && !(*retval_ptr_ptr)->is_ref) { + if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && EX_T(opline->op1.u.var).var.fcall_returned_reference) { } else if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { @@ -4330,36 +4917,25 @@ static int ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); - (*retval_ptr_ptr)->refcount++; + if (EG(return_value_ptr_ptr)) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); + Z_ADDREF_PP(retval_ptr_ptr); - (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + } } else { return_by_value: retval_ptr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); + if (!EG(return_value_ptr_ptr)) { + if (IS_TMP_VAR == IS_TMP_VAR) { + zval_dtor(free_op1.var); } } else if (!1) { /* Not a temp var */ - if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || - (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0)) { + if (IS_TMP_VAR == IS_CONST || + EG(active_op_array)->return_reference == ZEND_RETURN_REF || + (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; ALLOC_ZVAL(ret); @@ -4368,7 +4944,7 @@ return_by_value: *EG(return_value_ptr_ptr) = ret; } else { *EG(return_value_ptr_ptr) = retval_ptr; - retval_ptr->refcount++; + Z_ADDREF_P(retval_ptr); } } else { zval *ret; @@ -4379,10 +4955,10 @@ return_by_value: } } - ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *value; @@ -4394,6 +4970,7 @@ static int ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } + zend_exception_save(TSRMLS_C); /* Not sure if a complete copy is what we want here */ ALLOC_ZVAL(exception); INIT_PZVAL_COPY(exception, value); @@ -4402,11 +4979,12 @@ static int ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zend_throw_exception_object(exception TSRMLS_CC); + zend_exception_restore(TSRMLS_C); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_VAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); if (opline->extended_value==ZEND_DO_FCALL_BY_NAME @@ -4425,13 +5003,13 @@ static int ZEND_SEND_VAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!1) { zval_copy_ctor(valptr); } - zend_ptr_stack_push(&EG(argument_stack), valptr); + zend_vm_stack_push(valptr TSRMLS_CC); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -4444,13 +5022,7 @@ static int ZEND_BOOL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SWITCH_FREE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_switch_free(EX(opline), EX(Ts) TSRMLS_CC); - ZEND_VM_NEXT_OPCODE(); -} - -static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -4461,10 +5033,6 @@ static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "__clone method called on non-object"); - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; - - ZEND_VM_NEXT_OPCODE(); } ce = Z_OBJCE_P(obj); @@ -4476,8 +5044,6 @@ static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object"); } - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; } if (ce && clone) { @@ -4501,8 +5067,8 @@ static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; - EX_T(opline->result.u.var).var.ptr->refcount=1; - EX_T(opline->result.u.var).var.ptr->is_ref=1; + Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); + Z_SET_ISREF_P(EX_T(opline->result.u.var).var.ptr); if (!RETURN_VALUE_USED(opline) || EG(exception)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } @@ -4511,7 +5077,7 @@ static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -4566,11 +5132,10 @@ static int ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op_array *new_op_array=NULL; - zval **original_return_value = EG(return_value_ptr_ptr); int return_value_used; zend_free_op free_op1; zval *inc_filename = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); @@ -4590,42 +5155,40 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { zend_file_handle file_handle; + char *resolved_path; - if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) { - cwd_state state; - - state.cwd_length = 0; - state.cwd = malloc(1); - state.cwd[0] = 0; - - failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) && - zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)); - - free(state.cwd); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + if (resolved_path) { + failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); + } else { + resolved_path = Z_STRVAL_P(inc_filename); } if (failure_retval) { - /* do nothing */ - } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { + /* do nothing, file already included */ + } else if (SUCCESS == zend_stream_open(resolved_path, &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); + file_handle.opened_path = estrdup(resolved_path); } if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) { new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { - zend_file_handle_dtor(&file_handle); + zend_file_handle_dtor(&file_handle TSRMLS_CC); failure_retval=1; } } else { if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } } + if (resolved_path != Z_STRVAL_P(inc_filename)) { + efree(resolved_path); + } } break; case ZEND_INCLUDE: @@ -4644,31 +5207,34 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (inc_filename==&tmp_inc_filename) { zval_dtor(&tmp_inc_filename); } + zval_dtor(free_op1.var); EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; - if (new_op_array) { - zval *saved_object; - zend_function *saved_function; - - EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr; + if (new_op_array && !EG(exception)) { + EX(original_return_value) = EG(return_value_ptr_ptr); + EG(return_value_ptr_ptr) = return_value_used ? EX_T(opline->result.u.var).var.ptr_ptr : NULL; EG(active_op_array) = new_op_array; EX_T(opline->result.u.var).var.ptr = NULL; - saved_object = EX(object); - saved_function = EX(function_state).function; + EX(current_object) = EX(object); EX(function_state).function = (zend_function *) new_op_array; EX(object) = NULL; - zend_execute(new_op_array TSRMLS_CC); + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + + if (zend_execute == execute) { + EX(call_opline) = opline; + ZEND_VM_ENTER(); + } else { + zend_execute(new_op_array TSRMLS_CC); + } - EX(function_state).function = saved_function; - EX(object) = saved_object; + EX(function_state).function = (zend_function *) EX(op_array); + EX(object) = EX(current_object); - if (!return_value_used) { - if (EX_T(opline->result.u.var).var.ptr) { - zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); - } - } else { /* return value is used */ + if (return_value_used) { if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); @@ -4679,7 +5245,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EG(opline_ptr) = &EX(opline); EG(active_op_array) = EX(op_array); - EG(function_state_ptr) = &EX(function_state); + EG(return_value_ptr_ptr) = EX(original_return_value); destroy_op_array(new_op_array TSRMLS_CC); efree(new_op_array); if (EG(exception)) { @@ -4693,18 +5259,46 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } - zval_dtor(free_op1.var); - EG(return_value_ptr_ptr) = original_return_value; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval tmp, *varname; HashTable *target_symbol_table; zend_free_op free_op1; + if (IS_TMP_VAR == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EG(active_symbol_table)) { + zend_execute_data *ex = EX(prev_execute_data); + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); + + if (zend_hash_quick_del(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + while (ex && ex->symbol_table == EG(active_symbol_table)) { + int i; + + if (ex->op_array) { + for (i = 0; i < ex->op_array->last_var; i++) { + if (ex->op_array->vars[i].hash_value == cv->hash_value && + ex->op_array->vars[i].name_len == cv->name_len && + !memcmp(ex->op_array->vars[i].name, cv->name, cv->name_len)) { + ex->CVs[i] = NULL; + break; + } + } + } + ex = ex->prev_execute_data; + } + } + EX(CVs)[opline->op1.u.var] = NULL; + } else if (EX(CVs)[opline->op1.u.var]) { + zval_ptr_dtor(EX(CVs)[opline->op1.u.var]); + EX(CVs)[opline->op1.u.var] = NULL; + } + ZEND_VM_NEXT_OPCODE(); + } + varname = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (Z_TYPE_P(varname) != IS_STRING) { @@ -4712,17 +5306,18 @@ static int ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_copy_ctor(&tmp); convert_to_string(&tmp); varname = &tmp; - } else if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { - varname->refcount++; + } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) { + Z_ADDREF_P(varname); } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); } else { + ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1) == SUCCESS) { + if (zend_hash_quick_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value) == SUCCESS) { zend_execute_data *ex = execute_data; - ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); do { int i; @@ -4744,14 +5339,14 @@ static int ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (varname == &tmp) { zval_dtor(&tmp); - } else if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { + } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) { zval_ptr_dtor(&varname); } zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -4774,18 +5369,18 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ce = Z_OBJCE_PP(array_ptr_ptr); if (!ce || ce->get_iterator == NULL) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); - (*array_ptr_ptr)->refcount++; + Z_ADDREF_PP(array_ptr_ptr); } array_ptr = *array_ptr_ptr; } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); if (opline->extended_value & ZEND_FE_FETCH_BYREF) { - (*array_ptr_ptr)->is_ref = 1; + Z_SET_ISREF_PP(array_ptr_ptr); } } array_ptr = *array_ptr_ptr; - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { array_ptr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); @@ -4798,12 +5393,12 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); if (!ce || !ce->get_iterator) { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && - !array_ptr->is_ref && - array_ptr->refcount > 1) { + !Z_ISREF_P(array_ptr) && + Z_REFCOUNT_P(array_ptr) > 1) { zval *tmp; ALLOC_ZVAL(tmp); @@ -4811,7 +5406,7 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_copy_ctor(tmp); array_ptr = tmp; } else { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } } @@ -4835,16 +5430,15 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } + AI_SET_PTR(EX_T(opline->result.u.var).var, array_ptr); PZVAL_LOCK(array_ptr); - EX_T(opline->result.u.var).var.ptr = array_ptr; - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; if (iter) { iter->index = 0; if (iter->funcs->rewind) { iter->funcs->rewind(iter TSRMLS_CC); if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { @@ -4856,7 +5450,7 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS; if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { @@ -4904,37 +5498,57 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1; - zval tmp, *varname = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval **value; zend_bool isset = 1; - HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { - tmp = *varname; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - varname = &tmp; - } + if (IS_TMP_VAR == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EX(CVs)[opline->op1.u.var]) { + value = EX(CVs)[opline->op1.u.var]; + } else if (EG(active_symbol_table)) { + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); - if (!value) { + if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + isset = 0; + } + } else { isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { - isset = 0; + HashTable *target_symbol_table; + zend_free_op free_op1; + zval tmp, *varname = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (Z_TYPE_P(varname) != IS_STRING) { + tmp = *varname; + zval_copy_ctor(&tmp); + convert_to_string(&tmp); + varname = &tmp; + } + + if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { + value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); + if (!value) { + isset = 0; + } + } else { + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); + if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { + isset = 0; + } + } + + if (varname == &tmp) { + zval_dtor(&tmp); } + zval_dtor(free_op1.var); } Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; - switch (opline->extended_value) { + switch (opline->extended_value & ZEND_ISSET_ISEMPTY_MASK) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; @@ -4951,15 +5565,10 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; } - if (varname == &tmp) { - zval_dtor(&tmp); - } - zval_dtor(free_op1.var); - ZEND_VM_NEXT_OPCODE(); } -static int ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { #if 0 || (IS_TMP_VAR != IS_UNUSED) zend_op *opline = EX(opline); @@ -4979,7 +5588,7 @@ static int ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval restored_error_reporting; @@ -4988,7 +5597,7 @@ static int ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.u.var).tmp_var); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) { @@ -4997,7 +5606,27 @@ static int ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_QM_ASSIGN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_free_op free_op1; + zval *value = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (i_zend_is_true(value)) { + EX_T(opline->result.u.var).tmp_var = *value; + zendi_zval_copy_ctor(EX_T(opline->result.u.var).tmp_var); + zval_dtor(free_op1.var); +#if DEBUG_ZEND>=2 + printf("Conditional jmp to %d\n", opline->op2.u.opline_num); +#endif + ZEND_VM_JMP(opline->op2.u.jmp_addr); + } + + zval_dtor(free_op1.var); + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5011,7 +5640,7 @@ static int ZEND_QM_ASSIGN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5028,7 +5657,7 @@ static int ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5041,7 +5670,7 @@ static int ZEND_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5054,7 +5683,7 @@ static int ZEND_SUB_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5067,7 +5696,7 @@ static int ZEND_MUL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5080,7 +5709,7 @@ static int ZEND_DIV_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5093,7 +5722,7 @@ static int ZEND_MOD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5106,7 +5735,7 @@ static int ZEND_SL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5119,7 +5748,7 @@ static int ZEND_SR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5132,7 +5761,7 @@ static int ZEND_CONCAT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5145,72 +5774,82 @@ static int ZEND_IS_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5223,7 +5862,7 @@ static int ZEND_BW_OR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5236,7 +5875,7 @@ static int ZEND_BW_AND_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5249,7 +5888,7 @@ static int ZEND_BW_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5262,7 +5901,7 @@ static int ZEND_BOOL_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5270,46 +5909,61 @@ static int ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG if (Z_TYPE_P(container) != IS_ARRAY) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { zval *dim = &opline->op2.u.constant; - EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC); - SELECTIVE_PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &opline->result); + AI_SET_PTR(EX_T(opline->result.u.var).var, *zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC)); + SELECTIVE_PZVAL_LOCK(EX_T(opline->result.u.var).var.ptr, &opline->result); } - AI_USE_PTR(EX_T(opline->result.u.var).var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_CHAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1; + zval *str = &EX_T(opline->result.u.var).tmp_var; + + if (IS_TMP_VAR == IS_UNUSED) { + /* Initialize for erealloc in add_char_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + + add_char_to_string(str, str, &opline->op2.u.constant); - add_char_to_string(&EX_T(opline->result.u.var).tmp_var, - _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), - &opline->op2.u.constant); /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_STRING_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1; + zval *str = &EX_T(opline->result.u.var).tmp_var; + + if (IS_TMP_VAR == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + + add_string_to_string(str, str, &opline->op2.u.constant); - add_string_to_string(&EX_T(opline->result.u.var).tmp_var, - _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), - &opline->op2.u.constant); /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -5317,7 +5971,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS int function_name_strlen; zend_free_op free_op1; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = &opline->op2.u.constant; @@ -5340,15 +5994,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -5362,7 +6018,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -5373,7 +6029,7 @@ static int ZEND_CASE_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -5388,12 +6044,12 @@ static int ZEND_CASE_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ zval_dtor(free_op1.var); EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -5425,10 +6081,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -5436,13 +6092,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -5472,7 +6130,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -5486,7 +6144,7 @@ static int ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5499,7 +6157,7 @@ static int ZEND_ADD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5512,7 +6170,7 @@ static int ZEND_SUB_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5525,7 +6183,7 @@ static int ZEND_MUL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5538,7 +6196,7 @@ static int ZEND_DIV_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5551,7 +6209,7 @@ static int ZEND_MOD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5564,7 +6222,7 @@ static int ZEND_SL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5577,7 +6235,7 @@ static int ZEND_SR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5590,7 +6248,7 @@ static int ZEND_CONCAT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5603,72 +6261,82 @@ static int ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); zval_dtor(free_op1.var); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); zval_dtor(free_op1.var); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); zval_dtor(free_op1.var); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); zval_dtor(free_op1.var); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); zval_dtor(free_op1.var); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5681,7 +6349,7 @@ static int ZEND_BW_OR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5694,7 +6362,7 @@ static int ZEND_BW_AND_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5707,7 +6375,7 @@ static int ZEND_BW_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5720,14 +6388,24 @@ static int ZEND_BOOL_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op2; + zend_free_op free_op2; + zval *str = &EX_T(opline->result.u.var).tmp_var; zval *var = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); zval var_copy; int use_copy = 0; + if (IS_TMP_VAR == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + if (Z_TYPE_P(var) != IS_STRING) { zend_make_printable_zval(var, &var_copy, &use_copy); @@ -5735,9 +6413,8 @@ static int ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) var = &var_copy; } } - add_string_to_string( &EX_T(opline->result.u.var).tmp_var, - _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), - var); + add_string_to_string(str, str, var); + if (use_copy) { zval_dtor(var); } @@ -5752,7 +6429,7 @@ static int ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -5760,7 +6437,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; zend_free_op free_op1, free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -5783,15 +6460,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -5806,7 +6485,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -5817,7 +6496,7 @@ static int ZEND_CASE_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -5833,12 +6512,12 @@ static int ZEND_CASE_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ zval_dtor(free_op1.var); EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5870,10 +6549,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -5881,13 +6560,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -5917,7 +6598,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -5931,7 +6612,7 @@ static int ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5944,7 +6625,7 @@ static int ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5957,7 +6638,7 @@ static int ZEND_SUB_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5970,7 +6651,7 @@ static int ZEND_MUL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5983,7 +6664,7 @@ static int ZEND_DIV_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -5996,7 +6677,7 @@ static int ZEND_MOD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -6009,7 +6690,7 @@ static int ZEND_SL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -6022,7 +6703,7 @@ static int ZEND_SR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -6035,7 +6716,7 @@ static int ZEND_CONCAT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -6048,72 +6729,82 @@ static int ZEND_IS_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); zval_dtor(free_op1.var); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); zval_dtor(free_op1.var); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); zval_dtor(free_op1.var); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); zval_dtor(free_op1.var); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); zval_dtor(free_op1.var); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -6126,7 +6817,7 @@ static int ZEND_BW_OR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -6139,7 +6830,7 @@ static int ZEND_BW_AND_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -6152,7 +6843,7 @@ static int ZEND_BW_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -6165,14 +6856,24 @@ static int ZEND_BOOL_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op2; + zend_free_op free_op2; + zval *str = &EX_T(opline->result.u.var).tmp_var; zval *var = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); zval var_copy; int use_copy = 0; + if (IS_TMP_VAR == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + if (Z_TYPE_P(var) != IS_STRING) { zend_make_printable_zval(var, &var_copy, &use_copy); @@ -6180,9 +6881,8 @@ static int ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) var = &var_copy; } } - add_string_to_string( &EX_T(opline->result.u.var).tmp_var, - _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), - var); + add_string_to_string(str, str, var); + if (use_copy) { zval_dtor(var); } @@ -6197,7 +6897,7 @@ static int ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -6205,7 +6905,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; zend_free_op free_op1, free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -6228,15 +6928,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -6251,7 +6953,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -6262,7 +6964,7 @@ static int ZEND_CASE_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -6278,12 +6980,12 @@ static int ZEND_CASE_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ zval_dtor(free_op1.var); EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -6315,10 +7017,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -6326,13 +7028,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -6362,7 +7066,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -6376,7 +7080,7 @@ static int ZEND_INIT_ARRAY_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6408,10 +7112,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -6419,13 +7123,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -6455,7 +7161,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -6469,7 +7175,7 @@ static int ZEND_INIT_ARRAY_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6482,7 +7188,7 @@ static int ZEND_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6495,7 +7201,7 @@ static int ZEND_SUB_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6508,7 +7214,7 @@ static int ZEND_MUL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6521,7 +7227,7 @@ static int ZEND_DIV_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6534,7 +7240,7 @@ static int ZEND_MOD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6547,7 +7253,7 @@ static int ZEND_SL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6560,7 +7266,7 @@ static int ZEND_SR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6573,7 +7279,7 @@ static int ZEND_CONCAT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6586,72 +7292,82 @@ static int ZEND_IS_IDENTICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6664,7 +7380,7 @@ static int ZEND_BW_OR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6677,7 +7393,7 @@ static int ZEND_BW_AND_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6690,7 +7406,7 @@ static int ZEND_BW_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6703,14 +7419,24 @@ static int ZEND_BOOL_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1; + + zval *str = &EX_T(opline->result.u.var).tmp_var; zval *var = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); zval var_copy; int use_copy = 0; + if (IS_TMP_VAR == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + if (Z_TYPE_P(var) != IS_STRING) { zend_make_printable_zval(var, &var_copy, &use_copy); @@ -6718,9 +7444,8 @@ static int ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) var = &var_copy; } } - add_string_to_string( &EX_T(opline->result.u.var).tmp_var, - _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), - var); + add_string_to_string(str, str, var); + if (use_copy) { zval_dtor(var); } @@ -6734,7 +7459,7 @@ static int ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -6742,7 +7467,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; zend_free_op free_op1; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -6765,15 +7490,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -6787,7 +7514,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -6798,7 +7525,7 @@ static int ZEND_CASE_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -6813,12 +7540,12 @@ static int ZEND_CASE_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ zval_dtor(free_op1.var); EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6850,10 +7577,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -6861,13 +7588,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -6897,7 +7626,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -6911,7 +7640,7 @@ static int ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_BW_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6922,7 +7651,7 @@ static int ZEND_BW_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -6933,20 +7662,19 @@ static int ZEND_BOOL_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval **var_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (!var_ptr) { + if (IS_VAR == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (IS_VAR == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); @@ -6958,7 +7686,7 @@ static int ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); increment_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -6967,29 +7695,27 @@ static int ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval **var_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (!var_ptr) { + if (IS_VAR == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (IS_VAR == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); @@ -7001,7 +7727,7 @@ static int ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); decrement_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -7010,25 +7736,24 @@ static int ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval **var_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (!var_ptr) { + if (IS_VAR == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (IS_VAR == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).tmp_var = *EG(uninitialized_zval_ptr); } @@ -7045,7 +7770,7 @@ static int ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); increment_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -7057,16 +7782,16 @@ static int ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval **var_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (!var_ptr) { + if (IS_VAR == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (IS_VAR == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).tmp_var = *EG(uninitialized_zval_ptr); } @@ -7083,7 +7808,7 @@ static int ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); decrement_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -7095,7 +7820,7 @@ static int ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -7114,7 +7839,7 @@ static int ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRINT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRINT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -7124,7 +7849,7 @@ static int ZEND_PRINT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -7133,7 +7858,7 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ zval tmp_varname; HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { + if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_string(&tmp_varname); @@ -7164,7 +7889,7 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); - new_zval->refcount++; + Z_ADDREF_P(new_zval); zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval); } break; @@ -7192,20 +7917,23 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ } - if (varname == &tmp_varname) { + if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = retval; + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } PZVAL_LOCK(*retval); switch (type) { case BP_VAR_R: case BP_VAR_IS: - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, *retval); break; case BP_VAR_UNSET: { zend_free_op free_res; + EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res); if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr); @@ -7213,133 +7941,187 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); FREE_OP_VAR_PTR(free_res); break; + default: + EX_T(opline->result.u.var).var.ptr_ptr = retval; + break; } } } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_R_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_R_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_VAR(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_W_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_W_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_VAR(BP_VAR_W, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_RW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_RW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_VAR(BP_VAR_RW, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_FUNC_ARG_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_FUNC_ARG_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_VAR(ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), EX(opline)->extended_value)?BP_VAR_W:BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_UNSET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_UNSET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_VAR(BP_VAR_UNSET, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_IS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_IS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_VAR(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_JMPZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int ret = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int ret; - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (IS_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (!ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPNZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPNZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int ret = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int ret; - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (IS_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPZNZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZNZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int retval = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int retval; - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (retval) { + if (IS_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } + if (EXPECTED(retval != 0)) { #if DEBUG_ZEND>=2 printf("Conditional jmp on true to %d\n", opline->extended_value); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } else { #if DEBUG_ZEND>=2 printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } } -static int ZEND_JMPZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int retval = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int retval; - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (IS_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPNZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int retval = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + zval *val = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + int retval; - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (IS_VAR == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *retval_ptr; @@ -7356,11 +8138,11 @@ static int ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) retval_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (!retval_ptr_ptr) { + if (IS_VAR == IS_VAR && !retval_ptr_ptr) { zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference"); } - if (IS_VAR == IS_VAR && !(*retval_ptr_ptr)->is_ref) { + if (IS_VAR == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && EX_T(opline->op1.u.var).var.fcall_returned_reference) { } else if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { @@ -7372,36 +8154,25 @@ static int ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); - (*retval_ptr_ptr)->refcount++; + if (EG(return_value_ptr_ptr)) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); + Z_ADDREF_PP(retval_ptr_ptr); - (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + } } else { return_by_value: retval_ptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); + if (!EG(return_value_ptr_ptr)) { + if (IS_VAR == IS_TMP_VAR) { + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } } else if (!0) { /* Not a temp var */ - if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || - (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0)) { + if (IS_VAR == IS_CONST || + EG(active_op_array)->return_reference == ZEND_RETURN_REF || + (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; ALLOC_ZVAL(ret); @@ -7410,7 +8181,7 @@ return_by_value: *EG(return_value_ptr_ptr) = ret; } else { *EG(return_value_ptr_ptr) = retval_ptr; - retval_ptr->refcount++; + Z_ADDREF_P(retval_ptr); } } else { zval *ret; @@ -7421,10 +8192,10 @@ return_by_value: } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *value; @@ -7436,6 +8207,7 @@ static int ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } + zend_exception_save(TSRMLS_C); /* Not sure if a complete copy is what we want here */ ALLOC_ZVAL(exception); INIT_PZVAL_COPY(exception, value); @@ -7444,11 +8216,12 @@ static int ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zend_throw_exception_object(exception TSRMLS_CC); + zend_exception_restore(TSRMLS_C); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_VAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); if (opline->extended_value==ZEND_DO_FCALL_BY_NAME @@ -7467,13 +8240,13 @@ static int ZEND_SEND_VAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!0) { zval_copy_ctor(valptr); } - zend_ptr_stack_push(&EG(argument_stack), valptr); + zend_vm_stack_push(valptr TSRMLS_CC); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } ZEND_VM_NEXT_OPCODE(); } -static int zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *varptr; @@ -7483,24 +8256,24 @@ static int zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS) if (varptr == &EG(uninitialized_zval)) { ALLOC_ZVAL(varptr); INIT_ZVAL(*varptr); - varptr->refcount = 0; + Z_SET_REFCOUNT_P(varptr, 0); } else if (PZVAL_IS_REF(varptr)) { zval *original_var = varptr; ALLOC_ZVAL(varptr); *varptr = *original_var; - varptr->is_ref = 0; - varptr->refcount = 0; + Z_UNSET_ISREF_P(varptr); + Z_SET_REFCOUNT_P(varptr, 0); zval_copy_ctor(varptr); } - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + Z_ADDREF_P(varptr); + zend_vm_stack_push(varptr TSRMLS_CC); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; /* for string offsets */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -7527,10 +8300,10 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX_T(opline->op1.u.var).var.fcall_returned_reference) && varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || - (varptr->refcount == 1 && (IS_VAR == IS_CV || free_op1.var)))) { - varptr->is_ref = 1; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + (Z_REFCOUNT_P(varptr) == 1 && (IS_VAR == IS_CV || free_op1.var)))) { + Z_SET_ISREF_P(varptr); + Z_ADDREF_P(varptr); + zend_vm_stack_push(varptr TSRMLS_CC); } else { zval *valptr; @@ -7542,13 +8315,13 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!0) { zval_copy_ctor(valptr); } - zend_ptr_stack_push(&EG(argument_stack), valptr); + zend_vm_stack_push(valptr TSRMLS_CC); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -7556,20 +8329,20 @@ static int ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *varptr; varptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (!varptr_ptr) { + if (IS_VAR == IS_VAR && !varptr_ptr) { zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); } SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr_ptr); varptr = *varptr_ptr; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + Z_ADDREF_P(varptr); + zend_vm_stack_push(varptr TSRMLS_CC); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -7580,7 +8353,7 @@ static int ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_BOOL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -7593,13 +8366,15 @@ static int ZEND_BOOL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SWITCH_FREE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SWITCH_FREE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - zend_switch_free(EX(opline), EX(Ts) TSRMLS_CC); + zend_op *opline = EX(opline); + + zend_switch_free(&EX_T(opline->op1.u.var), opline->extended_value TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -7610,10 +8385,6 @@ static int ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "__clone method called on non-object"); - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_NEXT_OPCODE(); } ce = Z_OBJCE_P(obj); @@ -7625,8 +8396,6 @@ static int ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object"); } - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; } if (ce && clone) { @@ -7650,8 +8419,8 @@ static int ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; - EX_T(opline->result.u.var).var.ptr->refcount=1; - EX_T(opline->result.u.var).var.ptr->is_ref=1; + Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); + Z_SET_ISREF_P(EX_T(opline->result.u.var).var.ptr); if (!RETURN_VALUE_USED(opline) || EG(exception)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } @@ -7660,7 +8429,7 @@ static int ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -7715,11 +8484,10 @@ static int ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op_array *new_op_array=NULL; - zval **original_return_value = EG(return_value_ptr_ptr); int return_value_used; zend_free_op free_op1; zval *inc_filename = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); @@ -7739,42 +8507,40 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { zend_file_handle file_handle; + char *resolved_path; - if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) { - cwd_state state; - - state.cwd_length = 0; - state.cwd = malloc(1); - state.cwd[0] = 0; - - failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) && - zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)); - - free(state.cwd); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + if (resolved_path) { + failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); + } else { + resolved_path = Z_STRVAL_P(inc_filename); } if (failure_retval) { - /* do nothing */ - } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { + /* do nothing, file already included */ + } else if (SUCCESS == zend_stream_open(resolved_path, &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); + file_handle.opened_path = estrdup(resolved_path); } if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) { new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { - zend_file_handle_dtor(&file_handle); + zend_file_handle_dtor(&file_handle TSRMLS_CC); failure_retval=1; } } else { if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } } + if (resolved_path != Z_STRVAL_P(inc_filename)) { + efree(resolved_path); + } } break; case ZEND_INCLUDE: @@ -7793,31 +8559,34 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (inc_filename==&tmp_inc_filename) { zval_dtor(&tmp_inc_filename); } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; - if (new_op_array) { - zval *saved_object; - zend_function *saved_function; - - EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr; + if (new_op_array && !EG(exception)) { + EX(original_return_value) = EG(return_value_ptr_ptr); + EG(return_value_ptr_ptr) = return_value_used ? EX_T(opline->result.u.var).var.ptr_ptr : NULL; EG(active_op_array) = new_op_array; EX_T(opline->result.u.var).var.ptr = NULL; - saved_object = EX(object); - saved_function = EX(function_state).function; + EX(current_object) = EX(object); EX(function_state).function = (zend_function *) new_op_array; EX(object) = NULL; - zend_execute(new_op_array TSRMLS_CC); + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + + if (zend_execute == execute) { + EX(call_opline) = opline; + ZEND_VM_ENTER(); + } else { + zend_execute(new_op_array TSRMLS_CC); + } - EX(function_state).function = saved_function; - EX(object) = saved_object; + EX(function_state).function = (zend_function *) EX(op_array); + EX(object) = EX(current_object); - if (!return_value_used) { - if (EX_T(opline->result.u.var).var.ptr) { - zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); - } - } else { /* return value is used */ + if (return_value_used) { if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); @@ -7828,7 +8597,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EG(opline_ptr) = &EX(opline); EG(active_op_array) = EX(op_array); - EG(function_state_ptr) = &EX(function_state); + EG(return_value_ptr_ptr) = EX(original_return_value); destroy_op_array(new_op_array TSRMLS_CC); efree(new_op_array); if (EG(exception)) { @@ -7842,18 +8611,46 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - EG(return_value_ptr_ptr) = original_return_value; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval tmp, *varname; HashTable *target_symbol_table; zend_free_op free_op1; + if (IS_VAR == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EG(active_symbol_table)) { + zend_execute_data *ex = EX(prev_execute_data); + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); + + if (zend_hash_quick_del(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + while (ex && ex->symbol_table == EG(active_symbol_table)) { + int i; + + if (ex->op_array) { + for (i = 0; i < ex->op_array->last_var; i++) { + if (ex->op_array->vars[i].hash_value == cv->hash_value && + ex->op_array->vars[i].name_len == cv->name_len && + !memcmp(ex->op_array->vars[i].name, cv->name, cv->name_len)) { + ex->CVs[i] = NULL; + break; + } + } + } + ex = ex->prev_execute_data; + } + } + EX(CVs)[opline->op1.u.var] = NULL; + } else if (EX(CVs)[opline->op1.u.var]) { + zval_ptr_dtor(EX(CVs)[opline->op1.u.var]); + EX(CVs)[opline->op1.u.var] = NULL; + } + ZEND_VM_NEXT_OPCODE(); + } + varname = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (Z_TYPE_P(varname) != IS_STRING) { @@ -7861,17 +8658,18 @@ static int ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_copy_ctor(&tmp); convert_to_string(&tmp); varname = &tmp; - } else if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { - varname->refcount++; + } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { + Z_ADDREF_P(varname); } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); } else { + ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1) == SUCCESS) { + if (zend_hash_quick_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value) == SUCCESS) { zend_execute_data *ex = execute_data; - ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); do { int i; @@ -7893,14 +8691,14 @@ static int ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (varname == &tmp) { zval_dtor(&tmp); - } else if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { + } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -7923,18 +8721,18 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ce = Z_OBJCE_PP(array_ptr_ptr); if (!ce || ce->get_iterator == NULL) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); - (*array_ptr_ptr)->refcount++; + Z_ADDREF_PP(array_ptr_ptr); } array_ptr = *array_ptr_ptr; } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); if (opline->extended_value & ZEND_FE_FETCH_BYREF) { - (*array_ptr_ptr)->is_ref = 1; + Z_SET_ISREF_PP(array_ptr_ptr); } } array_ptr = *array_ptr_ptr; - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { array_ptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); @@ -7947,12 +8745,12 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); if (!ce || !ce->get_iterator) { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && - !array_ptr->is_ref && - array_ptr->refcount > 1) { + !Z_ISREF_P(array_ptr) && + Z_REFCOUNT_P(array_ptr) > 1) { zval *tmp; ALLOC_ZVAL(tmp); @@ -7960,7 +8758,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_copy_ctor(tmp); array_ptr = tmp; } else { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } } @@ -7984,16 +8782,15 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } + AI_SET_PTR(EX_T(opline->result.u.var).var, array_ptr); PZVAL_LOCK(array_ptr); - EX_T(opline->result.u.var).var.ptr = array_ptr; - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; if (iter) { iter->index = 0; if (iter->funcs->rewind) { iter->funcs->rewind(iter TSRMLS_CC); if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -8005,7 +8802,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS; if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -8053,7 +8850,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8123,7 +8920,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) * In case that ever happens we need an additional flag. */ iter->funcs->move_forward(iter TSRMLS_CC); if (EG(exception)) { - array->refcount--; + Z_DELREF_P(array); zval_ptr_dtor(&array); ZEND_VM_NEXT_OPCODE(); } @@ -8132,7 +8929,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!iter || (iter->index > 0 && iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) { /* reached end of iteration */ if (EG(exception)) { - array->refcount--; + Z_DELREF_P(array); zval_ptr_dtor(&array); ZEND_VM_NEXT_OPCODE(); } @@ -8140,7 +8937,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } iter->funcs->get_current_data(iter, &value TSRMLS_CC); if (EG(exception)) { - array->refcount--; + Z_DELREF_P(array); zval_ptr_dtor(&array); ZEND_VM_NEXT_OPCODE(); } @@ -8152,7 +8949,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (iter->funcs->get_current_key) { key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC); if (EG(exception)) { - array->refcount--; + Z_DELREF_P(array); zval_ptr_dtor(&array); ZEND_VM_NEXT_OPCODE(); } @@ -8166,13 +8963,12 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value & ZEND_FE_FETCH_BYREF) { SEPARATE_ZVAL_IF_NOT_REF(value); - (*value)->is_ref = 1; + Z_SET_ISREF_PP(value); EX_T(opline->result.u.var).var.ptr_ptr = value; - (*value)->refcount++; + Z_ADDREF_PP(value); } else { - EX_T(opline->result.u.var).var.ptr_ptr = value; - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, *value); + PZVAL_LOCK(*value); } if (use_key) { @@ -8200,37 +8996,57 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1; - zval tmp, *varname = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval **value; zend_bool isset = 1; - HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { - tmp = *varname; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - varname = &tmp; - } + if (IS_VAR == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EX(CVs)[opline->op1.u.var]) { + value = EX(CVs)[opline->op1.u.var]; + } else if (EG(active_symbol_table)) { + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); - if (!value) { + if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + isset = 0; + } + } else { isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { - isset = 0; + HashTable *target_symbol_table; + zend_free_op free_op1; + zval tmp, *varname = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (Z_TYPE_P(varname) != IS_STRING) { + tmp = *varname; + zval_copy_ctor(&tmp); + convert_to_string(&tmp); + varname = &tmp; + } + + if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { + value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); + if (!value) { + isset = 0; + } + } else { + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); + if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { + isset = 0; + } } + + if (varname == &tmp) { + zval_dtor(&tmp); + } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; - switch (opline->extended_value) { + switch (opline->extended_value & ZEND_ISSET_ISEMPTY_MASK) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; @@ -8247,15 +9063,10 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; } - if (varname == &tmp) { - zval_dtor(&tmp); - } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_NEXT_OPCODE(); } -static int ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { #if 0 || (IS_VAR != IS_UNUSED) zend_op *opline = EX(opline); @@ -8263,19 +9074,39 @@ static int ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op1; zval *ptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (Z_TYPE_P(ptr) == IS_LONG) { - EG(exit_status) = Z_LVAL_P(ptr); - } else { - zend_print_variable(ptr); - } + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); + } else { + zend_print_variable(ptr); + } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } +#endif + zend_bailout(); + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_free_op free_op1; + zval *value = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (i_zend_is_true(value)) { + EX_T(opline->result.u.var).tmp_var = *value; + zendi_zval_copy_ctor(EX_T(opline->result.u.var).tmp_var); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } +#if DEBUG_ZEND>=2 + printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - zend_bailout(); + ZEND_VM_JMP(opline->op2.u.jmp_addr); + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8289,7 +9120,7 @@ static int ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8306,7 +9137,7 @@ static int ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8319,7 +9150,7 @@ static int ZEND_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8332,7 +9163,7 @@ static int ZEND_SUB_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8345,7 +9176,7 @@ static int ZEND_MUL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8358,7 +9189,7 @@ static int ZEND_DIV_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8371,7 +9202,7 @@ static int ZEND_MOD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8384,7 +9215,7 @@ static int ZEND_SL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8397,7 +9228,7 @@ static int ZEND_SR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8410,7 +9241,7 @@ static int ZEND_CONCAT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8423,72 +9254,82 @@ static int ZEND_IS_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8501,7 +9342,7 @@ static int ZEND_BW_OR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8514,7 +9355,7 @@ static int ZEND_BW_AND_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8527,7 +9368,7 @@ static int ZEND_BW_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8540,7 +9381,7 @@ static int ZEND_BOOL_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -8550,9 +9391,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval zval *property = &opline->op2.u.constant; zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -8563,8 +9407,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -8582,8 +9427,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -8591,49 +9437,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -8652,35 +9495,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - - if (object_ptr && IS_VAR != IS_CV && !(free_op1.var != NULL)) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = &opline->op2.u.constant; - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -8697,15 +9540,11 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binary_op)(zval *re if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -8715,7 +9554,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binary_op)(zval *re && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -8724,13 +9563,11 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binary_op)(zval *re } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -8738,62 +9575,62 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binary_op)(zval *re ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CONST(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8803,6 +9640,10 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZE zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -8844,13 +9685,14 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZE if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -8875,17 +9717,17 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZE ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_VAR_CONST(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_VAR_CONST(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -8895,6 +9737,10 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, Z zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -8934,7 +9780,8 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, Z if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -8947,7 +9794,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, Z zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -8966,68 +9813,87 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, Z ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_VAR_CONST(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_VAR_CONST(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = &opline->op2.u.constant; + zval **container; if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV && EX_T(opline->op1.u.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_R TSRMLS_CC); + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -9035,45 +9901,59 @@ static int ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_IS TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_IS TSRMLS_CC); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; - - if (IS_CONST == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = &opline->op2.u.constant; - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, type TSRMLS_CC); + zval *dim = &opline->op2.u.constant; + zval **container; - if (IS_VAR == IS_VAR && type == BP_VAR_W && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && (free_op1.var != NULL) && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_CONST == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); + } + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -9090,14 +9970,16 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SEPARATE_ZVAL_IF_NOT_REF(container); } } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -9117,54 +9999,42 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; zend_free_op free_op1; + zval *container = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval *offset = &opline->op2.u.constant; - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } } else { + zval *retval; + if (0) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (0) { @@ -9178,18 +10048,19 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_VAR_CONST(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = &opline->op2.u.constant; + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV) { + if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -9197,46 +10068,60 @@ static int ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_RW TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -9244,12 +10129,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_VAR_CONST(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -9257,22 +10142,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR /* Behave like FETCH_OBJ_W */ zend_free_op free_op1; zval *property = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -9283,7 +10171,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_res; @@ -9298,18 +10186,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -9324,45 +10214,85 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zend_free_op free_op1; zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + zval *property_name = &opline->op2.u.constant; - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { + + } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zend_free_op free_op1; - zval **object_ptr; + zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (IS_VAR == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - } else { - object_ptr = NULL; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + + zval *property_name = &opline->op2.u.constant; + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + } } else { - zend_free_op free_op_data1; + zend_free_op free_op_data1, free_op_data2; zval *value; zval *dim = &opline->op2.u.constant; + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -9371,19 +10301,41 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - + zend_free_op free_op1; zval *value = &opline->op2.u.constant; + zval **variable_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && !variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, IS_CONST TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, 0 TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (0?IS_TMP_VAR:IS_CONST), EX(Ts) TSRMLS_CC); /* zend_assign_to_variable() always takes care of op2, never free it! */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -9391,7 +10343,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS int function_name_strlen; zend_free_op free_op1; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = &opline->op2.u.constant; @@ -9414,15 +10366,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -9437,7 +10391,104 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_VAR == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_CONST != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + + + if (IS_CONST == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = &opline->op2.u.constant; + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } + + if (IS_CONST != IS_CONST) { + + } + } else { + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; + } + + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; + } else { + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); + } + } + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -9448,7 +10499,7 @@ static int ZEND_CASE_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -9463,12 +10514,69 @@ static int ZEND_CASE_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + + if (IS_VAR == IS_UNUSED) { + /* namespaced constant */ + if (!zend_get_constant_ex(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var, NULL, opline->extended_value TSRMLS_CC)) { + if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { + char *actual = (char *)zend_memrchr(Z_STRVAL(opline->op2.u.constant), '\\', Z_STRLEN(opline->op2.u.constant)); + if(!actual) { + actual = Z_STRVAL(opline->op2.u.constant); + } else { + actual++; + } + /* non-qualified constant - allow text substitution */ + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); + ZVAL_STRINGL(&EX_T(opline->result.u.var).tmp_var, actual, Z_STRLEN(opline->op2.u.constant)-(actual - Z_STRVAL(opline->op2.u.constant)), 1); + } else { + zend_error_noreturn(E_ERROR, "Undefined constant '%s'", + Z_STRVAL(opline->op2.u.constant), Z_STRVAL(opline->op2.u.constant)); + } + } + ZEND_VM_NEXT_OPCODE(); + } else { + /* class constant */ + zend_class_entry *ce; + zval **value; + + if (IS_VAR == IS_CONST) { + + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + } else { + ce = EX_T(opline->op1.u.var).class_entry; + } + + if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { + if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || + (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + zend_class_entry *old_scope = EG(scope); + + EG(scope) = ce; + zval_update_constant(value, (void *) 1 TSRMLS_CC); + EG(scope) = old_scope; + } + EX_T(opline->result.u.var).tmp_var = **value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } else { + zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + + ZEND_VM_NEXT_OPCODE(); + } +} + +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -9500,10 +10608,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -9511,13 +10619,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -9547,7 +10657,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -9561,7 +10671,7 @@ static int ZEND_INIT_ARRAY_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -9569,7 +10679,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = &opline->op2.u.constant; long index; - if (container) { + if (IS_VAR != IS_VAR || container) { if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -9590,7 +10700,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -9655,14 +10765,14 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval *offset = &opline->op2.u.constant; - if (container) { + if (IS_VAR != IS_VAR || container) { if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -9670,7 +10780,11 @@ static int ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -9687,7 +10801,7 @@ static int ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -9696,7 +10810,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, int result = 0; long index; - if (container) { + if (IS_VAR != IS_VAR || container) { zval *offset = &opline->op2.u.constant; @@ -9759,9 +10873,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -9813,17 +10937,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -9836,7 +10960,7 @@ static int ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -9849,7 +10973,7 @@ static int ZEND_SUB_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -9862,7 +10986,7 @@ static int ZEND_MUL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -9875,7 +10999,7 @@ static int ZEND_DIV_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -9888,7 +11012,7 @@ static int ZEND_MOD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -9901,7 +11025,7 @@ static int ZEND_SL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -9914,7 +11038,7 @@ static int ZEND_SR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -9927,7 +11051,7 @@ static int ZEND_CONCAT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -9940,72 +11064,82 @@ static int ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -10018,7 +11152,7 @@ static int ZEND_BW_OR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -10031,7 +11165,7 @@ static int ZEND_BW_AND_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -10044,7 +11178,7 @@ static int ZEND_BW_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -10057,7 +11191,7 @@ static int ZEND_BOOL_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -10067,9 +11201,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval * zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -10080,8 +11217,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval * FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -10099,8 +11237,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval * have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -10108,49 +11247,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval * if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -10169,35 +11305,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval * ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - - if (object_ptr && IS_VAR != IS_CV && !(free_op1.var != NULL)) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 1, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 1, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -10214,15 +11350,11 @@ static int zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_op)(zval *resu if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } zval_dtor(free_op2.var); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -10232,7 +11364,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_op)(zval *resu && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -10241,14 +11373,12 @@ static int zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_op)(zval *resu } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } zval_dtor(free_op2.var); - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -10256,62 +11386,62 @@ static int zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_op)(zval *resu ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_TMP(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -10321,6 +11451,10 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -10362,13 +11496,14 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -10393,17 +11528,17 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_VAR_TMP(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_VAR_TMP(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -10413,6 +11548,10 @@ static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEN zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -10452,7 +11591,8 @@ static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEN if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -10465,7 +11605,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEN zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -10484,68 +11624,87 @@ static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEN ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_VAR_TMP(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_VAR_TMP(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV && EX_T(opline->op1.u.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 1, BP_VAR_R TSRMLS_CC); + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_R TSRMLS_CC); zval_dtor(free_op2.var); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 1, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_W TSRMLS_CC); zval_dtor(free_op2.var); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 1, BP_VAR_RW TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_RW TSRMLS_CC); zval_dtor(free_op2.var); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -10553,45 +11712,59 @@ static int ZEND_FETCH_DIM_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 1, BP_VAR_IS TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_IS TSRMLS_CC); zval_dtor(free_op2.var); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; + zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; - if (IS_TMP_VAR == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 1, type TSRMLS_CC); - zval_dtor(free_op2.var); - if (IS_VAR == IS_VAR && type == BP_VAR_W && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && (free_op1.var != NULL) && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_TMP_VAR == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_R TSRMLS_CC); } + zval_dtor(free_op2.var); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -10608,14 +11781,16 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SEPARATE_ZVAL_IF_NOT_REF(container); } } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_UNSET TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_UNSET TSRMLS_CC); zval_dtor(free_op2.var); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -10635,54 +11810,42 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; zend_free_op free_op1; + zval *container = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - zval_dtor(free_op2.var); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } zval_dtor(free_op2.var); } else { + zval *retval; + if (1) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (1) { @@ -10696,18 +11859,19 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_O ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_VAR_TMP(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV) { + if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -10715,46 +11879,60 @@ static int ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_RW TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -10762,12 +11940,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_VAR_TMP(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -10775,22 +11953,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS /* Behave like FETCH_OBJ_W */ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -10801,7 +11982,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2, free_res; @@ -10816,18 +11997,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -10842,46 +12025,86 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - zend_free_op free_op1; + zend_free_op free_op1, free_op2; zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + zval *property_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (1) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (1) { + zval_ptr_dtor(&property_name); + } else { + zval_dtor(free_op2.var); + } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zend_free_op free_op1; - zval **object_ptr; + zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (IS_VAR == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - } else { - object_ptr = NULL; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + zend_free_op free_op2; + zval *property_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (1) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (1) { + zval_ptr_dtor(&property_name); + } else { + zval_dtor(free_op2.var); + } } else { - zend_free_op free_op2, free_op_data1; + zend_free_op free_op2, free_op_data1, free_op_data2; zval *value; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 1, BP_VAR_W TSRMLS_CC); zval_dtor(free_op2.var); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -10890,19 +12113,41 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op2; + zend_free_op free_op1, free_op2; zval *value = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **variable_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && !variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, IS_TMP_VAR TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, 1 TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (1?IS_TMP_VAR:IS_TMP_VAR), EX(Ts) TSRMLS_CC); /* zend_assign_to_variable() always takes care of op2, never free it! */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -10910,7 +12155,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; zend_free_op free_op1, free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -10933,15 +12178,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -10957,7 +12204,104 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_VAR == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_TMP_VAR != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + zend_free_op free_op2; + + if (IS_TMP_VAR == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } + + if (IS_TMP_VAR != IS_CONST) { + zval_dtor(free_op2.var); + } + } else { + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; + } + + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; + } else { + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); + } + } + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -10968,7 +12312,7 @@ static int ZEND_CASE_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -10984,12 +12328,12 @@ static int ZEND_CASE_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11021,10 +12365,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -11032,13 +12376,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -11068,7 +12414,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -11082,7 +12428,7 @@ static int ZEND_INIT_ARRAY_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11090,7 +12436,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); long index; - if (container) { + if (IS_VAR != IS_VAR || container) { if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -11111,7 +12457,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -11176,14 +12522,14 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (container) { + if (IS_VAR != IS_VAR || container) { if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -11191,7 +12537,11 @@ static int ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (1) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (1) { zval_ptr_dtor(&offset); } else { @@ -11208,7 +12558,7 @@ static int ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -11217,7 +12567,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE int result = 0; long index; - if (container) { + if (IS_VAR != IS_VAR || container) { zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -11280,9 +12630,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (1) { zval_ptr_dtor(&offset); @@ -11334,17 +12694,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11357,7 +12717,7 @@ static int ZEND_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11370,7 +12730,7 @@ static int ZEND_SUB_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11383,7 +12743,7 @@ static int ZEND_MUL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11396,7 +12756,7 @@ static int ZEND_DIV_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11409,7 +12769,7 @@ static int ZEND_MOD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11422,7 +12782,7 @@ static int ZEND_SL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11435,7 +12795,7 @@ static int ZEND_SR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11448,7 +12808,7 @@ static int ZEND_CONCAT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11461,72 +12821,82 @@ static int ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11539,7 +12909,7 @@ static int ZEND_BW_OR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11552,7 +12922,7 @@ static int ZEND_BW_AND_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11565,7 +12935,7 @@ static int ZEND_BW_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11578,7 +12948,7 @@ static int ZEND_BOOL_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -11588,9 +12958,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval * zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -11601,8 +12974,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval * FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -11620,8 +12994,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval * have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -11629,49 +13004,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval * if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -11690,35 +13062,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval * ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - - if (object_ptr && IS_VAR != IS_CV && !(free_op1.var != NULL)) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -11735,15 +13107,11 @@ static int zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_op)(zval *resu if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -11753,7 +13121,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_op)(zval *resu && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -11762,14 +13130,12 @@ static int zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_op)(zval *resu } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -11777,62 +13143,62 @@ static int zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_op)(zval *resu ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_VAR(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11842,6 +13208,10 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -11883,13 +13253,14 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -11914,17 +13285,17 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_VAR_VAR(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_VAR_VAR(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -11934,6 +13305,10 @@ static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEN zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -11973,7 +13348,8 @@ static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEN if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -11986,7 +13362,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEN zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -12005,68 +13381,87 @@ static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEN ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_VAR_VAR(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_VAR_VAR(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV && EX_T(opline->op1.u.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_R TSRMLS_CC); + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -12074,45 +13469,59 @@ static int ZEND_FETCH_DIM_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_IS TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_IS TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; + zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; - if (IS_VAR == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, type TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (IS_VAR == IS_VAR && type == BP_VAR_W && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && (free_op1.var != NULL) && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_VAR == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); + } + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -12129,14 +13538,16 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SEPARATE_ZVAL_IF_NOT_REF(container); } } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -12156,54 +13567,42 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; zend_free_op free_op1; + zval *container = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { + zval *retval; + if (0) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (0) { @@ -12217,18 +13616,19 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_O ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_VAR_VAR(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV) { + if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -12236,46 +13636,60 @@ static int ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_RW TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -12283,12 +13697,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_VAR_VAR(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -12296,22 +13710,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS /* Behave like FETCH_OBJ_W */ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -12322,7 +13739,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2, free_res; @@ -12337,18 +13754,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -12363,46 +13782,86 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - zend_free_op free_op1; + zend_free_op free_op1, free_op2; zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + zval *property_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zend_free_op free_op1; - zval **object_ptr; + zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (IS_VAR == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - } else { - object_ptr = NULL; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + zend_free_op free_op2; + zval *property_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } } else { - zend_free_op free_op2, free_op_data1; + zend_free_op free_op2, free_op_data1, free_op_data2; zval *value; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -12411,20 +13870,42 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op2; + zend_free_op free_op1, free_op2; zval *value = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **variable_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && !variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, IS_VAR TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, 0 TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (0?IS_TMP_VAR:IS_VAR), EX(Ts) TSRMLS_CC); /* zend_assign_to_variable() always takes care of op2, never free it! */ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -12433,14 +13914,14 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_VAR == IS_VAR && value_ptr_ptr && - !(*value_ptr_ptr)->is_ref && + !Z_ISREF_PP(value_ptr_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op2.u.var).var.fcall_returned_reference) { if (free_op2.var == NULL) { PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); - if (EG(exception)) { + if (UNEXPECTED(EG(exception) != NULL)) { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -12449,20 +13930,23 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(*value_ptr_ptr); } if (IS_VAR == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { - zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); + zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object"); } variable_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if ((IS_VAR == IS_VAR && !value_ptr_ptr) || + (IS_VAR == IS_VAR && !variable_ptr_ptr)) { + zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects"); + } zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { - (*variable_ptr_ptr)->refcount--; + Z_DELREF_PP(variable_ptr_ptr); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *variable_ptr_ptr); PZVAL_LOCK(*variable_ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -12471,7 +13955,7 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -12479,7 +13963,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; zend_free_op free_op1, free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -12502,15 +13986,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -12526,7 +14012,104 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_VAR == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_VAR != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + zend_free_op free_op2; + + if (IS_VAR == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } + + if (IS_VAR != IS_CONST) { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } + } else { + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; + } + + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; + } else { + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); + } + } + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -12537,7 +14120,7 @@ static int ZEND_CASE_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -12553,12 +14136,12 @@ static int ZEND_CASE_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -12590,10 +14173,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -12601,13 +14184,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -12637,7 +14222,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -12651,7 +14236,7 @@ static int ZEND_INIT_ARRAY_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -12659,7 +14244,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); long index; - if (container) { + if (IS_VAR != IS_VAR || container) { if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -12680,7 +14265,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -12745,14 +14330,14 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (container) { + if (IS_VAR != IS_VAR || container) { if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -12760,7 +14345,11 @@ static int ZEND_UNSET_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -12777,7 +14366,7 @@ static int ZEND_UNSET_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -12786,7 +14375,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE int result = 0; long index; - if (container) { + if (IS_VAR != IS_VAR || container) { zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -12849,9 +14438,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -12903,17 +14502,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -12923,9 +14522,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva zval *property = NULL; zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -12936,8 +14538,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -12955,8 +14558,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -12964,49 +14568,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -13025,35 +14626,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - - if (object_ptr && IS_VAR != IS_CV && !(free_op1.var != NULL)) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = NULL; - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -13070,15 +14671,11 @@ static int zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *r if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -13088,7 +14685,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *r && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -13097,13 +14694,11 @@ static int zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *r } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -13111,96 +14706,110 @@ static int zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *r ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = NULL; + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = NULL; + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -13208,66 +14817,201 @@ static int ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; + zval *dim = NULL; + zval **container; - if (IS_UNUSED == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && (free_op1.var != NULL) && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_UNUSED == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); + } + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); } - dim = NULL; - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, type TSRMLS_CC); - if (IS_VAR == IS_VAR && type == BP_VAR_W && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_op *op_data = opline+1; + zend_free_op free_op1; + zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + + zval *property_name = NULL; + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { + + } + } else { + zend_free_op free_op_data1, free_op_data2; + zval *value; + zval *dim = NULL; + zval **variable_ptr_ptr; + + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC); + + value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); + FREE_OP_IF_VAR(free_op_data1); + } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + /* assign_dim has two opcodes! */ + ZEND_VM_INC_OPCODE(); + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_VAR == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_UNUSED != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + + + if (IS_UNUSED == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = NULL; + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } } - } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_NEXT_OPCODE(); -} -static int ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *opline = EX(opline); - zend_op *op_data = opline+1; - zend_free_op free_op1; - zval **object_ptr; + if (IS_UNUSED != IS_CONST) { - if (IS_VAR == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + } } else { - object_ptr = NULL; + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; } - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; } else { - zend_free_op free_op_data1; - zval *value; - zval *dim = NULL; - - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC); + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); - value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); - FREE_OP_IF_VAR(free_op_data1); + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); + } } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - /* assign_dim has two opcodes! */ - ZEND_VM_INC_OPCODE(); + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13299,10 +15043,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -13310,13 +15054,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -13346,7 +15092,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -13360,7 +15106,7 @@ static int ZEND_INIT_ARRAY_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13373,7 +15119,7 @@ static int ZEND_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13386,7 +15132,7 @@ static int ZEND_SUB_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13399,7 +15145,7 @@ static int ZEND_MUL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13412,7 +15158,7 @@ static int ZEND_DIV_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13425,7 +15171,7 @@ static int ZEND_MOD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13438,7 +15184,7 @@ static int ZEND_SL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13451,7 +15197,7 @@ static int ZEND_SR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13464,7 +15210,7 @@ static int ZEND_CONCAT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13477,72 +15223,82 @@ static int ZEND_IS_IDENTICAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13555,7 +15311,7 @@ static int ZEND_BW_OR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13568,7 +15324,7 @@ static int ZEND_BW_AND_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13581,7 +15337,7 @@ static int ZEND_BW_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13594,7 +15350,7 @@ static int ZEND_BOOL_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -13604,9 +15360,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -13617,8 +15376,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -13636,8 +15396,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -13645,49 +15406,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -13706,35 +15464,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_VAR_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - - if (object_ptr && IS_VAR != IS_CV && !(free_op1.var != NULL)) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_VAR_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -13751,15 +15509,11 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_op)(zval *resul if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -13769,7 +15523,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_op)(zval *resul && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -13778,13 +15532,11 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_op)(zval *resul } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -13792,62 +15544,62 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_op)(zval *resul ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_VAR_CV(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13857,6 +15609,10 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_ zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -13898,13 +15654,14 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_ if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -13929,17 +15686,17 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_VAR_CV(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_VAR_CV(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -13949,6 +15706,10 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -13988,7 +15749,8 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -14001,7 +15763,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -14020,68 +15782,87 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_VAR_CV(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_VAR_CV(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container; if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV && EX_T(opline->op1.u.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_R TSRMLS_CC); + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -14089,45 +15870,59 @@ static int ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_IS TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_IS TSRMLS_CC); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; - - if (IS_CV == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, type TSRMLS_CC); + zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container; - if (IS_VAR == IS_VAR && type == BP_VAR_W && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && (free_op1.var != NULL) && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_CV == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -14144,14 +15939,16 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SEPARATE_ZVAL_IF_NOT_REF(container); } } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -14171,54 +15968,42 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; zend_free_op free_op1; + zval *container = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } } else { + zval *retval; + if (0) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (0) { @@ -14232,18 +16017,19 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OP ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_VAR_CV(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_VAR != IS_CV) { + if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -14251,46 +16037,60 @@ static int ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_RW TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -14298,12 +16098,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_VAR_CV(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -14311,22 +16111,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* Behave like FETCH_OBJ_W */ zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -14337,7 +16140,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_res; @@ -14352,18 +16155,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_VAR == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -14378,45 +16183,85 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zend_free_op free_op1; zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + zval *property_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zend_free_op free_op1; - zval **object_ptr; + zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (IS_VAR == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - } else { - object_ptr = NULL; + if (IS_VAR == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + + zval *property_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + } } else { - zend_free_op free_op_data1; + zend_free_op free_op_data1, free_op_data2; zval *value; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -14425,19 +16270,41 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - + zend_free_op free_op1; zval *value = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **variable_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && !variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, IS_CV TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, 0 TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (0?IS_TMP_VAR:IS_CV), EX(Ts) TSRMLS_CC); /* zend_assign_to_variable() always takes care of op2, never free it! */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -14446,14 +16313,14 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_CV == IS_VAR && value_ptr_ptr && - !(*value_ptr_ptr)->is_ref && + !Z_ISREF_PP(value_ptr_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op2.u.var).var.fcall_returned_reference) { if (free_op2.var == NULL) { PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); - if (EG(exception)) { + if (UNEXPECTED(EG(exception) != NULL)) { ZEND_VM_NEXT_OPCODE(); } @@ -14462,20 +16329,23 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(*value_ptr_ptr); } if (IS_VAR == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { - zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); + zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object"); } variable_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + if ((IS_CV == IS_VAR && !value_ptr_ptr) || + (IS_VAR == IS_VAR && !variable_ptr_ptr)) { + zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects"); + } zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { - (*variable_ptr_ptr)->refcount--; + Z_DELREF_PP(variable_ptr_ptr); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *variable_ptr_ptr); PZVAL_LOCK(*variable_ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -14483,7 +16353,7 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -14491,7 +16361,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; zend_free_op free_op1; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -14514,30 +16384,129 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { - EX(object) = NULL; - } else { - if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ - } else { - zval *this_ptr; - ALLOC_ZVAL(this_ptr); - INIT_PZVAL_COPY(this_ptr, EX(object)); - zval_copy_ctor(this_ptr); - EX(object) = this_ptr; + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { + EX(object) = NULL; + } else { + if (!PZVAL_IS_REF(EX(object))) { + Z_ADDREF_P(EX(object)); /* For $this pointer */ + } else { + zval *this_ptr; + ALLOC_ZVAL(this_ptr); + INIT_PZVAL_COPY(this_ptr, EX(object)); + zval_copy_ctor(this_ptr); + EX(object) = this_ptr; + } + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *function_name; + zend_class_entry *ce; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + if (IS_VAR == IS_CONST) { + /* no function found. try a static method in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); + } + EX(called_scope) = ce; + } else { + ce = EX_T(opline->op1.u.var).class_entry; + + if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { + EX(called_scope) = EG(called_scope); + } else { + EX(called_scope) = ce; + } + } + if(IS_CV != IS_UNUSED) { + char *function_name_strval = NULL; + int function_name_strlen = 0; + + + if (IS_CV == IS_CONST) { + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); + } else { + function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + + if (Z_TYPE_P(function_name) != IS_STRING) { + zend_error_noreturn(E_ERROR, "Function name must be a string"); + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } + } + + if (function_name_strval) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } + if (!EX(fbc)) { + zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); + } + } + + if (IS_CV != IS_CONST) { + + } + } else { + if(!ce->constructor) { + zend_error_noreturn(E_ERROR, "Can not call constructor"); + } + if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { + zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); + } + EX(fbc) = ce->constructor; + } + + if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + EX(object) = NULL; + } else { + if (EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + 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"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); + + } + if ((EX(object) = EG(This))) { + Z_ADDREF_P(EX(object)); + EX(called_scope) = Z_OBJCE_P(EX(object)); } } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -14548,7 +16517,7 @@ static int ZEND_CASE_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -14563,12 +16532,12 @@ static int ZEND_CASE_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -14600,10 +16569,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -14611,13 +16580,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -14647,7 +16618,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -14661,7 +16632,7 @@ static int ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -14669,7 +16640,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); long index; - if (container) { + if (IS_VAR != IS_VAR || container) { if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -14690,7 +16661,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_CV == IS_CV || IS_CV == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -14755,14 +16726,14 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if (container) { + if (IS_VAR != IS_VAR || container) { if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -14770,7 +16741,11 @@ static int ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -14787,7 +16762,7 @@ static int ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -14796,7 +16771,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN int result = 0; long index; - if (container) { + if (IS_VAR != IS_VAR || container) { zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -14859,9 +16834,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -14913,17 +16898,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -14934,10 +16919,6 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "__clone method called on non-object"); - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; - - ZEND_VM_NEXT_OPCODE(); } ce = Z_OBJCE_P(obj); @@ -14949,8 +16930,6 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object"); } - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; } if (ce && clone) { @@ -14974,8 +16953,8 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; - EX_T(opline->result.u.var).var.ptr->refcount=1; - EX_T(opline->result.u.var).var.ptr->is_ref=1; + Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); + Z_SET_ISREF_P(EX_T(opline->result.u.var).var.ptr); if (!RETURN_VALUE_USED(opline) || EG(exception)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } @@ -14984,7 +16963,7 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { #if 0 || (IS_UNUSED != IS_UNUSED) zend_op *opline = EX(opline); @@ -15004,7 +16983,7 @@ static int ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -15014,9 +16993,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z zval *property = &opline->op2.u.constant; zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -15027,8 +17009,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -15046,8 +17029,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -15055,49 +17039,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -15115,35 +17096,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - - if (object_ptr && IS_UNUSED != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = &opline->op2.u.constant; - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), NULL, dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -15160,15 +17141,11 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -15178,7 +17155,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -15187,13 +17164,11 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -15201,62 +17176,62 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -15266,6 +17241,10 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -15307,13 +17286,14 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -15338,17 +17318,17 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -15358,6 +17338,10 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -15397,7 +17381,8 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -15410,7 +17395,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -15429,64 +17414,52 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_UNUSED_CONST(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_UNUSED_CONST(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; + zval *container = _get_obj_zval_ptr_unused(TSRMLS_C); zval *offset = &opline->op2.u.constant; - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_obj_zval_ptr_unused(TSRMLS_C); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - - - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } } else { + zval *retval; + if (0) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (0) { @@ -15499,18 +17472,19 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, Z ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = &opline->op2.u.constant; + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_UNUSED != IS_CV) { + if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -15518,46 +17492,59 @@ static int ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_W TSRMLS_CC); + container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = &opline->op2.u.constant; + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_RW TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -15565,12 +17552,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -15578,22 +17565,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER /* Behave like FETCH_OBJ_W */ zend_free_op free_op1; zval *property = &opline->op2.u.constant; + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_W TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -15604,7 +17594,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_res; @@ -15619,18 +17609,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -15644,21 +17636,73 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + zval *property_name = &opline->op2.u.constant; + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + } /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *str = &EX_T(opline->result.u.var).tmp_var; + + if (IS_UNUSED == IS_UNUSED) { + /* Initialize for erealloc in add_char_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + + add_char_to_string(str, str, &opline->op2.u.constant); + + /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *str = &EX_T(opline->result.u.var).tmp_var; + + if (IS_UNUSED == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + + add_string_to_string(str, str, &opline->op2.u.constant); + + /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -15666,7 +17710,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_A int function_name_strlen; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = &opline->op2.u.constant; @@ -15689,15 +17733,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_A if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -15711,52 +17757,64 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_class_entry *ce = NULL; - zval **value; if (IS_UNUSED == IS_UNUSED) { -/* This seems to be a reminant of namespaces - if (EG(scope)) { - ce = EG(scope); - if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { - zval_update_constant(value, (void *) 1 TSRMLS_CC); - EX_T(opline->result.u.var).tmp_var = **value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - ZEND_VM_NEXT_OPCODE(); + /* namespaced constant */ + if (!zend_get_constant_ex(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var, NULL, opline->extended_value TSRMLS_CC)) { + if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { + char *actual = (char *)zend_memrchr(Z_STRVAL(opline->op2.u.constant), '\\', Z_STRLEN(opline->op2.u.constant)); + if(!actual) { + actual = Z_STRVAL(opline->op2.u.constant); + } else { + actual++; + } + /* non-qualified constant - allow text substitution */ + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); + ZVAL_STRINGL(&EX_T(opline->result.u.var).tmp_var, actual, Z_STRLEN(opline->op2.u.constant)-(actual - Z_STRVAL(opline->op2.u.constant)), 1); + } else { + zend_error_noreturn(E_ERROR, "Undefined constant '%s'", + Z_STRVAL(opline->op2.u.constant), Z_STRVAL(opline->op2.u.constant)); } } -*/ - if (!zend_get_constant(opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len, &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - opline->op2.u.constant.value.str.val, - opline->op2.u.constant.value.str.val); - EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - } ZEND_VM_NEXT_OPCODE(); - } + } else { + /* class constant */ + zend_class_entry *ce; + zval **value; - ce = EX_T(opline->op1.u.var).class_entry; + if (IS_UNUSED == IS_CONST) { - if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { - zend_class_entry *old_scope = EG(scope); + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + } else { + ce = EX_T(opline->op1.u.var).class_entry; + } - EG(scope) = ce; - zval_update_constant(value, (void *) 1 TSRMLS_CC); - EG(scope) = old_scope; - EX_T(opline->result.u.var).tmp_var = **value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - } else { - zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", opline->op2.u.constant.value.str.val); - } + if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { + if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || + (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + zend_class_entry *old_scope = EG(scope); - ZEND_VM_NEXT_OPCODE(); + EG(scope) = ce; + zval_update_constant(value, (void *) 1 TSRMLS_CC); + EG(scope) = old_scope; + } + EX_T(opline->result.u.var).tmp_var = **value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } else { + zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + + ZEND_VM_NEXT_OPCODE(); + } } -static int ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -15770,7 +17828,7 @@ static int ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -15778,7 +17836,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = &opline->op2.u.constant; long index; - if (container) { + if (IS_UNUSED != IS_VAR || container) { if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -15799,7 +17857,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -15863,14 +17921,14 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); zval *offset = &opline->op2.u.constant; - if (container) { + if (IS_UNUSED != IS_VAR || container) { if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -15878,7 +17936,11 @@ static int ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -15894,7 +17956,7 @@ static int ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -15903,7 +17965,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di int result = 0; long index; - if (container) { + if (IS_UNUSED != IS_VAR || container) { zval *offset = &opline->op2.u.constant; @@ -15966,9 +18028,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -16018,17 +18090,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -16038,9 +18110,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -16051,8 +18126,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -16070,8 +18146,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -16079,49 +18156,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -16139,35 +18213,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (object_ptr && IS_UNUSED != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } - - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), NULL, dim, 1, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 1, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -16184,15 +18258,11 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *r if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } zval_dtor(free_op2.var); - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -16202,7 +18272,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *r && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -16211,14 +18281,12 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *r } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } zval_dtor(free_op2.var); - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -16226,62 +18294,62 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *r ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -16291,6 +18359,10 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, Z zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -16332,13 +18404,14 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, Z if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -16363,17 +18436,17 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, Z ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -16383,6 +18456,10 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -16422,7 +18499,8 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -16435,7 +18513,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -16454,64 +18532,52 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_UNUSED_TMP(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_UNUSED_TMP(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; + zval *container = _get_obj_zval_ptr_unused(TSRMLS_C); zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_obj_zval_ptr_unused(TSRMLS_C); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - zval_dtor(free_op2.var); - - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } zval_dtor(free_op2.var); } else { + zval *retval; + if (1) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (1) { @@ -16524,18 +18590,19 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEN ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_UNUSED != IS_CV) { + if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -16543,46 +18610,59 @@ static int ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_W TSRMLS_CC); + container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_RW TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -16590,12 +18670,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -16603,22 +18683,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_A /* Behave like FETCH_OBJ_W */ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_W TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -16629,7 +18712,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_A } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2, free_res; @@ -16644,18 +18727,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -16669,21 +18754,74 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - + zend_free_op free_op2; zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + zval *property_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (1) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (1) { + zval_ptr_dtor(&property_name); + } else { + zval_dtor(free_op2.var); + } /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_free_op free_op2; + zval *str = &EX_T(opline->result.u.var).tmp_var; + zval *var = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval var_copy; + int use_copy = 0; + + if (IS_UNUSED == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + + if (Z_TYPE_P(var) != IS_STRING) { + zend_make_printable_zval(var, &var_copy, &use_copy); + + if (use_copy) { + var = &var_copy; + } + } + add_string_to_string(str, str, var); + + if (use_copy) { + zval_dtor(var); + } + /* original comment, possibly problematic: + * FREE_OP is missing intentionally here - we're always working on the same temporary variable + * (Zeev): I don't think it's problematic, we only use variables + * which aren't affected by FREE_OP(Ts, )'s anyway, unless they're + * string offsets or overloaded objects + */ + zval_dtor(free_op2.var); + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -16691,7 +18829,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG int function_name_strlen; zend_free_op free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -16714,15 +18852,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -16737,7 +18877,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -16751,7 +18891,7 @@ static int ZEND_INIT_ARRAY_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -16759,7 +18899,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); long index; - if (container) { + if (IS_UNUSED != IS_VAR || container) { if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -16780,7 +18920,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -16844,14 +18984,14 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (container) { + if (IS_UNUSED != IS_VAR || container) { if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -16859,7 +18999,11 @@ static int ZEND_UNSET_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (1) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (1) { zval_ptr_dtor(&offset); } else { @@ -16875,7 +19019,7 @@ static int ZEND_UNSET_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -16884,7 +19028,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, int result = 0; long index; - if (container) { + if (IS_UNUSED != IS_VAR || container) { zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -16947,9 +19091,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (1) { zval_ptr_dtor(&offset); @@ -16999,17 +19153,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -17019,9 +19173,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -17032,8 +19189,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -17051,58 +19209,56 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } - if (!have_get_ptr) { - zval *z = NULL; - - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (!have_get_ptr) { + zval *z = NULL; + + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -17120,35 +19276,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (object_ptr && IS_UNUSED != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } - - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), NULL, dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -17165,15 +19321,11 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *r if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -17183,7 +19335,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *r && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -17192,14 +19344,12 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *r } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -17207,62 +19357,62 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *r ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -17272,6 +19422,10 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, Z zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -17313,13 +19467,14 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, Z if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -17344,17 +19499,17 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, Z ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -17364,6 +19519,10 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -17403,7 +19562,8 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -17416,7 +19576,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -17435,64 +19595,52 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_UNUSED_VAR(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_UNUSED_VAR(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; + zval *container = _get_obj_zval_ptr_unused(TSRMLS_C); zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_obj_zval_ptr_unused(TSRMLS_C); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { + zval *retval; + if (0) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (0) { @@ -17505,18 +19653,19 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEN ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_UNUSED != IS_CV) { + if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -17524,46 +19673,59 @@ static int ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_W TSRMLS_CC); + container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_RW TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -17571,12 +19733,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -17584,22 +19746,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_A /* Behave like FETCH_OBJ_W */ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_W TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -17610,7 +19775,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_A } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2, free_res; @@ -17625,18 +19790,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -17650,21 +19817,74 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - + zend_free_op free_op2; zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + zval *property_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_free_op free_op2; + zval *str = &EX_T(opline->result.u.var).tmp_var; + zval *var = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval var_copy; + int use_copy = 0; + + if (IS_UNUSED == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + + if (Z_TYPE_P(var) != IS_STRING) { + zend_make_printable_zval(var, &var_copy, &use_copy); + + if (use_copy) { + var = &var_copy; + } + } + add_string_to_string(str, str, var); + + if (use_copy) { + zval_dtor(var); + } + /* original comment, possibly problematic: + * FREE_OP is missing intentionally here - we're always working on the same temporary variable + * (Zeev): I don't think it's problematic, we only use variables + * which aren't affected by FREE_OP(Ts, )'s anyway, unless they're + * string offsets or overloaded objects + */ + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -17672,7 +19892,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG int function_name_strlen; zend_free_op free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -17695,15 +19915,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -17718,7 +19940,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -17732,7 +19954,7 @@ static int ZEND_INIT_ARRAY_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -17740,7 +19962,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); long index; - if (container) { + if (IS_UNUSED != IS_VAR || container) { if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -17761,7 +19983,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -17825,14 +20047,14 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (container) { + if (IS_UNUSED != IS_VAR || container) { if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -17840,7 +20062,11 @@ static int ZEND_UNSET_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -17856,7 +20082,7 @@ static int ZEND_UNSET_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -17865,7 +20091,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, int result = 0; long index; - if (container) { + if (IS_UNUSED != IS_VAR || container) { zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -17928,9 +20154,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -17980,17 +20216,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -18000,9 +20236,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( zval *property = NULL; zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -18013,8 +20252,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -18032,8 +20272,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -18041,49 +20282,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -18101,35 +20339,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - - if (object_ptr && IS_UNUSED != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = NULL; - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), NULL, dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -18146,15 +20384,11 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -18164,7 +20398,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -18173,13 +20407,11 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -18187,62 +20419,62 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -18256,7 +20488,7 @@ static int ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -18266,9 +20498,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -18279,8 +20514,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -18298,8 +20534,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -18307,49 +20544,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -18367,35 +20601,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - - if (object_ptr && IS_UNUSED != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_UNUSED == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), NULL, dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -18412,15 +20646,11 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *re if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -18430,7 +20660,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *re && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -18439,13 +20669,11 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *re } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -18453,62 +20681,62 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *re ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_UNUSED_CV(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -18518,6 +20746,10 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZE zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -18559,13 +20791,14 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZE if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -18590,17 +20823,17 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZE ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_UNUSED_CV(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_UNUSED_CV(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -18610,6 +20843,10 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, Z zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -18649,7 +20886,8 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, Z if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -18662,7 +20900,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, Z zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -18681,64 +20919,52 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, Z ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_UNUSED_CV(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_UNUSED_CV(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; + zval *container = _get_obj_zval_ptr_unused(TSRMLS_C); zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_obj_zval_ptr_unused(TSRMLS_C); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - - - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } } else { + zval *retval; + if (0) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (0) { @@ -18751,18 +20977,19 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_UNUSED != IS_CV) { + if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -18770,46 +20997,59 @@ static int ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_W TSRMLS_CC); + container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_RW TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -18817,12 +21057,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -18830,22 +21070,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_AR /* Behave like FETCH_OBJ_W */ zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), property, BP_VAR_W TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -18856,7 +21099,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_AR } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_res; @@ -18871,18 +21114,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_UNUSED == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_UNUSED == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -18896,21 +21141,73 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); + zval *property_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_UNUSED == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + } /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + + zval *str = &EX_T(opline->result.u.var).tmp_var; + zval *var = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval var_copy; + int use_copy = 0; + + if (IS_UNUSED == IS_UNUSED) { + /* Initialize for erealloc in add_string_to_string */ + Z_STRVAL_P(str) = NULL; + Z_STRLEN_P(str) = 0; + Z_TYPE_P(str) = IS_STRING; + + INIT_PZVAL(str); + } + + if (Z_TYPE_P(var) != IS_STRING) { + zend_make_printable_zval(var, &var_copy, &use_copy); + + if (use_copy) { + var = &var_copy; + } + } + add_string_to_string(str, str, var); + + if (use_copy) { + zval_dtor(var); + } + /* original comment, possibly problematic: + * FREE_OP is missing intentionally here - we're always working on the same temporary variable + * (Zeev): I don't think it's problematic, we only use variables + * which aren't affected by FREE_OP(Ts, )'s anyway, unless they're + * string offsets or overloaded objects + */ + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -18918,7 +21215,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS int function_name_strlen; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -18941,15 +21238,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -18963,7 +21262,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -18977,7 +21276,7 @@ static int ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -18985,7 +21284,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); long index; - if (container) { + if (IS_UNUSED != IS_VAR || container) { if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -19006,7 +21305,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_CV == IS_CV || IS_CV == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -19070,14 +21369,14 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if (container) { + if (IS_UNUSED != IS_VAR || container) { if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -19085,7 +21384,11 @@ static int ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -19101,7 +21404,7 @@ static int ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -19110,7 +21413,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, int result = 0; long index; - if (container) { + if (IS_UNUSED != IS_VAR || container) { zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -19173,9 +21476,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -19225,17 +21538,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -19246,7 +21559,7 @@ static int ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -19257,20 +21570,19 @@ static int ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **var_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - if (!var_ptr) { + if (IS_CV == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (IS_CV == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } ZEND_VM_NEXT_OPCODE(); @@ -19282,7 +21594,7 @@ static int ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); increment_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -19291,28 +21603,26 @@ static int ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **var_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - if (!var_ptr) { + if (IS_CV == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (IS_CV == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } ZEND_VM_NEXT_OPCODE(); @@ -19324,7 +21634,7 @@ static int ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); decrement_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -19333,24 +21643,23 @@ static int ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **var_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - if (!var_ptr) { + if (IS_CV == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (IS_CV == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).tmp_var = *EG(uninitialized_zval_ptr); } @@ -19367,7 +21676,7 @@ static int ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); increment_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -19378,16 +21687,16 @@ static int ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **var_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - if (!var_ptr) { + if (IS_CV == IS_VAR && !var_ptr) { zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); } - if (*var_ptr == EG(error_zval_ptr)) { + if (IS_CV == IS_VAR && *var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).tmp_var = *EG(uninitialized_zval_ptr); } @@ -19404,7 +21713,7 @@ static int ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - val->refcount++; + Z_ADDREF_P(val); decrement_function(val); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); zval_ptr_dtor(&val); @@ -19415,7 +21724,7 @@ static int ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -19433,7 +21742,7 @@ static int ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -19443,7 +21752,7 @@ static int ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -19452,7 +21761,7 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A zval tmp_varname; HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { + if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_string(&tmp_varname); @@ -19483,7 +21792,7 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); - new_zval->refcount++; + Z_ADDREF_P(new_zval); zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval); } break; @@ -19511,20 +21820,23 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A } - if (varname == &tmp_varname) { + if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(varname); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = retval; + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); + } PZVAL_LOCK(*retval); switch (type) { case BP_VAR_R: case BP_VAR_IS: - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, *retval); break; case BP_VAR_UNSET: { zend_free_op free_res; + EX_T(opline->result.u.var).var.ptr_ptr = retval; PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res); if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr); @@ -19532,128 +21844,187 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); FREE_OP_VAR_PTR(free_res); break; + default: + EX_T(opline->result.u.var).var.ptr_ptr = retval; + break; } } } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_R_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_R_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_W_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_W_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_W, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_RW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_RW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_RW, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_FUNC_ARG_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_FUNC_ARG_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CV(ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), EX(opline)->extended_value)?BP_VAR_W:BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_UNSET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_UNSET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_UNSET, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_IS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_IS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_JMPZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int ret = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); + zval *val = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + int ret; + + if (IS_CV == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (!ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPNZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPNZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int ret = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); + zval *val = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + int ret; + if (IS_CV == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + ret = Z_LVAL_P(val); + } else { + ret = i_zend_is_true(val); + + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } if (ret) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPZNZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int retval = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); + zval *val = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + int retval; - if (retval) { + if (IS_CV == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } + if (EXPECTED(retval != 0)) { #if DEBUG_ZEND>=2 printf("Conditional jmp on true to %d\n", opline->extended_value); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } else { #if DEBUG_ZEND>=2 printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.u.opline_num]); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } } -static int ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int retval = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); + zval *val = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + int retval; + + if (IS_CV == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_JMPNZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - int retval = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); + zval *val = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + int retval; + + if (IS_CV == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { + retval = Z_LVAL_P(val); + } else { + retval = i_zend_is_true(val); + if (UNEXPECTED(EG(exception) != NULL)) { + ZEND_VM_CONTINUE(); + } + } Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); #endif - ZEND_VM_JMP(opline->op2.u.jmp_addr); + ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); + ZEND_VM_CONTINUE(); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *retval_ptr; @@ -19670,11 +22041,11 @@ static int ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) retval_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (!retval_ptr_ptr) { + if (IS_CV == IS_VAR && !retval_ptr_ptr) { zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference"); } - if (IS_CV == IS_VAR && !(*retval_ptr_ptr)->is_ref) { + if (IS_CV == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && EX_T(opline->op1.u.var).var.fcall_returned_reference) { } else if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { @@ -19686,36 +22057,25 @@ static int ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); - (*retval_ptr_ptr)->refcount++; + if (EG(return_value_ptr_ptr)) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); + Z_ADDREF_PP(retval_ptr_ptr); - (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); + } } else { return_by_value: retval_ptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; + if (!EG(return_value_ptr_ptr)) { + if (IS_CV == IS_TMP_VAR) { - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); } } else if (!0) { /* Not a temp var */ - if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || - (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0)) { + if (IS_CV == IS_CONST || + EG(active_op_array)->return_reference == ZEND_RETURN_REF || + (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; ALLOC_ZVAL(ret); @@ -19724,7 +22084,7 @@ return_by_value: *EG(return_value_ptr_ptr) = ret; } else { *EG(return_value_ptr_ptr) = retval_ptr; - retval_ptr->refcount++; + Z_ADDREF_P(retval_ptr); } } else { zval *ret; @@ -19735,10 +22095,10 @@ return_by_value: } } - ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *value; @@ -19750,6 +22110,7 @@ static int ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } + zend_exception_save(TSRMLS_C); /* Not sure if a complete copy is what we want here */ ALLOC_ZVAL(exception); INIT_PZVAL_COPY(exception, value); @@ -19758,11 +22119,12 @@ static int ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zend_throw_exception_object(exception TSRMLS_CC); + zend_exception_restore(TSRMLS_C); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_VAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); if (opline->extended_value==ZEND_DO_FCALL_BY_NAME @@ -19781,13 +22143,13 @@ static int ZEND_SEND_VAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!0) { zval_copy_ctor(valptr); } - zend_ptr_stack_push(&EG(argument_stack), valptr); + zend_vm_stack_push(valptr TSRMLS_CC); } ZEND_VM_NEXT_OPCODE(); } -static int zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *varptr; @@ -19797,24 +22159,24 @@ static int zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS) if (varptr == &EG(uninitialized_zval)) { ALLOC_ZVAL(varptr); INIT_ZVAL(*varptr); - varptr->refcount = 0; + Z_SET_REFCOUNT_P(varptr, 0); } else if (PZVAL_IS_REF(varptr)) { zval *original_var = varptr; ALLOC_ZVAL(varptr); *varptr = *original_var; - varptr->is_ref = 0; - varptr->refcount = 0; + Z_UNSET_ISREF_P(varptr); + Z_SET_REFCOUNT_P(varptr, 0); zval_copy_ctor(varptr); } - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + Z_ADDREF_P(varptr); + zend_vm_stack_push(varptr TSRMLS_CC); ; /* for string offsets */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -19841,10 +22203,10 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX_T(opline->op1.u.var).var.fcall_returned_reference) && varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || - (varptr->refcount == 1 && (IS_CV == IS_CV || free_op1.var)))) { - varptr->is_ref = 1; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + (Z_REFCOUNT_P(varptr) == 1 && (IS_CV == IS_CV || free_op1.var)))) { + Z_SET_ISREF_P(varptr); + Z_ADDREF_P(varptr); + zend_vm_stack_push(varptr TSRMLS_CC); } else { zval *valptr; @@ -19856,13 +22218,13 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!0) { zval_copy_ctor(valptr); } - zend_ptr_stack_push(&EG(argument_stack), valptr); + zend_vm_stack_push(valptr TSRMLS_CC); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -19870,19 +22232,19 @@ static int ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *varptr; varptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (!varptr_ptr) { + if (IS_CV == IS_VAR && !varptr_ptr) { zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); } SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr_ptr); varptr = *varptr_ptr; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + Z_ADDREF_P(varptr); + zend_vm_stack_push(varptr TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SEND_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SEND_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -19893,7 +22255,7 @@ static int ZEND_SEND_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -19905,7 +22267,7 @@ static int ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -19916,10 +22278,6 @@ static int ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "__clone method called on non-object"); - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; - - ZEND_VM_NEXT_OPCODE(); } ce = Z_OBJCE_P(obj); @@ -19931,8 +22289,6 @@ static int ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object"); } - EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); - EX_T(opline->result.u.var).var.ptr->refcount++; } if (ce && clone) { @@ -19956,8 +22312,8 @@ static int ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; - EX_T(opline->result.u.var).var.ptr->refcount=1; - EX_T(opline->result.u.var).var.ptr->is_ref=1; + Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); + Z_SET_ISREF_P(EX_T(opline->result.u.var).var.ptr); if (!RETURN_VALUE_USED(opline) || EG(exception)) { zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); } @@ -19966,7 +22322,7 @@ static int ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20021,11 +22377,10 @@ static int ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op_array *new_op_array=NULL; - zval **original_return_value = EG(return_value_ptr_ptr); int return_value_used; zval *inc_filename = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -20045,42 +22400,40 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { zend_file_handle file_handle; + char *resolved_path; - if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) { - cwd_state state; - - state.cwd_length = 0; - state.cwd = malloc(1); - state.cwd[0] = 0; - - failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) && - zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)); - - free(state.cwd); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + if (resolved_path) { + failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); + } else { + resolved_path = Z_STRVAL_P(inc_filename); } if (failure_retval) { - /* do nothing */ - } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { + /* do nothing, file already included */ + } else if (SUCCESS == zend_stream_open(resolved_path, &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); + file_handle.opened_path = estrdup(resolved_path); } if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) { new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { - zend_file_handle_dtor(&file_handle); + zend_file_handle_dtor(&file_handle TSRMLS_CC); failure_retval=1; } } else { if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } } + if (resolved_path != Z_STRVAL_P(inc_filename)) { + efree(resolved_path); + } } break; case ZEND_INCLUDE: @@ -20099,31 +22452,34 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (inc_filename==&tmp_inc_filename) { zval_dtor(&tmp_inc_filename); } - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; - if (new_op_array) { - zval *saved_object; - zend_function *saved_function; - EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr; + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + if (new_op_array && !EG(exception)) { + EX(original_return_value) = EG(return_value_ptr_ptr); + EG(return_value_ptr_ptr) = return_value_used ? EX_T(opline->result.u.var).var.ptr_ptr : NULL; EG(active_op_array) = new_op_array; EX_T(opline->result.u.var).var.ptr = NULL; - saved_object = EX(object); - saved_function = EX(function_state).function; + EX(current_object) = EX(object); EX(function_state).function = (zend_function *) new_op_array; EX(object) = NULL; - zend_execute(new_op_array TSRMLS_CC); + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + + if (zend_execute == execute) { + EX(call_opline) = opline; + ZEND_VM_ENTER(); + } else { + zend_execute(new_op_array TSRMLS_CC); + } - EX(function_state).function = saved_function; - EX(object) = saved_object; + EX(function_state).function = (zend_function *) EX(op_array); + EX(object) = EX(current_object); - if (!return_value_used) { - if (EX_T(opline->result.u.var).var.ptr) { - zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); - } - } else { /* return value is used */ + if (return_value_used) { if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); @@ -20134,7 +22490,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EG(opline_ptr) = &EX(opline); EG(active_op_array) = EX(op_array); - EG(function_state_ptr) = &EX(function_state); + EG(return_value_ptr_ptr) = EX(original_return_value); destroy_op_array(new_op_array TSRMLS_CC); efree(new_op_array); if (EG(exception)) { @@ -20148,18 +22504,46 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } - - EG(return_value_ptr_ptr) = original_return_value; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval tmp, *varname; HashTable *target_symbol_table; + if (IS_CV == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EG(active_symbol_table)) { + zend_execute_data *ex = EX(prev_execute_data); + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); + + if (zend_hash_quick_del(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + while (ex && ex->symbol_table == EG(active_symbol_table)) { + int i; + + if (ex->op_array) { + for (i = 0; i < ex->op_array->last_var; i++) { + if (ex->op_array->vars[i].hash_value == cv->hash_value && + ex->op_array->vars[i].name_len == cv->name_len && + !memcmp(ex->op_array->vars[i].name, cv->name, cv->name_len)) { + ex->CVs[i] = NULL; + break; + } + } + } + ex = ex->prev_execute_data; + } + } + EX(CVs)[opline->op1.u.var] = NULL; + } else if (EX(CVs)[opline->op1.u.var]) { + zval_ptr_dtor(EX(CVs)[opline->op1.u.var]); + EX(CVs)[opline->op1.u.var] = NULL; + } + ZEND_VM_NEXT_OPCODE(); + } + varname = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); if (Z_TYPE_P(varname) != IS_STRING) { @@ -20167,17 +22551,18 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_copy_ctor(&tmp); convert_to_string(&tmp); varname = &tmp; - } else if (IS_CV == IS_CV || IS_CV == IS_VAR) { - varname->refcount++; + } else if (IS_CV == IS_VAR || IS_CV == IS_CV) { + Z_ADDREF_P(varname); } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); } else { + ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1) == SUCCESS) { + if (zend_hash_quick_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value) == SUCCESS) { zend_execute_data *ex = execute_data; - ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); do { int i; @@ -20199,14 +22584,14 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (varname == &tmp) { zval_dtor(&tmp); - } else if (IS_CV == IS_CV || IS_CV == IS_VAR) { + } else if (IS_CV == IS_VAR || IS_CV == IS_CV) { zval_ptr_dtor(&varname); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20229,18 +22614,18 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ce = Z_OBJCE_PP(array_ptr_ptr); if (!ce || ce->get_iterator == NULL) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); - (*array_ptr_ptr)->refcount++; + Z_ADDREF_PP(array_ptr_ptr); } array_ptr = *array_ptr_ptr; } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); if (opline->extended_value & ZEND_FE_FETCH_BYREF) { - (*array_ptr_ptr)->is_ref = 1; + Z_SET_ISREF_PP(array_ptr_ptr); } } array_ptr = *array_ptr_ptr; - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { array_ptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -20253,12 +22638,12 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); if (!ce || !ce->get_iterator) { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } else { if ((IS_CV == IS_CV || IS_CV == IS_VAR) && - !array_ptr->is_ref && - array_ptr->refcount > 1) { + !Z_ISREF_P(array_ptr) && + Z_REFCOUNT_P(array_ptr) > 1) { zval *tmp; ALLOC_ZVAL(tmp); @@ -20266,7 +22651,7 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_copy_ctor(tmp); array_ptr = tmp; } else { - array_ptr->refcount++; + Z_ADDREF_P(array_ptr); } } } @@ -20290,16 +22675,15 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } + AI_SET_PTR(EX_T(opline->result.u.var).var, array_ptr); PZVAL_LOCK(array_ptr); - EX_T(opline->result.u.var).var.ptr = array_ptr; - EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; if (iter) { iter->index = 0; if (iter->funcs->rewind) { iter->funcs->rewind(iter TSRMLS_CC); if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { @@ -20311,7 +22695,7 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS; if (EG(exception)) { - array_ptr->refcount--; + Z_DELREF_P(array_ptr); zval_ptr_dtor(&array_ptr); if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { @@ -20359,37 +22743,57 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - - zval tmp, *varname = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC); zval **value; zend_bool isset = 1; - HashTable *target_symbol_table; - if (Z_TYPE_P(varname) != IS_STRING) { - tmp = *varname; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - varname = &tmp; - } + if (IS_CV == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { + if (EX(CVs)[opline->op1.u.var]) { + value = EX(CVs)[opline->op1.u.var]; + } else if (EG(active_symbol_table)) { + zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); - if (!value) { + if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + isset = 0; + } + } else { isset = 0; } } else { - target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { - isset = 0; + HashTable *target_symbol_table; + + zval tmp, *varname = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC); + + if (Z_TYPE_P(varname) != IS_STRING) { + tmp = *varname; + zval_copy_ctor(&tmp); + convert_to_string(&tmp); + varname = &tmp; + } + + if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { + value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); + if (!value) { + isset = 0; + } + } else { + target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); + if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { + isset = 0; + } + } + + if (varname == &tmp) { + zval_dtor(&tmp); } + } Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; - switch (opline->extended_value) { + switch (opline->extended_value & ZEND_ISSET_ISEMPTY_MASK) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; @@ -20406,14 +22810,10 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; } - if (varname == &tmp) { - zval_dtor(&tmp); - } - ZEND_VM_NEXT_OPCODE(); } -static int ZEND_EXIT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_EXIT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { #if 0 || (IS_CV != IS_UNUSED) zend_op *opline = EX(opline); @@ -20433,7 +22833,26 @@ static int ZEND_EXIT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_QM_ASSIGN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + + zval *value = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + + if (i_zend_is_true(value)) { + EX_T(opline->result.u.var).tmp_var = *value; + zendi_zval_copy_ctor(EX_T(opline->result.u.var).tmp_var); + +#if DEBUG_ZEND>=2 + printf("Conditional jmp to %d\n", opline->op2.u.opline_num); +#endif + ZEND_VM_JMP(opline->op2.u.jmp_addr); + } + + ZEND_VM_NEXT_OPCODE(); +} + +static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20447,7 +22866,7 @@ static int ZEND_QM_ASSIGN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20464,7 +22883,7 @@ static int ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20477,7 +22896,7 @@ static int ZEND_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20490,7 +22909,7 @@ static int ZEND_SUB_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20503,7 +22922,7 @@ static int ZEND_MUL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20516,7 +22935,7 @@ static int ZEND_DIV_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20529,7 +22948,7 @@ static int ZEND_MOD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20542,7 +22961,7 @@ static int ZEND_SL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20555,7 +22974,7 @@ static int ZEND_SR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20568,7 +22987,7 @@ static int ZEND_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20581,72 +23000,82 @@ static int ZEND_IS_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), &opline->op2.u.constant TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20659,7 +23088,7 @@ static int ZEND_BW_OR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20672,7 +23101,7 @@ static int ZEND_BW_AND_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20685,7 +23114,7 @@ static int ZEND_BW_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20698,7 +23127,7 @@ static int ZEND_BOOL_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -20708,9 +23137,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval zval *property = &opline->op2.u.constant; zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -20721,8 +23153,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -20740,8 +23173,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -20749,49 +23183,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -20809,35 +23240,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_CV_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - - if (object_ptr && IS_CV != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_CV == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_CV_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = &opline->op2.u.constant; - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -20854,15 +23285,11 @@ static int zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *res if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -20872,7 +23299,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *res && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -20881,13 +23308,11 @@ static int zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *res } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -20895,62 +23320,62 @@ static int zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *res ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CONST(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -20960,6 +23385,10 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEN zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -21001,13 +23430,14 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEN if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -21032,17 +23462,17 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEN ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_CV_CONST(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_CV_CONST(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -21052,6 +23482,10 @@ static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZE zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -21091,7 +23525,8 @@ static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZE if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -21104,7 +23539,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZE zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -21123,68 +23558,86 @@ static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZE ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_CV_CONST(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_CV_CONST(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *dim = &opline->op2.u.constant; + zval **container; if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV && EX_T(opline->op1.u.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), dim, 0, BP_VAR_R TSRMLS_CC); + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -21192,45 +23645,59 @@ static int ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *dim = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC), dim, 0, BP_VAR_IS TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_IS TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; - - if (IS_CONST == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = &opline->op2.u.constant; - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 0, type TSRMLS_CC); + zval *dim = &opline->op2.u.constant; + zval **container; - if (IS_CV == IS_VAR && type == BP_VAR_W && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && 0 && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_CONST == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); + } + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -21247,14 +23714,16 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SEPARATE_ZVAL_IF_NOT_REF(container); } } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -21274,54 +23743,42 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; + zval *container = _get_zval_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC); zval *offset = &opline->op2.u.constant; - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_zval_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - - - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } } else { + zval *retval; + if (0) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (0) { @@ -21334,18 +23791,19 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_CV_CONST(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = &opline->op2.u.constant; + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV) { + if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -21353,46 +23811,59 @@ static int ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), property, BP_VAR_RW TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -21400,12 +23871,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_CV_CONST(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -21413,22 +23884,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG /* Behave like FETCH_OBJ_W */ zend_free_op free_op1; zval *property = &opline->op2.u.constant; + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -21439,7 +23913,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_res; @@ -21454,18 +23928,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -21479,45 +23955,85 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + zval *property_name = &opline->op2.u.constant; + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + } /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - zval **object_ptr; + zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - } else { - object_ptr = NULL; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + + zval *property_name = &opline->op2.u.constant; + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + } } else { - zend_free_op free_op_data1; + zend_free_op free_op_data1, free_op_data2; zval *value; zval *dim = &opline->op2.u.constant; + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } @@ -21526,19 +24042,39 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *value = &opline->op2.u.constant; + zval **variable_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + + if (IS_CV == IS_VAR && !variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, IS_CONST TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, 0 TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (0?IS_TMP_VAR:IS_CONST), EX(Ts) TSRMLS_CC); /* zend_assign_to_variable() always takes care of op2, never free it! */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -21546,7 +24082,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = &opline->op2.u.constant; @@ -21569,15 +24105,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -21591,7 +24129,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -21602,7 +24140,7 @@ static int ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -21617,12 +24155,12 @@ static int ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -21654,10 +24192,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -21665,13 +24203,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -21701,7 +24241,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -21715,7 +24255,7 @@ static int ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -21723,7 +24263,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = &opline->op2.u.constant; long index; - if (container) { + if (IS_CV != IS_VAR || container) { if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -21744,7 +24284,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -21808,14 +24348,14 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC); zval *offset = &opline->op2.u.constant; - if (container) { + if (IS_CV != IS_VAR || container) { if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -21823,7 +24363,11 @@ static int ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -21839,7 +24383,7 @@ static int ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -21848,7 +24392,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z int result = 0; long index; - if (container) { + if (IS_CV != IS_VAR || container) { zval *offset = &opline->op2.u.constant; @@ -21911,9 +24455,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -21963,17 +24517,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -21986,7 +24540,7 @@ static int ZEND_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -21999,7 +24553,7 @@ static int ZEND_SUB_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22012,7 +24566,7 @@ static int ZEND_MUL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22025,7 +24579,7 @@ static int ZEND_DIV_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22038,7 +24592,7 @@ static int ZEND_MOD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22051,7 +24605,7 @@ static int ZEND_SL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22064,7 +24618,7 @@ static int ZEND_SR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22077,7 +24631,7 @@ static int ZEND_CONCAT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22090,72 +24644,82 @@ static int ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22168,7 +24732,7 @@ static int ZEND_BW_OR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22181,7 +24745,7 @@ static int ZEND_BW_AND_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22194,7 +24758,7 @@ static int ZEND_BW_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22207,7 +24771,7 @@ static int ZEND_BOOL_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -22217,9 +24781,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -22230,8 +24797,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -22249,8 +24817,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -22258,49 +24827,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -22318,35 +24884,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_CV_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - - if (object_ptr && IS_CV != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_CV == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_CV_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 1, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 1, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -22363,15 +24929,11 @@ static int zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *resul if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } zval_dtor(free_op2.var); - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -22381,7 +24943,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *resul && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -22390,14 +24952,12 @@ static int zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *resul } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } zval_dtor(free_op2.var); - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -22405,62 +24965,62 @@ static int zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *resul ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_TMP(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22470,6 +25030,10 @@ static int zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_ zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -22511,13 +25075,14 @@ static int zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_ if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -22542,17 +25107,17 @@ static int zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_CV_TMP(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_CV_TMP(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -22562,6 +25127,10 @@ static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -22601,7 +25170,8 @@ static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -22614,7 +25184,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -22633,68 +25203,86 @@ static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_CV_TMP(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_CV_TMP(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV && EX_T(opline->op1.u.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), dim, 1, BP_VAR_R TSRMLS_CC); + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_R TSRMLS_CC); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), dim, 1, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_W TSRMLS_CC); zval_dtor(free_op2.var); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 1, BP_VAR_RW TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_RW TSRMLS_CC); zval_dtor(free_op2.var); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -22702,45 +25290,59 @@ static int ZEND_FETCH_DIM_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC), dim, 1, BP_VAR_IS TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_IS TSRMLS_CC); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; - - if (IS_TMP_VAR == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 1, type TSRMLS_CC); - zval_dtor(free_op2.var); - if (IS_CV == IS_VAR && type == BP_VAR_W && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; + + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && 0 && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_TMP_VAR == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); + } + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_R TSRMLS_CC); } + zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -22757,14 +25359,16 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SEPARATE_ZVAL_IF_NOT_REF(container); } } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_UNSET TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_UNSET TSRMLS_CC); zval_dtor(free_op2.var); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -22784,54 +25388,42 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; + zval *container = _get_zval_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC); zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_zval_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - zval_dtor(free_op2.var); - - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } zval_dtor(free_op2.var); } else { + zval *retval; + if (1) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (1) { @@ -22844,18 +25436,19 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OP ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_CV_TMP(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV) { + if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -22863,46 +25456,59 @@ static int ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), property, BP_VAR_RW TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -22910,12 +25516,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_CV_TMP(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -22923,22 +25529,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* Behave like FETCH_OBJ_W */ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -22949,7 +25558,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2, free_res; @@ -22964,18 +25573,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (1) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (1) { zval_ptr_dtor(&property); } else { zval_dtor(free_op2.var); } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -22989,46 +25600,86 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - + zend_free_op free_op2; zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + zval *property_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (1) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (1) { + zval_ptr_dtor(&property_name); + } else { + zval_dtor(free_op2.var); + } /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - zval **object_ptr; + zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - } else { - object_ptr = NULL; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + zend_free_op free_op2; + zval *property_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (1) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (1) { + zval_ptr_dtor(&property_name); + } else { + zval_dtor(free_op2.var); + } } else { - zend_free_op free_op2, free_op_data1; + zend_free_op free_op2, free_op_data1, free_op_data2; zval *value; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 1, BP_VAR_W TSRMLS_CC); zval_dtor(free_op2.var); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } @@ -23037,19 +25688,39 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval *value = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **variable_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + + if (IS_CV == IS_VAR && !variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, IS_TMP_VAR TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, 1 TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (1?IS_TMP_VAR:IS_TMP_VAR), EX(Ts) TSRMLS_CC); /* zend_assign_to_variable() always takes care of op2, never free it! */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -23057,7 +25728,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; zend_free_op free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -23080,15 +25751,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -23103,7 +25776,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -23114,7 +25787,7 @@ static int ZEND_CASE_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -23130,12 +25803,12 @@ static int ZEND_CASE_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23167,10 +25840,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -23178,13 +25851,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -23214,7 +25889,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -23228,7 +25903,7 @@ static int ZEND_INIT_ARRAY_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23236,7 +25911,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); long index; - if (container) { + if (IS_CV != IS_VAR || container) { if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -23257,7 +25932,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -23321,14 +25996,14 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC); zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (container) { + if (IS_CV != IS_VAR || container) { if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -23336,7 +26011,11 @@ static int ZEND_UNSET_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (1) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (1) { zval_ptr_dtor(&offset); } else { @@ -23352,7 +26031,7 @@ static int ZEND_UNSET_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -23361,7 +26040,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN int result = 0; long index; - if (container) { + if (IS_CV != IS_VAR || container) { zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -23424,9 +26103,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (1) { zval_ptr_dtor(&offset); @@ -23476,17 +26165,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23499,7 +26188,7 @@ static int ZEND_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23512,7 +26201,7 @@ static int ZEND_SUB_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23525,7 +26214,7 @@ static int ZEND_MUL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23538,7 +26227,7 @@ static int ZEND_DIV_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23551,7 +26240,7 @@ static int ZEND_MOD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23564,7 +26253,7 @@ static int ZEND_SL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23577,7 +26266,7 @@ static int ZEND_SR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23590,7 +26279,7 @@ static int ZEND_CONCAT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23603,72 +26292,82 @@ static int ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23681,7 +26380,7 @@ static int ZEND_BW_OR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23694,7 +26393,7 @@ static int ZEND_BW_AND_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23707,7 +26406,7 @@ static int ZEND_BW_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23720,7 +26419,7 @@ static int ZEND_BOOL_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -23730,9 +26429,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -23743,8 +26445,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -23762,8 +26465,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -23771,49 +26475,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -23831,35 +26532,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_CV_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - - if (object_ptr && IS_CV != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_CV == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_CV_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -23876,15 +26577,11 @@ static int zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *resul if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -23894,7 +26591,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *resul && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -23903,14 +26600,12 @@ static int zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *resul } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -23918,62 +26613,62 @@ static int zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *resul ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_VAR(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -23983,6 +26678,10 @@ static int zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_ zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -24024,13 +26723,14 @@ static int zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_ if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -24055,17 +26755,17 @@ static int zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_CV_VAR(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_CV_VAR(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -24075,6 +26775,10 @@ static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -24114,7 +26818,8 @@ static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -24127,7 +26832,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -24146,68 +26851,86 @@ static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_CV_VAR(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_CV_VAR(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV && EX_T(opline->op1.u.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), dim, 0, BP_VAR_R TSRMLS_CC); + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -24215,45 +26938,59 @@ static int ZEND_FETCH_DIM_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC), dim, 0, BP_VAR_IS TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_IS TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; + zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; - if (IS_VAR == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 0, type TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (IS_CV == IS_VAR && type == BP_VAR_W && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && 0 && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_VAR == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); + } + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; @@ -24270,14 +27007,16 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SEPARATE_ZVAL_IF_NOT_REF(container); } } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -24297,54 +27036,42 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; + zval *container = _get_zval_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC); zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_zval_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { + zval *retval; + if (0) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (0) { @@ -24357,18 +27084,19 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OP ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_CV_VAR(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV) { + if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -24376,46 +27104,59 @@ static int ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), property, BP_VAR_RW TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -24423,12 +27164,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_CV_VAR(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -24436,22 +27177,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* Behave like FETCH_OBJ_W */ zend_free_op free_op1, free_op2; zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -24462,7 +27206,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_op2, free_res; @@ -24477,18 +27221,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -24502,46 +27248,86 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - + zend_free_op free_op2; zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + zval *property_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - zval **object_ptr; + zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - } else { - object_ptr = NULL; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + zend_free_op free_op2; + zval *property_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } } else { - zend_free_op free_op2, free_op_data1; + zend_free_op free_op2, free_op_data1, free_op_data2; zval *value; zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } @@ -24550,20 +27336,40 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval *value = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); + zval **variable_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + + if (IS_CV == IS_VAR && !variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, IS_VAR TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, 0 TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (0?IS_TMP_VAR:IS_VAR), EX(Ts) TSRMLS_CC); /* zend_assign_to_variable() always takes care of op2, never free it! */ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -24572,14 +27378,14 @@ static int ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_VAR == IS_VAR && value_ptr_ptr && - !(*value_ptr_ptr)->is_ref && + !Z_ISREF_PP(value_ptr_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op2.u.var).var.fcall_returned_reference) { if (free_op2.var == NULL) { PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); - if (EG(exception)) { + if (UNEXPECTED(EG(exception) != NULL)) { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -24588,20 +27394,23 @@ static int ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(*value_ptr_ptr); } if (IS_CV == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { - zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); + zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object"); } variable_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if ((IS_VAR == IS_VAR && !value_ptr_ptr) || + (IS_CV == IS_VAR && !variable_ptr_ptr)) { + zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects"); + } zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { - (*variable_ptr_ptr)->refcount--; + Z_DELREF_PP(variable_ptr_ptr); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *variable_ptr_ptr); PZVAL_LOCK(*variable_ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; @@ -24609,7 +27418,7 @@ static int ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -24617,7 +27426,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; zend_free_op free_op2; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -24640,15 +27449,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -24663,7 +27474,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -24674,7 +27485,7 @@ static int ZEND_CASE_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -24690,12 +27501,12 @@ static int ZEND_CASE_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -24727,10 +27538,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -24738,13 +27549,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -24774,7 +27587,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -24788,7 +27601,7 @@ static int ZEND_INIT_ARRAY_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -24796,7 +27609,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); long index; - if (container) { + if (IS_CV != IS_VAR || container) { if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -24817,7 +27630,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -24881,14 +27694,14 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC); zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (container) { + if (IS_CV != IS_VAR || container) { if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -24896,7 +27709,11 @@ static int ZEND_UNSET_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -24912,7 +27729,7 @@ static int ZEND_UNSET_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -24921,7 +27738,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN int result = 0; long index; - if (container) { + if (IS_CV != IS_VAR || container) { zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -24984,9 +27801,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -25036,17 +27863,17 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -25056,9 +27883,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval zval *property = NULL; zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -25069,8 +27899,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -25088,8 +27919,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -25097,49 +27929,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -25157,35 +27986,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - - if (object_ptr && IS_CV != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_CV == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = NULL; - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -25202,15 +28031,11 @@ static int zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *re if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -25220,7 +28045,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *re && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -25229,13 +28054,11 @@ static int zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *re } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -25243,96 +28066,109 @@ static int zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *re ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_UNUSED(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = NULL; + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = NULL; + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -25340,57 +28176,95 @@ static int ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; - - if (IS_UNUSED == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = NULL; - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 0, type TSRMLS_CC); + zval *dim = NULL; + zval **container; - if (IS_CV == IS_VAR && type == BP_VAR_W && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && 0 && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_UNUSED == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); + } + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - zval **object_ptr; + zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - } else { - object_ptr = NULL; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + + zval *property_name = NULL; - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { + + } } else { - zend_free_op free_op_data1; + zend_free_op free_op_data1, free_op_data2; zval *value; zval *dim = NULL; + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } @@ -25399,7 +28273,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25431,10 +28305,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -25442,13 +28316,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -25478,7 +28354,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25492,7 +28368,7 @@ static int ZEND_INIT_ARRAY_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25505,7 +28381,7 @@ static int ZEND_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SUB_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25518,7 +28394,7 @@ static int ZEND_SUB_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MUL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25531,7 +28407,7 @@ static int ZEND_MUL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_DIV_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25544,7 +28420,7 @@ static int ZEND_DIV_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_MOD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25557,7 +28433,7 @@ static int ZEND_MOD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25570,7 +28446,7 @@ static int ZEND_SL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_SR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_SR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25583,7 +28459,7 @@ static int ZEND_SR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25596,7 +28472,7 @@ static int ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25609,72 +28485,82 @@ static int ZEND_IS_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_identical_function(&EX_T(opline->result.u.var).tmp_var, + is_identical_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + Z_LVAL_P(result) = !Z_LVAL_P(result); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_NOT_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_not_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zval *result = &EX_T(opline->result.u.var).tmp_var; - is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var, + compare_function(result, _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_OR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25687,7 +28573,7 @@ static int ZEND_BW_OR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_AND_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25700,7 +28586,7 @@ static int ZEND_BW_AND_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BW_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25713,7 +28599,7 @@ static int ZEND_BW_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_BOOL_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25726,7 +28612,7 @@ static int ZEND_BOOL_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; @@ -25736,9 +28622,12 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); znode *result = &opline->result; - zval **retval = &EX_T(result->u.var).var.ptr; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + EX_T(result->u.var).var.ptr_ptr = NULL; make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; @@ -25749,8 +28638,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re FREE_OP(free_op_data1); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } else { /* here we are sure we are dealing with an object */ @@ -25768,8 +28658,9 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re have_get_ptr = 1; binary_op(*zptr, *zptr, value TSRMLS_CC); if (!RETURN_VALUE_UNUSED(result)) { - *retval = *zptr; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = *zptr; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(*zptr); } } } @@ -25777,49 +28668,46 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re if (!have_get_ptr) { zval *z = NULL; - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - if (Z_OBJ_HT_P(object)->read_property) { - z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); - } - break; - case ZEND_ASSIGN_DIM: - if (Z_OBJ_HT_P(object)->read_dimension) { - z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); - } - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (Z_OBJ_HT_P(object)->read_property) { + z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); + } + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + if (Z_OBJ_HT_P(object)->read_dimension) { + z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R TSRMLS_CC); + } } if (z) { if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); binary_op(z, z, value TSRMLS_CC); - switch (opline->extended_value) { - case ZEND_ASSIGN_OBJ: - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - break; - case ZEND_ASSIGN_DIM: - Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); - break; + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); + } else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { + Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); } if (!RETURN_VALUE_UNUSED(result)) { - *retval = z; - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = z; + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(z); } zval_ptr_dtor(&z); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (!RETURN_VALUE_UNUSED(result)) { - *retval = EG(uninitialized_zval_ptr); - PZVAL_LOCK(*retval); + EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); + EX_T(result->u.var).var.ptr_ptr = NULL; + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } } } @@ -25837,35 +28725,35 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re ZEND_VM_NEXT_OPCODE(); } -static int zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; - zend_bool increment_opline = 0; switch (opline->extended_value) { case ZEND_ASSIGN_OBJ: return zend_binary_assign_op_obj_helper_SPEC_CV_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; case ZEND_ASSIGN_DIM: { - zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - - if (object_ptr && IS_CV != IS_CV && !0) { - (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ - } + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } else if (Z_TYPE_PP(container) == IS_OBJECT) { + if (IS_CV == IS_VAR && !0) { + Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ + } return zend_binary_assign_op_obj_helper_SPEC_CV_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - var_ptr = get_zval_ptr_ptr(&op_data->op2, EX(Ts), &free_op_data2, BP_VAR_RW); - increment_opline = 1; + var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + ZEND_VM_INC_OPCODE(); } } break; @@ -25882,15 +28770,11 @@ static int zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result if (*var_ptr == EG(error_zval_ptr)) { if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); - } ZEND_VM_NEXT_OPCODE(); } @@ -25900,7 +28784,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result && Z_OBJ_HANDLER_PP(var_ptr, set)) { /* proxy object */ zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); - objval->refcount++; + Z_ADDREF_P(objval); binary_op(objval, objval, value TSRMLS_CC); Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC); zval_ptr_dtor(&objval); @@ -25909,13 +28793,11 @@ static int zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = var_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); PZVAL_LOCK(*var_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } - if (increment_opline) { - ZEND_VM_INC_OPCODE(); + if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); } @@ -25923,62 +28805,62 @@ static int zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SUB_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SUB_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MUL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MUL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_DIV_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIV_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_MOD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_MOD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_SR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_OR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_OR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_AND_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_AND_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ASSIGN_BW_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_binary_assign_op_helper_SPEC_CV_CV(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -25988,6 +28870,10 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_O zval **retval = &EX_T(opline->result.u.var).var.ptr; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -26029,13 +28915,14 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_O if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } z = value; } - z->refcount++; + Z_ADDREF_P(z); SEPARATE_ZVAL_IF_NOT_REF(&z); incdec_op(z); *retval = z; @@ -26060,17 +28947,17 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_O ZEND_VM_NEXT_OPCODE(); } -static int ZEND_PRE_INC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_CV_CV(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_PRE_DEC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_PRE_DEC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_pre_incdec_property_helper_SPEC_CV_CV(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -26080,6 +28967,10 @@ static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_ zval *retval = &EX_T(opline->result.u.var).tmp_var; int have_get_ptr = 0; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); + } + make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; @@ -26119,7 +29010,8 @@ static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_ if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); - if (z->refcount == 0) { + if (Z_REFCOUNT_P(z) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(z); zval_dtor(z); FREE_ZVAL(z); } @@ -26132,7 +29024,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_ zendi_zval_copy_ctor(*z_copy); INIT_PZVAL(z_copy); incdec_op(z_copy); - z->refcount++; + Z_ADDREF_P(z); Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); zval_ptr_dtor(&z_copy); zval_ptr_dtor(&z); @@ -26151,68 +29043,86 @@ static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_POST_INC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_CV_CV(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_POST_DEC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_post_incdec_property_helper_SPEC_CV_CV(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container; if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV && EX_T(opline->op1.u.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), dim, 0, BP_VAR_R TSRMLS_CC); + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_RW TSRMLS_CC); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -26220,45 +29130,59 @@ static int ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC), dim, 0, BP_VAR_IS TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_IS TSRMLS_CC); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; - zval *dim; - - if (IS_CV == IS_UNUSED && type == BP_VAR_R) { - zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); - } - dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 0, type TSRMLS_CC); + zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container; - if (IS_CV == IS_VAR && type == BP_VAR_W && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { - AI_USE_PTR(EX_T(opline->result.u.var).var); - if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { - SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && 0 && + READY_TO_DESTROY(free_op1.var)) { + AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); + } + } + } else { + if (IS_CV == IS_UNUSED) { + zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_R TSRMLS_CC); } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; @@ -26275,14 +29199,16 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SEPARATE_ZVAL_IF_NOT_REF(container); } } - zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_UNSET TSRMLS_CC); if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -26302,54 +29228,42 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_fetch_property_address_read_helper_SPEC_CV_CV(int type, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CV(int type, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval *container; - zval **retval; + zval *container = _get_zval_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC); zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - retval = &EX_T(opline->result.u.var).var.ptr; - EX_T(opline->result.u.var).var.ptr_ptr = retval; - - container = _get_zval_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC); - - if (container == EG(error_zval_ptr)) { - if (!RETURN_VALUE_UNUSED(&opline->result)) { - *retval = EG(error_zval_ptr); - PZVAL_LOCK(*retval); - AI_USE_PTR(EX_T(opline->result.u.var).var); - } - - - ZEND_VM_NEXT_OPCODE(); - } - - if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Trying to get property of non-object"); } - *retval = EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } } else { + zval *retval; + if (0) { MAKE_REAL_ZVAL_PTR(offset); } /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); + retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); - if (RETURN_VALUE_UNUSED(&opline->result) && ((*retval)->refcount == 0)) { - zval_dtor(*retval); - FREE_ZVAL(*retval); + if (RETURN_VALUE_UNUSED(&opline->result)) { + if (Z_REFCOUNT_P(retval) == 0) { + GC_REMOVE_ZVAL_FROM_BUFFER(retval); + zval_dtor(retval); + FREE_ZVAL(retval); + } } else { - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); - AI_USE_PTR(EX_T(opline->result.u.var).var); + AI_SET_PTR(EX_T(opline->result.u.var).var, retval); + PZVAL_LOCK(retval); } if (0) { @@ -26362,18 +29276,19 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CV(int type, ZEND_OPC ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_CV_CV(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container; - if (opline->extended_value == ZEND_FETCH_ADD_LOCK && IS_CV != IS_CV) { + if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; } @@ -26381,46 +29296,59 @@ static int ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } + /* We are going to assign the result by reference */ + if (opline->extended_value & ZEND_FETCH_MAKE_REF) { + Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); + Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); + } + ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), property, BP_VAR_RW TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -26428,12 +29356,12 @@ static int ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_fetch_property_address_read_helper_SPEC_CV_CV(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -26441,22 +29369,25 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* Behave like FETCH_OBJ_W */ zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC), property, BP_VAR_W TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -26467,7 +29398,7 @@ static int ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1, free_res; @@ -26482,18 +29413,20 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(property); } - zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); + if (IS_CV == IS_VAR && !container) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); + } + zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_CV == IS_VAR && 0 && - READY_TO_DESTROY(free_op1.var) && - !RETURN_VALUE_UNUSED(&opline->result)) { + READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && - ZVAL_REFCOUNT(*EX_T(opline->result.u.var).var.ptr_ptr) > 2) { + Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } @@ -26507,45 +29440,85 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + zval *property_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); + } /* assign_obj has two opcodes! */ ZEND_VM_INC_OPCODE(); ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op *op_data = opline+1; - zval **object_ptr; + zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) { - /* not an array offset */ - object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - } else { - object_ptr = NULL; + if (IS_CV == IS_VAR && !object_ptr) { + zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { + + zval *property_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + + if (0) { + MAKE_REAL_ZVAL_PTR(property_name); + } + zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + if (0) { + zval_ptr_dtor(&property_name); + } else { - if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { - zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); + } } else { - zend_free_op free_op_data1; + zend_free_op free_op_data1, free_op_data2; zval *value; zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC); value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); - zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC); + variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); + if (!variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } + FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } @@ -26554,19 +29527,39 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *value = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + zval **variable_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + + if (IS_CV == IS_VAR && !variable_ptr_ptr) { + if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, IS_CV TSRMLS_CC)) { + if (!RETURN_VALUE_UNUSED(&opline->result)) { + EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; + ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); + INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); + ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); + } + } else if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); + PZVAL_LOCK(EG(uninitialized_zval_ptr)); + } + } else { + value = zend_assign_to_variable(variable_ptr_ptr, value, 0 TSRMLS_CC); + if (!RETURN_VALUE_UNUSED(&opline->result)) { + AI_SET_PTR(EX_T(opline->result.u.var).var, value); + PZVAL_LOCK(value); + } + } - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (0?IS_TMP_VAR:IS_CV), EX(Ts) TSRMLS_CC); /* zend_assign_to_variable() always takes care of op2, never free it! */ ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; @@ -26575,14 +29568,14 @@ static int ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_CV == IS_VAR && value_ptr_ptr && - !(*value_ptr_ptr)->is_ref && + !Z_ISREF_PP(value_ptr_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op2.u.var).var.fcall_returned_reference) { if (free_op2.var == NULL) { PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); - if (EG(exception)) { + if (UNEXPECTED(EG(exception) != NULL)) { ZEND_VM_NEXT_OPCODE(); } @@ -26591,27 +29584,30 @@ static int ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(*value_ptr_ptr); } if (IS_CV == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { - zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); + zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object"); } variable_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); + if ((IS_CV == IS_VAR && !value_ptr_ptr) || + (IS_CV == IS_VAR && !variable_ptr_ptr)) { + zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects"); + } zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { - (*variable_ptr_ptr)->refcount--; + Z_DELREF_PP(variable_ptr_ptr); } if (!RETURN_VALUE_UNUSED(&opline->result)) { - EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; + AI_SET_PTR(EX_T(opline->result.u.var).var, *variable_ptr_ptr); PZVAL_LOCK(*variable_ptr_ptr); - AI_USE_PTR(EX_T(opline->result.u.var).var); } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval *function_name; @@ -26619,7 +29615,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int function_name_strlen; - zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL); + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -26642,15 +29638,17 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX(fbc)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); } + + EX(called_scope) = Z_OBJCE_P(EX(object)); } else { zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ + Z_ADDREF_P(EX(object)); /* For $this pointer */ } else { zval *this_ptr; ALLOC_ZVAL(this_ptr); @@ -26664,7 +29662,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); int switch_expr_is_overloaded=0; @@ -26675,7 +29673,7 @@ static int ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); } else { switch_expr_is_overloaded = 1; - EX_T(opline->op1.u.var).str_offset.str->refcount++; + Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); } } is_equal_function(&EX_T(opline->result.u.var).tmp_var, @@ -26690,12 +29688,12 @@ static int ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) */ EX_T(opline->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(opline->op1.u.var).var); + EX_T(opline->op1.u.var).var.ptr = NULL; } ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -26727,10 +29725,10 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } else #endif - if (PZVAL_IS_REF(expr_ptr)) { + if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); @@ -26738,13 +29736,15 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { - expr_ptr->refcount++; + Z_ADDREF_P(expr_ptr); } } if (offset) { + long l; switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); + DVAL_TO_LVAL(Z_DVAL_P(offset), l); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), l, &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -26774,7 +29774,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -26788,7 +29788,7 @@ static int ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } -static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -26796,7 +29796,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); long index; - if (container) { + if (IS_CV != IS_VAR || container) { if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -26817,7 +29817,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case IS_STRING: if (IS_CV == IS_CV || IS_CV == IS_VAR) { - offset->refcount++; + Z_ADDREF_P(offset); } if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && ht == &EG(symbol_table)) { @@ -26881,14 +29881,14 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC); zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if (container) { + if (IS_CV != IS_VAR || container) { if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_IF_NOT_REF(container); } @@ -26896,7 +29896,11 @@ static int ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -26912,7 +29916,7 @@ static int ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -26921,7 +29925,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND int result = 0; long index; - if (container) { + if (IS_CV != IS_VAR || container) { zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -26984,9 +29988,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -27036,20 +30050,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } -static int ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_error_noreturn(E_ERROR, "Invalid opcode %d/%d/%d.", EX(opline)->opcode, EX(opline)->op1.op_type, EX(opline)->op2.op_type); - ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); } @@ -28286,11 +31299,11 @@ void zend_init_opcodes_handlers(void) ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, - ZEND_SWITCH_FREE_SPEC_TMP_HANDLER, - ZEND_SWITCH_FREE_SPEC_TMP_HANDLER, - ZEND_SWITCH_FREE_SPEC_TMP_HANDLER, - ZEND_SWITCH_FREE_SPEC_TMP_HANDLER, - ZEND_SWITCH_FREE_SPEC_TMP_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, ZEND_SWITCH_FREE_SPEC_VAR_HANDLER, ZEND_SWITCH_FREE_SPEC_VAR_HANDLER, ZEND_SWITCH_FREE_SPEC_VAR_HANDLER, @@ -28421,7 +31434,7 @@ void zend_init_opcodes_handlers(void) ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_ADD_CHAR_SPEC_UNUSED_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, @@ -28446,7 +31459,7 @@ void zend_init_opcodes_handlers(void) ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_ADD_STRING_SPEC_UNUSED_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, @@ -28472,10 +31485,10 @@ void zend_init_opcodes_handlers(void) ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER, + ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER, ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, @@ -28781,27 +31794,27 @@ void zend_init_opcodes_handlers(void) ZEND_NEW_SPEC_HANDLER, ZEND_NEW_SPEC_HANDLER, ZEND_NEW_SPEC_HANDLER, + ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, @@ -29541,7 +32554,7 @@ void zend_init_opcodes_handlers(void) ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, @@ -29556,27 +32569,27 @@ void zend_init_opcodes_handlers(void) ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_GOTO_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_GOTO_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_GOTO_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_GOTO_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_GOTO_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, @@ -29731,31 +32744,31 @@ void zend_init_opcodes_handlers(void) ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER, ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER, ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, - ZEND_CATCH_SPEC_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_CATCH_SPEC_CV_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_CATCH_SPEC_CV_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_CATCH_SPEC_CV_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_CATCH_SPEC_CV_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_CATCH_SPEC_CV_HANDLER, ZEND_THROW_SPEC_CONST_HANDLER, ZEND_THROW_SPEC_CONST_HANDLER, ZEND_THROW_SPEC_CONST_HANDLER, @@ -29881,31 +32894,31 @@ void zend_init_opcodes_handlers(void) ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER, ZEND_NULL_HANDLER, ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER, - ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER, + ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER, ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER, ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER, @@ -30631,6 +33644,7 @@ void zend_init_opcodes_handlers(void) ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER, ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER, ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER, + ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, @@ -30655,57 +33669,56 @@ void zend_init_opcodes_handlers(void) ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_ADD_INTERFACE_SPEC_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, + ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER, ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER, ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER, ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER, @@ -30831,6 +33844,81 @@ void zend_init_opcodes_handlers(void) ZEND_USER_OPCODE_SPEC_HANDLER, ZEND_USER_OPCODE_SPEC_HANDLER, ZEND_USER_OPCODE_SPEC_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_JMP_SET_SPEC_CONST_HANDLER, + ZEND_JMP_SET_SPEC_CONST_HANDLER, + ZEND_JMP_SET_SPEC_CONST_HANDLER, + ZEND_JMP_SET_SPEC_CONST_HANDLER, + ZEND_JMP_SET_SPEC_CONST_HANDLER, + ZEND_JMP_SET_SPEC_TMP_HANDLER, + ZEND_JMP_SET_SPEC_TMP_HANDLER, + ZEND_JMP_SET_SPEC_TMP_HANDLER, + ZEND_JMP_SET_SPEC_TMP_HANDLER, + ZEND_JMP_SET_SPEC_TMP_HANDLER, + ZEND_JMP_SET_SPEC_VAR_HANDLER, + ZEND_JMP_SET_SPEC_VAR_HANDLER, + ZEND_JMP_SET_SPEC_VAR_HANDLER, + ZEND_JMP_SET_SPEC_VAR_HANDLER, + ZEND_JMP_SET_SPEC_VAR_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_JMP_SET_SPEC_CV_HANDLER, + ZEND_JMP_SET_SPEC_CV_HANDLER, + ZEND_JMP_SET_SPEC_CV_HANDLER, + ZEND_JMP_SET_SPEC_CV_HANDLER, + ZEND_JMP_SET_SPEC_CV_HANDLER, + ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_CONST_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, ZEND_NULL_HANDLER }; zend_opcode_handlers = (opcode_handler_t*)labels; diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index e1924a90c..52592dac2 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -2,7 +2,9 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC) { - zend_execute_data execute_data; + zend_execute_data *execute_data; + zend_bool nested = 0; + zend_bool original_in_execution = EG(in_execution); {%HELPER_VARS%} {%INTERNAL_LABELS%} @@ -11,47 +13,51 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC) return; } + EG(in_execution) = 1; + +zend_vm_enter: /* Initialize execute_data */ + execute_data = (zend_execute_data *)zend_vm_stack_alloc( + sizeof(zend_execute_data) + + sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2) + + sizeof(temp_variable) * op_array->T TSRMLS_CC); + + EX(CVs) = (zval***)((char*)execute_data + sizeof(zend_execute_data)); + memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); + EX(Ts) = (temp_variable *)(EX(CVs) + op_array->last_var * (EG(active_symbol_table) ? 1 : 2)); EX(fbc) = NULL; + EX(called_scope) = NULL; EX(object) = NULL; EX(old_error_reporting) = NULL; - if (op_array->T < TEMP_VAR_STACK_LIMIT) { - EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T); - } else { - EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0); - } - EX(CVs) = (zval***)do_alloca(sizeof(zval**) * op_array->last_var); - memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); EX(op_array) = op_array; - EX(original_in_execution) = EG(in_execution); EX(symbol_table) = EG(active_symbol_table); EX(prev_execute_data) = EG(current_execute_data); - EG(current_execute_data) = &execute_data; + EG(current_execute_data) = execute_data; + EX(nested) = nested; + nested = 1; - EG(in_execution) = 1; if (op_array->start_op) { ZEND_VM_SET_OPCODE(op_array->start_op); } else { ZEND_VM_SET_OPCODE(op_array->opcodes); } - if (op_array->uses_this && EG(This)) { - EG(This)->refcount++; /* For $this pointer */ - if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), NULL)==FAILURE) { - EG(This)->refcount--; + if (op_array->this_var != -1 && EG(This)) { + Z_ADDREF_P(EG(This)); /* For $this pointer */ + if (!EG(active_symbol_table)) { + EX(CVs)[op_array->this_var] = (zval**)EX(CVs) + (op_array->last_var + op_array->this_var); + *EX(CVs)[op_array->this_var] = EG(This); + } else { + if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void**)&EX(CVs)[op_array->this_var])==FAILURE) { + Z_DELREF_P(EG(This)); + } } } EG(opline_ptr) = &EX(opline); EX(function_state).function = (zend_function *) op_array; - EG(function_state_ptr) = &EX(function_state); -#if ZEND_DEBUG - /* function_state.function_symbol_table is saved as-is to a stack, - * which is an intentional UMR. Shut it up if we're in DEBUG. - */ - EX(function_state).function_symbol_table = NULL; -#endif + EX(function_state).arguments = NULL; while (1) { {%ZEND_VM_CONTINUE_LABEL%} @@ -62,7 +68,7 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC) #endif {%ZEND_VM_DISPATCH%} { - {%INTERNAL_EXECUTOR%} + {%INTERNAL_EXECUTOR%} } } diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 6f730291a..e99d0407a 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -16,7 +16,7 @@ | Authors: Dmitry Stogov | +----------------------------------------------------------------------+ - $Id: zend_vm_gen.php,v 1.12.2.5.2.6 2008/12/31 11:17:35 sebastian Exp $ + $Id: zend_vm_gen.php,v 1.12.2.5.2.4.2.5 2008/12/31 11:15:35 sebastian Exp $ */ $header_text = <<< DATA @@ -304,7 +304,7 @@ function helper_name($name, $spec, $op1, $op2) { } // Generates code for opcode handler or helper -function gen_code($f, $spec, $kind, $code, $op1, $op2) { +function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) { global $op1_type, $op2_type, $op1_get_zval_ptr, $op2_get_zval_ptr, $op1_get_zval_ptr_ptr, $op2_get_zval_ptr_ptr, $op1_get_obj_zval_ptr, $op2_get_obj_zval_ptr, @@ -343,7 +343,9 @@ function gen_code($f, $spec, $kind, $code, $op1, $op2) { "/ZEND_VM_C_LABEL\(\s*([A-Za-z_]*)\s*\)/m", "/ZEND_VM_C_GOTO\(\s*([A-Za-z_]*)\s*\)/m", "/^#if\s+1\s*\\|\\|.*[^\\\\]$/m", - "/^#if\s+0\s*&&.*[^\\\\]$/m" + "/^#if\s+0\s*&&.*[^\\\\]$/m", + "/^#ifdef\s+ZEND_VM_EXPORT\s*\n/m", + "/^#ifndef\s+ZEND_VM_EXPORT\s*\n/m" ), array( $op1_type[$op1], @@ -374,9 +376,14 @@ function gen_code($f, $spec, $kind, $code, $op1, $op2) { "goto \\1".(($spec && $kind != ZEND_VM_KIND_CALL)?("_SPEC".$prefix[$op1].$prefix[$op2]):""), "#if 1", "#if 0", + $export?"#if 1\n":"#if 0\n", + $export?"#if 0\n":"#if 1\n" ), $code); + if (0 && strpos($code, '{') === 0) { + $code = "{\n\tfprintf(stderr, \"$name\\n\");\n" . substr($code, 1); + } // Updating code according to selected threading model switch($kind) { case ZEND_VM_KIND_CALL: @@ -404,7 +411,7 @@ function gen_code($f, $spec, $kind, $code, $op1, $op2) { "/ZEND_VM_DISPATCH_TO_HELPER_EX\(\s*([A-Za-z_]*)\s*,\s*([A-Za-z_]*)\s*,\s*(.*)\s*\);/me", ), array( - "&execute_data", + "execute_data", "goto \\1".($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_LABEL", "'goto '.helper_name('\\1',$spec,'$op1','$op2')", "'\\2 = \\3; goto '.helper_name('\\1',$spec,'$op1','$op2').';'", @@ -420,7 +427,7 @@ function gen_code($f, $spec, $kind, $code, $op1, $op2) { "/ZEND_VM_DISPATCH_TO_HELPER_EX\(\s*([A-Za-z_]*)\s*,\s*([A-Za-z_]*)\s*,\s*(.*)\s*\);/me", ), array( - "&execute_data", + "execute_data", "goto \\1".($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_HANDLER", "'goto '.helper_name('\\1',$spec,'$op1','$op2')", "'\\2 = \\3; goto '.helper_name('\\1',$spec,'$op1','$op2').';'", @@ -481,7 +488,7 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno) // Generate opcode handler's entry point according to selected threading model switch($kind) { case ZEND_VM_KIND_CALL: - out($f,"static int ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n"); + out($f,"static int ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n"); break; case ZEND_VM_KIND_SWITCH: if ($spec) { @@ -502,7 +509,7 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno) } // Generate opcode handler's code - gen_code($f, $spec, $kind, $code, $op1, $op2); + gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name); } // Generates helper @@ -518,10 +525,10 @@ function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno) case ZEND_VM_KIND_CALL: if ($param == null) { // Helper without parameters - out($f, "static int ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."(ZEND_OPCODE_HANDLER_ARGS)\n"); + out($f, "static int ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."(ZEND_OPCODE_HANDLER_ARGS)\n"); } else { // Helper with parameter - out($f, "static int ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."(".$param.", ZEND_OPCODE_HANDLER_ARGS)\n"); + out($f, "static int ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."(".$param.", ZEND_OPCODE_HANDLER_ARGS)\n"); } break; case ZEND_VM_KIND_SWITCH: @@ -533,7 +540,7 @@ function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno) } // Generate helper's code - gen_code($f, $spec, $kind, $code, $op1, $op2); + gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name); } // Generates array of opcode handlers (specialized or unspecialized) @@ -685,10 +692,9 @@ function gen_null_handler($f) { // for undefined opcodes, do we emit code for it only once if (!$done) { $done = 1; - out($f,"static int ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n"); + out($f,"static int ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n"); out($f,"{\n"); out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", EX(opline)->opcode, EX(opline)->op1.op_type, EX(opline)->op2.op_type);\n"); - out($f,"\tZEND_VM_RETURN_FROM_EXECUTE_LOOP();\n"); out($f,"}\n\n"); } } @@ -763,12 +769,10 @@ function gen_executor_code($f, $spec, $kind, $prolog) { case ZEND_VM_KIND_SWITCH: out($f,"default:\n"); out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", EX(opline)->opcode, EX(opline)->op1.op_type, EX(opline)->op2.op_type);\n"); - out($f,"\tZEND_VM_RETURN_FROM_EXECUTE_LOOP();\n"); break; case ZEND_VM_KIND_GOTO: out($f,"ZEND_NULL_HANDLER:\n"); out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", EX(opline)->opcode, EX(opline)->op1.op_type, EX(opline)->op2.op_type);\n"); - out($f,"\tZEND_VM_RETURN_FROM_EXECUTE_LOOP();\n"); break; } } @@ -790,7 +794,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, if (preg_match("/(.*)[{][%]([A-Z_]*)[%][}](.*)/", $line, $m)) { switch ($m[2]) { case "DEFINES": - if (ZEND_VM_OLD_EXECUTOR) { + if (ZEND_VM_OLD_EXECUTOR && $spec) { out($f,"static int zend_vm_old_executor = 0;\n\n"); } out($f,"static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op);\n\n"); @@ -799,22 +803,34 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, out($f,"\n"); out($f,"#define ZEND_VM_CONTINUE() return 0\n"); out($f,"#define ZEND_VM_RETURN() return 1\n"); + out($f,"#define ZEND_VM_ENTER() return 2\n"); + out($f,"#define ZEND_VM_LEAVE() return 3\n"); out($f,"#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n\n"); out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n"); + out($f,"#undef EX\n"); + out($f,"#define EX(element) execute_data->element\n\n"); break; case ZEND_VM_KIND_SWITCH: out($f,"\n"); out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n"); - out($f,"#define ZEND_VM_RETURN() return\n"); + out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n"); + out($f,"#define ZEND_VM_ENTER() op_array = EG(active_op_array); goto zend_vm_enter\n"); + out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n"); out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opcode, opline); goto zend_vm_dispatch;\n\n"); - out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL &execute_data TSRMLS_CC\n"); + out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n"); + out($f,"#undef EX\n"); + out($f,"#define EX(element) execute_data->element\n\n"); break; case ZEND_VM_KIND_GOTO: out($f,"\n"); out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(EX(opline)->handler)\n"); - out($f,"#define ZEND_VM_RETURN() return\n"); + out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n"); + out($f,"#define ZEND_VM_ENTER() op_array = EG(active_op_array); goto zend_vm_enter\n"); + out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n"); out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode, opline));\n\n"); - out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL &execute_data TSRMLS_CC\n"); + out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n"); + out($f,"#undef EX\n"); + out($f,"#define EX(element) execute_data->element\n\n"); break; } break; @@ -851,7 +867,10 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, } break; case "ZEND_VM_CONTINUE_LABEL": - if ($kind == ZEND_VM_KIND_SWITCH) { + if ($kind == ZEND_VM_KIND_CALL) { + // Only SWITCH dispatch method use it + out($f,$m[1]."\tint ret;".$m[3]."\n"); + } else if ($kind == ZEND_VM_KIND_SWITCH) { // Only SWITCH dispatch method use it out($f,"zend_vm_continue:".$m[3]."\n"); } else { @@ -862,7 +881,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, // Emit code that dispatches to opcode handler switch ($kind) { case ZEND_VM_KIND_CALL: - out($f, $m[1]."if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0)".$m[3]."\n"); + out($f, $m[1]."if ((ret = EX(opline)->handler(execute_data TSRMLS_CC)) > 0)".$m[3]."\n"); break; case ZEND_VM_KIND_SWITCH: out($f, $m[1]."dispatch_handler = EX(opline)->handler;\nzend_vm_dispatch:\n".$m[1]."switch ((int)dispatch_handler)".$m[3]."\n"); @@ -875,7 +894,18 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, case "INTERNAL_EXECUTOR": if ($kind == ZEND_VM_KIND_CALL) { // Executor is defined as a set of functions - out($f, $m[1]."return;".$m[3]."\n"); + out($f, $m[1]."switch (ret) {\n" . + $m[1]."\tcase 1:\n" . + $m[1]."\t\tEG(in_execution) = original_in_execution;\n". + $m[1]."\t\treturn;\n". + $m[1]."\tcase 2:\n" . + $m[1]."\t\top_array = EG(active_op_array);\n". + $m[1]."\t\tgoto zend_vm_enter;\n". + $m[1]."\tcase 3:\n" . + $m[1]."\t\texecute_data = EG(current_execute_data);\n". + $m[1]."\tdefault:\n". + $m[1]."\t\tbreak;\n". + $m[1]."}".$m[3]."\n"); } else { // Emit executor code gen_executor_code($f, $spec, $kind, $m[1]); @@ -886,9 +916,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, // Unspecialized executor with CALL threading is the same as the // old one, so we don't need to produce code twitch if (!$old || ZEND_VM_SPEC || (ZEND_VM_KIND != ZEND_VM_KIND_CALL)) { - out($f,"#undef EX\n"); - out($f,"#define EX(element) execute_data->element\n\n"); - // Emit executor code + // Emit executor code gen_executor_code($f, $spec, $kind, $m[1]); } } @@ -1098,11 +1126,11 @@ function gen_vm($def, $skel) { out($f, $GLOBALS['header_text']); // Support for ZEND_USER_OPCODE - out($f, "static opcode_handler_t zend_user_opcode_handlers[256] = {"); + out($f, "static user_opcode_handler_t zend_user_opcode_handlers[256] = {"); for ($i = 0; $i < 255; ++$i) { - out($f, "(opcode_handler_t)NULL,"); + out($f, "(user_opcode_handler_t)NULL,"); } - out($f, "(opcode_handler_t)NULL};\n\n"); + out($f, "(user_opcode_handler_t)NULL};\n\n"); out($f, "static zend_uchar zend_user_opcodes[256] = {"); for ($i = 0; $i < 255; ++$i) { @@ -1120,6 +1148,8 @@ function gen_vm($def, $skel) { out($f,"#define EX(element) execute_data.element\n\n"); out($f,"#undef ZEND_VM_CONTINUE\n\n"); out($f,"#undef ZEND_VM_RETURN\n\n"); + out($f,"#undef ZEND_VM_ENTER\n\n"); + out($f,"#undef ZEND_VM_LEAVE\n\n"); out($f,"#undef ZEND_VM_DISPATCH\n\n"); out($f,"#undef ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL\n\n"); gen_executor($f, $skl, 0, ZEND_VM_KIND_CALL, "old_execute", "zend_vm_use_old_executor", 1); @@ -1176,10 +1206,14 @@ function gen_vm($def, $skel) { out($f,"#define EX(element) execute_data->element\n\n"); out($f,"#undef ZEND_VM_CONTINUE\n"); out($f,"#undef ZEND_VM_RETURN\n"); + out($f,"#undef ZEND_VM_ENTER\n"); + out($f,"#undef ZEND_VM_LEAVE\n"); out($f,"#undef ZEND_VM_DISPATCH\n"); out($f,"#undef ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL\n\n"); out($f,"#define ZEND_VM_CONTINUE() return 0\n"); out($f,"#define ZEND_VM_RETURN() return 1\n"); + out($f,"#define ZEND_VM_ENTER() return 2\n"); + out($f,"#define ZEND_VM_LEAVE() return 3\n"); out($f,"#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n\n"); out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n\n"); } @@ -1223,7 +1257,7 @@ function gen_vm($def, $skel) { } } if (!$done) { - gen_code($f, 0, ZEND_VM_KIND_CALL, $code, 'ANY', 'ANY'); + gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY', $name); } } diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 6a4f6eb15..502529bc2 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -18,132 +18,138 @@ +----------------------------------------------------------------------+ */ -#define ZEND_NOP 0 -#define ZEND_ADD 1 -#define ZEND_SUB 2 -#define ZEND_MUL 3 -#define ZEND_DIV 4 -#define ZEND_MOD 5 -#define ZEND_SL 6 -#define ZEND_SR 7 -#define ZEND_CONCAT 8 -#define ZEND_BW_OR 9 -#define ZEND_BW_AND 10 -#define ZEND_BW_XOR 11 -#define ZEND_BW_NOT 12 -#define ZEND_BOOL_NOT 13 -#define ZEND_BOOL_XOR 14 -#define ZEND_IS_IDENTICAL 15 -#define ZEND_IS_NOT_IDENTICAL 16 -#define ZEND_IS_EQUAL 17 -#define ZEND_IS_NOT_EQUAL 18 -#define ZEND_IS_SMALLER 19 -#define ZEND_IS_SMALLER_OR_EQUAL 20 -#define ZEND_CAST 21 -#define ZEND_QM_ASSIGN 22 -#define ZEND_ASSIGN_ADD 23 -#define ZEND_ASSIGN_SUB 24 -#define ZEND_ASSIGN_MUL 25 -#define ZEND_ASSIGN_DIV 26 -#define ZEND_ASSIGN_MOD 27 -#define ZEND_ASSIGN_SL 28 -#define ZEND_ASSIGN_SR 29 -#define ZEND_ASSIGN_CONCAT 30 -#define ZEND_ASSIGN_BW_OR 31 -#define ZEND_ASSIGN_BW_AND 32 -#define ZEND_ASSIGN_BW_XOR 33 -#define ZEND_PRE_INC 34 -#define ZEND_PRE_DEC 35 -#define ZEND_POST_INC 36 -#define ZEND_POST_DEC 37 -#define ZEND_ASSIGN 38 -#define ZEND_ASSIGN_REF 39 -#define ZEND_ECHO 40 -#define ZEND_PRINT 41 -#define ZEND_JMP 42 -#define ZEND_JMPZ 43 -#define ZEND_JMPNZ 44 -#define ZEND_JMPZNZ 45 -#define ZEND_JMPZ_EX 46 -#define ZEND_JMPNZ_EX 47 -#define ZEND_CASE 48 -#define ZEND_SWITCH_FREE 49 -#define ZEND_BRK 50 -#define ZEND_CONT 51 -#define ZEND_BOOL 52 -#define ZEND_INIT_STRING 53 -#define ZEND_ADD_CHAR 54 -#define ZEND_ADD_STRING 55 -#define ZEND_ADD_VAR 56 -#define ZEND_BEGIN_SILENCE 57 -#define ZEND_END_SILENCE 58 -#define ZEND_INIT_FCALL_BY_NAME 59 -#define ZEND_DO_FCALL 60 -#define ZEND_DO_FCALL_BY_NAME 61 -#define ZEND_RETURN 62 -#define ZEND_RECV 63 -#define ZEND_RECV_INIT 64 -#define ZEND_SEND_VAL 65 -#define ZEND_SEND_VAR 66 -#define ZEND_SEND_REF 67 -#define ZEND_NEW 68 -#define ZEND_FREE 70 -#define ZEND_INIT_ARRAY 71 -#define ZEND_ADD_ARRAY_ELEMENT 72 -#define ZEND_INCLUDE_OR_EVAL 73 -#define ZEND_UNSET_VAR 74 -#define ZEND_UNSET_DIM 75 -#define ZEND_UNSET_OBJ 76 -#define ZEND_FE_RESET 77 -#define ZEND_FE_FETCH 78 -#define ZEND_EXIT 79 -#define ZEND_FETCH_R 80 -#define ZEND_FETCH_DIM_R 81 -#define ZEND_FETCH_OBJ_R 82 -#define ZEND_FETCH_W 83 -#define ZEND_FETCH_DIM_W 84 -#define ZEND_FETCH_OBJ_W 85 -#define ZEND_FETCH_RW 86 -#define ZEND_FETCH_DIM_RW 87 -#define ZEND_FETCH_OBJ_RW 88 -#define ZEND_FETCH_IS 89 -#define ZEND_FETCH_DIM_IS 90 -#define ZEND_FETCH_OBJ_IS 91 -#define ZEND_FETCH_FUNC_ARG 92 -#define ZEND_FETCH_DIM_FUNC_ARG 93 -#define ZEND_FETCH_OBJ_FUNC_ARG 94 -#define ZEND_FETCH_UNSET 95 -#define ZEND_FETCH_DIM_UNSET 96 -#define ZEND_FETCH_OBJ_UNSET 97 -#define ZEND_FETCH_DIM_TMP_VAR 98 -#define ZEND_FETCH_CONSTANT 99 -#define ZEND_EXT_STMT 101 -#define ZEND_EXT_FCALL_BEGIN 102 -#define ZEND_EXT_FCALL_END 103 -#define ZEND_EXT_NOP 104 -#define ZEND_TICKS 105 -#define ZEND_SEND_VAR_NO_REF 106 -#define ZEND_CATCH 107 -#define ZEND_THROW 108 -#define ZEND_FETCH_CLASS 109 -#define ZEND_CLONE 110 -#define ZEND_INIT_METHOD_CALL 112 -#define ZEND_INIT_STATIC_METHOD_CALL 113 -#define ZEND_ISSET_ISEMPTY_VAR 114 -#define ZEND_ISSET_ISEMPTY_DIM_OBJ 115 -#define ZEND_PRE_INC_OBJ 132 -#define ZEND_PRE_DEC_OBJ 133 -#define ZEND_POST_INC_OBJ 134 -#define ZEND_POST_DEC_OBJ 135 -#define ZEND_ASSIGN_OBJ 136 -#define ZEND_INSTANCEOF 138 -#define ZEND_DECLARE_CLASS 139 -#define ZEND_DECLARE_INHERITED_CLASS 140 -#define ZEND_DECLARE_FUNCTION 141 -#define ZEND_RAISE_ABSTRACT_ERROR 142 -#define ZEND_ADD_INTERFACE 144 -#define ZEND_VERIFY_ABSTRACT_CLASS 146 -#define ZEND_ASSIGN_DIM 147 -#define ZEND_ISSET_ISEMPTY_PROP_OBJ 148 -#define ZEND_HANDLE_EXCEPTION 149 -#define ZEND_USER_OPCODE 150 +#define ZEND_NOP 0 +#define ZEND_ADD 1 +#define ZEND_SUB 2 +#define ZEND_MUL 3 +#define ZEND_DIV 4 +#define ZEND_MOD 5 +#define ZEND_SL 6 +#define ZEND_SR 7 +#define ZEND_CONCAT 8 +#define ZEND_BW_OR 9 +#define ZEND_BW_AND 10 +#define ZEND_BW_XOR 11 +#define ZEND_BW_NOT 12 +#define ZEND_BOOL_NOT 13 +#define ZEND_BOOL_XOR 14 +#define ZEND_IS_IDENTICAL 15 +#define ZEND_IS_NOT_IDENTICAL 16 +#define ZEND_IS_EQUAL 17 +#define ZEND_IS_NOT_EQUAL 18 +#define ZEND_IS_SMALLER 19 +#define ZEND_IS_SMALLER_OR_EQUAL 20 +#define ZEND_CAST 21 +#define ZEND_QM_ASSIGN 22 +#define ZEND_ASSIGN_ADD 23 +#define ZEND_ASSIGN_SUB 24 +#define ZEND_ASSIGN_MUL 25 +#define ZEND_ASSIGN_DIV 26 +#define ZEND_ASSIGN_MOD 27 +#define ZEND_ASSIGN_SL 28 +#define ZEND_ASSIGN_SR 29 +#define ZEND_ASSIGN_CONCAT 30 +#define ZEND_ASSIGN_BW_OR 31 +#define ZEND_ASSIGN_BW_AND 32 +#define ZEND_ASSIGN_BW_XOR 33 +#define ZEND_PRE_INC 34 +#define ZEND_PRE_DEC 35 +#define ZEND_POST_INC 36 +#define ZEND_POST_DEC 37 +#define ZEND_ASSIGN 38 +#define ZEND_ASSIGN_REF 39 +#define ZEND_ECHO 40 +#define ZEND_PRINT 41 +#define ZEND_JMP 42 +#define ZEND_JMPZ 43 +#define ZEND_JMPNZ 44 +#define ZEND_JMPZNZ 45 +#define ZEND_JMPZ_EX 46 +#define ZEND_JMPNZ_EX 47 +#define ZEND_CASE 48 +#define ZEND_SWITCH_FREE 49 +#define ZEND_BRK 50 +#define ZEND_CONT 51 +#define ZEND_BOOL 52 +#define ZEND_INIT_STRING 53 +#define ZEND_ADD_CHAR 54 +#define ZEND_ADD_STRING 55 +#define ZEND_ADD_VAR 56 +#define ZEND_BEGIN_SILENCE 57 +#define ZEND_END_SILENCE 58 +#define ZEND_INIT_FCALL_BY_NAME 59 +#define ZEND_DO_FCALL 60 +#define ZEND_DO_FCALL_BY_NAME 61 +#define ZEND_RETURN 62 +#define ZEND_RECV 63 +#define ZEND_RECV_INIT 64 +#define ZEND_SEND_VAL 65 +#define ZEND_SEND_VAR 66 +#define ZEND_SEND_REF 67 +#define ZEND_NEW 68 +#define ZEND_INIT_NS_FCALL_BY_NAME 69 +#define ZEND_FREE 70 +#define ZEND_INIT_ARRAY 71 +#define ZEND_ADD_ARRAY_ELEMENT 72 +#define ZEND_INCLUDE_OR_EVAL 73 +#define ZEND_UNSET_VAR 74 +#define ZEND_UNSET_DIM 75 +#define ZEND_UNSET_OBJ 76 +#define ZEND_FE_RESET 77 +#define ZEND_FE_FETCH 78 +#define ZEND_EXIT 79 +#define ZEND_FETCH_R 80 +#define ZEND_FETCH_DIM_R 81 +#define ZEND_FETCH_OBJ_R 82 +#define ZEND_FETCH_W 83 +#define ZEND_FETCH_DIM_W 84 +#define ZEND_FETCH_OBJ_W 85 +#define ZEND_FETCH_RW 86 +#define ZEND_FETCH_DIM_RW 87 +#define ZEND_FETCH_OBJ_RW 88 +#define ZEND_FETCH_IS 89 +#define ZEND_FETCH_DIM_IS 90 +#define ZEND_FETCH_OBJ_IS 91 +#define ZEND_FETCH_FUNC_ARG 92 +#define ZEND_FETCH_DIM_FUNC_ARG 93 +#define ZEND_FETCH_OBJ_FUNC_ARG 94 +#define ZEND_FETCH_UNSET 95 +#define ZEND_FETCH_DIM_UNSET 96 +#define ZEND_FETCH_OBJ_UNSET 97 +#define ZEND_FETCH_DIM_TMP_VAR 98 +#define ZEND_FETCH_CONSTANT 99 +#define ZEND_GOTO 100 +#define ZEND_EXT_STMT 101 +#define ZEND_EXT_FCALL_BEGIN 102 +#define ZEND_EXT_FCALL_END 103 +#define ZEND_EXT_NOP 104 +#define ZEND_TICKS 105 +#define ZEND_SEND_VAR_NO_REF 106 +#define ZEND_CATCH 107 +#define ZEND_THROW 108 +#define ZEND_FETCH_CLASS 109 +#define ZEND_CLONE 110 +#define ZEND_INIT_METHOD_CALL 112 +#define ZEND_INIT_STATIC_METHOD_CALL 113 +#define ZEND_ISSET_ISEMPTY_VAR 114 +#define ZEND_ISSET_ISEMPTY_DIM_OBJ 115 +#define ZEND_PRE_INC_OBJ 132 +#define ZEND_PRE_DEC_OBJ 133 +#define ZEND_POST_INC_OBJ 134 +#define ZEND_POST_DEC_OBJ 135 +#define ZEND_ASSIGN_OBJ 136 +#define ZEND_INSTANCEOF 138 +#define ZEND_DECLARE_CLASS 139 +#define ZEND_DECLARE_INHERITED_CLASS 140 +#define ZEND_DECLARE_FUNCTION 141 +#define ZEND_RAISE_ABSTRACT_ERROR 142 +#define ZEND_DECLARE_CONST 143 +#define ZEND_ADD_INTERFACE 144 +#define ZEND_DECLARE_INHERITED_CLASS_DELAYED 145 +#define ZEND_VERIFY_ABSTRACT_CLASS 146 +#define ZEND_ASSIGN_DIM 147 +#define ZEND_ISSET_ISEMPTY_PROP_OBJ 148 +#define ZEND_HANDLE_EXCEPTION 149 +#define ZEND_USER_OPCODE 150 +#define ZEND_JMP_SET 152 +#define ZEND_DECLARE_LAMBDA_FUNCTION 153 -- cgit v1.2.3