summaryrefslogtreecommitdiff
path: root/ext/tokenizer/tests/bug76437.phpt
blob: 348c9bdc0053233ffa0e1ec9b02979f18eb3292d (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
41
42
43
44
45
46
47
--TEST--
Bug #76437 (token_get_all with TOKEN_PARSE flag fails to recognise close tag)
--SKIPIF--
<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
--FILE--
<?php
$tests = [
    ['<?=$a?>', 0],
    ['<?php echo 2; ?>', 6],
    ["<?php echo 2; ?>\n", 6],
];
foreach ($tests as [$code, $index]) {
    $open_tag1 = token_get_all($code)[$index];
    $open_tag2 = token_get_all($code, TOKEN_PARSE)[$index];
    var_dump($open_tag1);
    var_dump($open_tag1 === $open_tag2);
}
?>
--EXPECT--
array(3) {
  [0]=>
  int(380)
  [1]=>
  string(3) "<?="
  [2]=>
  int(1)
}
bool(true)
array(3) {
  [0]=>
  int(381)
  [1]=>
  string(2) "?>"
  [2]=>
  int(1)
}
bool(true)
array(3) {
  [0]=>
  int(381)
  [1]=>
  string(3) "?>
"
  [2]=>
  int(1)
}
bool(true)