Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncatchable fatal error: Multiple final modifiers are not allowed (emitted by parse_code()) #78

Closed
TysonAndre opened this issue Sep 17, 2017 · 5 comments

Comments

@TysonAndre
Copy link
Collaborator

TysonAndre commented Sep 17, 2017

php > try { $x = ast\parse_code('<?php class C { final final function foo($fff) {}}', 50); } catch (\Throwable $e) {print("Caught exception\n"); echo $e; }

Fatal error: Multiple final modifiers are not allowed in string code on line 1

This was observed in php 7.1.

Is there any way to make this into a catchable \Error?
The fact that it's uncatchable may affect some applications

(Noticed when running this extension on the test phpt files in php-src)

@TysonAndre
Copy link
Collaborator Author

Similar issues noticed:

halt03.php (__HALT_COMPILER must be in top level)
errmsg_010.php
declare_003.php declare_002.php Fatal error: Encoding must be a literal

@nikic
Copy link
Owner

nikic commented Sep 17, 2017

Yeah, we should either change these into exceptions or, if possible, try to generate them during compilation. This will require some larger upstream changes though, so in the best case only for 7.2.

@TysonAndre
Copy link
Collaborator Author

Filed https://bugs.php.net/bug.php?id=75218 to track this (Didn't see anything similar in php.net when I checked)

@nikic
Copy link
Owner

nikic commented Sep 24, 2017

I'm closing this in favor of the upstream report.

@nikic nikic closed this as completed Sep 24, 2017
nikic added a commit that referenced this issue Oct 6, 2018
This has been fixed upstream.
@nikic
Copy link
Owner

nikic commented Oct 6, 2018

This has been fixed in PHP and I've added a test to verify the fix for php-ast in 60acf78.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants