xref: /PHP-7.4/ext/tokenizer/tests/bug26463.phpt (revision 8591b20d)
1--TEST--
2Bug #26463 (token_get_all() does not correctly handle semicolons after T_END_HEREDOC)
3--SKIPIF--
4<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
5--FILE--
6<?php
7$str = '<?php
8$x=<<<DD
9jhdsjkfhjdsh
10DD
11."";
12$a=<<<DDDD
13jhdsjkfhjdsh
14DDDD;
15?>';
16var_dump(token_get_all($str));
17?>
18--EXPECTF--
19array(19) {
20  [0]=>
21  array(3) {
22    [0]=>
23    int(%d)
24    [1]=>
25    string(6) "<?php
26"
27    [2]=>
28    int(1)
29  }
30  [1]=>
31  array(3) {
32    [0]=>
33    int(%d)
34    [1]=>
35    string(2) "$x"
36    [2]=>
37    int(2)
38  }
39  [2]=>
40  string(1) "="
41  [3]=>
42  array(3) {
43    [0]=>
44    int(%d)
45    [1]=>
46    string(6) "<<<DD
47"
48    [2]=>
49    int(2)
50  }
51  [4]=>
52  array(3) {
53    [0]=>
54    int(%d)
55    [1]=>
56    string(13) "jhdsjkfhjdsh
57"
58    [2]=>
59    int(3)
60  }
61  [5]=>
62  array(3) {
63    [0]=>
64    int(%d)
65    [1]=>
66    string(2) "DD"
67    [2]=>
68    int(4)
69  }
70  [6]=>
71  array(3) {
72    [0]=>
73    int(%d)
74    [1]=>
75    string(1) "
76"
77    [2]=>
78    int(4)
79  }
80  [7]=>
81  string(1) "."
82  [8]=>
83  array(3) {
84    [0]=>
85    int(%d)
86    [1]=>
87    string(2) """"
88    [2]=>
89    int(5)
90  }
91  [9]=>
92  string(1) ";"
93  [10]=>
94  array(3) {
95    [0]=>
96    int(%d)
97    [1]=>
98    string(1) "
99"
100    [2]=>
101    int(5)
102  }
103  [11]=>
104  array(3) {
105    [0]=>
106    int(%d)
107    [1]=>
108    string(2) "$a"
109    [2]=>
110    int(6)
111  }
112  [12]=>
113  string(1) "="
114  [13]=>
115  array(3) {
116    [0]=>
117    int(%d)
118    [1]=>
119    string(8) "<<<DDDD
120"
121    [2]=>
122    int(6)
123  }
124  [14]=>
125  array(3) {
126    [0]=>
127    int(%d)
128    [1]=>
129    string(13) "jhdsjkfhjdsh
130"
131    [2]=>
132    int(7)
133  }
134  [15]=>
135  array(3) {
136    [0]=>
137    int(%d)
138    [1]=>
139    string(4) "DDDD"
140    [2]=>
141    int(8)
142  }
143  [16]=>
144  string(1) ";"
145  [17]=>
146  array(3) {
147    [0]=>
148    int(%d)
149    [1]=>
150    string(1) "
151"
152    [2]=>
153    int(8)
154  }
155  [18]=>
156  array(3) {
157    [0]=>
158    int(%d)
159    [1]=>
160    string(2) "?>"
161    [2]=>
162    int(9)
163  }
164}
165