Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I've introduced a new CompileError type, from which ParseError inherits. These errors are not parse errors in the narrow sense of the term, even though they happen to be generated during parsing in our implementation. Additionally reusing the ParseError class for this purpose would change existing error messages (if the exception is not caught) from a "Fatal error:" to a "Parse error:" prefix, and also the error kind from E_COMPILE_ERROR to E_PARSE.
- Loading branch information
Showing
8 changed files
with
79 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--TEST-- | ||
Bug #75218: Change remaining uncatchable fatal errors for parsing into ParseError | ||
--FILE-- | ||
<?php | ||
|
||
function try_eval($code) { | ||
try { | ||
eval($code); | ||
} catch (CompileError $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
} | ||
|
||
try_eval('if (false) {class C { final final function foo($fff) {}}}'); | ||
try_eval('if (false) {class C { private protected $x; }}'); | ||
try_eval('if (true) { __HALT_COMPILER(); }'); | ||
try_eval('declare(encoding=[]);'); | ||
|
||
?> | ||
--EXPECT-- | ||
Multiple final modifiers are not allowed | ||
Multiple access type modifiers are not allowed | ||
__HALT_COMPILER() can only be used from the outermost scope | ||
Encoding must be a literal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters