xref: /php-src/ext/tokenizer/tests/bug60097.phpt (revision 74859783)
1--TEST--
2Bug 60097: token_get_all fails to lex nested heredoc
3--EXTENSIONS--
4tokenizer
5--FILE--
6<?php
7
8var_dump(token_get_all('<?php
9<<<DOC1
10{$s(<<<DOC2
11DOC2
12)}
13DOC1;
14'));
15
16?>
17--EXPECTF--
18array(14) {
19  [0]=>
20  array(3) {
21    [0]=>
22    int(%d)
23    [1]=>
24    string(6) "<?php
25"
26    [2]=>
27    int(1)
28  }
29  [1]=>
30  array(3) {
31    [0]=>
32    int(%d)
33    [1]=>
34    string(8) "<<<DOC1
35"
36    [2]=>
37    int(2)
38  }
39  [2]=>
40  array(3) {
41    [0]=>
42    int(%d)
43    [1]=>
44    string(1) "{"
45    [2]=>
46    int(3)
47  }
48  [3]=>
49  array(3) {
50    [0]=>
51    int(%d)
52    [1]=>
53    string(2) "$s"
54    [2]=>
55    int(3)
56  }
57  [4]=>
58  string(1) "("
59  [5]=>
60  array(3) {
61    [0]=>
62    int(%d)
63    [1]=>
64    string(8) "<<<DOC2
65"
66    [2]=>
67    int(3)
68  }
69  [6]=>
70  array(3) {
71    [0]=>
72    int(%d)
73    [1]=>
74    string(4) "DOC2"
75    [2]=>
76    int(4)
77  }
78  [7]=>
79  array(3) {
80    [0]=>
81    int(%d)
82    [1]=>
83    string(1) "
84"
85    [2]=>
86    int(4)
87  }
88  [8]=>
89  string(1) ")"
90  [9]=>
91  string(1) "}"
92  [10]=>
93  array(3) {
94    [0]=>
95    int(%d)
96    [1]=>
97    string(1) "
98"
99    [2]=>
100    int(5)
101  }
102  [11]=>
103  array(3) {
104    [0]=>
105    int(%d)
106    [1]=>
107    string(4) "DOC1"
108    [2]=>
109    int(6)
110  }
111  [12]=>
112  string(1) ";"
113  [13]=>
114  array(3) {
115    [0]=>
116    int(%d)
117    [1]=>
118    string(1) "
119"
120    [2]=>
121    int(6)
122  }
123}
124