summaryrefslogtreecommitdiff
path: root/ext/tokenizer/tests/bug54089.phpt
blob: e1f6d79e9c03909c1b22191170ade71248928a4e (plain)
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
--TEST--
Bug #54089 (token_get_all() does not stop after __halt_compiler)
--SKIPIF--
<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
--FILE--
<?php
$code = "<?php __halt_compiler();\x01?>\x02";
$tokens = token_get_all($code);

var_dump($tokens);

$code = '';
foreach ($tokens as $t)
{
	$code .= isset($t[1]) ? $t[1] : $t;
}
var_dump($code);
?>
--EXPECTF--
array(2) {
  [0]=>
  array(3) {
    [0]=>
    int(%d)
    [1]=>
    string(6) "<?php "
    [2]=>
    int(1)
  }
  [1]=>
  array(3) {
    [0]=>
    int(%d)
    [1]=>
    string(15) "__halt_compiler"
    [2]=>
    int(1)
  }
}
string(21) "<?php __halt_compiler"