Skip to content

Commit 272b4b6

Browse files
committed
Add test showing current behaviour
1 parent 089b020 commit 272b4b6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

ext/tokenizer/tests/bug19507.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Bug #19507: Recursive tokenization during `token_get_all` result on error
3+
--EXTENSIONS--
4+
tokenizer
5+
--FILE--
6+
<?php
7+
8+
set_error_handler(function (int $errno, string $msg) {
9+
eval('123 + 2;');
10+
echo 'error handler called: ', $msg, "\n";
11+
});
12+
13+
14+
$tokens = PhpToken::tokenize('<?php (double) $x;', TOKEN_PARSE);
15+
foreach ($tokens as $token) {
16+
echo $token->getTokenName(), "\n";
17+
}
18+
19+
--EXPECT--
20+
error handler called: Non-canonical cast (double) is deprecated, use the (float) cast instead
21+
T_OPEN_TAG
22+
T_LNUMBER
23+
;
24+
T_DOUBLE_CAST
25+
T_WHITESPACE
26+
T_VARIABLE
27+
;

0 commit comments

Comments
 (0)