mirror of
https://github.com/php/php-src.git
synced 2026-03-26 01:02:25 +01:00
Currently, unexpected tokens in the parser are shown as the text found, plus the internal token name, including the notorious "unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)". This commit replaces that with a more user-friendly format, with two main types of token: * Tokens which always represent the same text are shown like 'unexpected token "::"' and 'expected "::"' * Tokens which have variable text are given a user-friendly name, and show like 'unexpected identifier "foo"', and 'expected identifer'. A few tokens have special cases: * unexpected token """ -> unexpected double-quote mark * unexpected quoted string "'foo'" -> unexpected single-quoted string "foo" * unexpected quoted string ""foo"" -> unexpected double-quoted string "foo" * unexpected illegal character "_" -> unexpected character 0xNN (where _ is almost certainly a control character, and NN is the hexadecimal value of the byte) The \ token has a special case in the implementation just to stop bison making a mess of escaping it and it coming out as \\
18 lines
422 B
PHP
18 lines
422 B
PHP
--TEST--
|
|
Bug #74454 (Wrong exception being thrown when using ReflectionMethod)
|
|
--FILE--
|
|
<?php
|
|
spl_autoload_register('load_file');
|
|
try {
|
|
$x = new ReflectionMethod('A', 'b');
|
|
} catch (\Throwable $e) {
|
|
echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
function load_file() {
|
|
require __DIR__ . '/bug74454.inc';
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
ParseError: syntax error, unexpected token "if", expecting "function" or "const"
|