summaryrefslogtreecommitdiff
path: root/ext/tokenizer/tests/parse_errors.phpt
blob: bfa6e07ac4b34e030d695b5d2e08743367165b70 (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
--TEST--
Parse errors during token_get_all()
--SKIPIF--
<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
--FILE--
<?php

function test_parse_error($code) {
    try {
        var_dump(token_get_all($code));
    } catch (ParseError $e) {
        echo $e->getMessage(), "\n";
    }
}

test_parse_error('<?php var_dump(078);');
test_parse_error('<?php var_dump("\u{xyz}");');
test_parse_error('<?php var_dump("\u{ffffff}");');
test_parse_error('<?php var_dump(078 + 078);');

?>
--EXPECT--
Invalid numeric literal
Invalid UTF-8 codepoint escape sequence
Invalid UTF-8 codepoint escape sequence: Codepoint too large
Invalid numeric literal