xref: /PHP-8.3/ext/tokenizer/tests/bug76437.phpt (revision 74859783)
1--TEST--
2Bug #76437 (token_get_all with TOKEN_PARSE flag fails to recognise close tag)
3--EXTENSIONS--
4tokenizer
5--FILE--
6<?php
7$tests = [
8    ['<?=$a?>', 0],
9    ['<?php echo 2; ?>', 6],
10    ["<?php echo 2; ?>\n", 6],
11];
12foreach ($tests as [$code, $index]) {
13    $open_tag1 = token_get_all($code)[$index];
14    $open_tag2 = token_get_all($code, TOKEN_PARSE)[$index];
15    echo token_name($open_tag1[0]), ": \"$open_tag1[1]\" on line $open_tag1[2]\n";
16    var_dump($open_tag1 === $open_tag2);
17}
18?>
19--EXPECT--
20T_OPEN_TAG_WITH_ECHO: "<?=" on line 1
21bool(true)
22T_CLOSE_TAG: "?>" on line 1
23bool(true)
24T_CLOSE_TAG: "?>
25" on line 1
26bool(true)
27