xref: /PHP-5.3/ext/tokenizer/tests/bug54089.phpt (revision 5d83ad8c)
1--TEST--
2Bug #54089 (token_get_all() does not stop after __halt_compiler)
3--SKIPIF--
4<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
5--FILE--
6<?php
7$code = "<?php __halt_compiler();\x01?>\x02";
8$tokens = token_get_all($code);
9
10var_dump($tokens);
11
12$code = '';
13foreach ($tokens as $t)
14{
15	$code .= isset($t[1]) ? $t[1] : $t;
16}
17var_dump($code);
18?>
19--EXPECTF--
20array(2) {
21  [0]=>
22  array(3) {
23    [0]=>
24    int(%d)
25    [1]=>
26    string(6) "<?php "
27    [2]=>
28    int(1)
29  }
30  [1]=>
31  array(3) {
32    [0]=>
33    int(%d)
34    [1]=>
35    string(15) "__halt_compiler"
36    [2]=>
37    int(1)
38  }
39}
40string(21) "<?php __halt_compiler"
41