1--TEST--
2Parse exceptions when using require
3--INI--
4allow_url_include=1
5--FILE--
6<?php
7
8function test_parse_error($code) {
9    try {
10        require 'data://text/plain;base64,' . base64_encode($code);
11    } catch (ParseError $e) {
12        echo $e->getMessage(), " on line ", $e->getLine(), "\n";
13    }
14}
15
16test_parse_error(<<<'EOC'
17<?php
18{ { { { { }
19EOC
20);
21
22test_parse_error(<<<'EOC'
23<?php
24/** doc comment */
25function f() {
26EOC
27);
28
29test_parse_error(<<<'EOC'
30<?php
31empty
32EOC
33);
34
35test_parse_error('<?php
36var_dump(078);');
37
38test_parse_error('<?php
39var_dump("\u{xyz}");');
40test_parse_error('<?php
41var_dump("\u{ffffff}");');
42
43?>
44--EXPECT--
45syntax error, unexpected end of file on line 2
46syntax error, unexpected end of file on line 3
47syntax error, unexpected end of file, expecting '(' on line 2
48Invalid numeric literal on line 2
49Invalid UTF-8 codepoint escape sequence on line 2
50Invalid UTF-8 codepoint escape sequence: Codepoint too large on line 2
51