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