-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Symfony 2.3 branch is *not* fully compatible with PHP 7. #18269
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
Comments
http://php.net/manual/en/language.errors.php7.php I think it's 100% compatible, it just shouldn't catch the Errors here and delegate them most likely. All cases will work until you trigger something that would be an Error (Throwable) in php 7 but not in 5.* |
See the stack dump I included. When an Error type is thrown, ExceptionHandler is called and parameterized with the Error. This causes an Exception to be thrown there, which completely obiliterates any contextual information about the original Error (e.g., Stack Trace). Which makes any Errors thrown in PHP 7 nearly impossible to debug. Exception handling in 2.3 has no provisions for handling the new Error type in PHP 7. Therefore, it would not be 100% compatible with PHP 7, as features are lost when switching to PHP 7. The weird part is that, as far as I can tell, explicit handling for this exact scenario was implemented in the 2.6 branch, but was never back-ported to 2.3. But 2.3 is still in LTS, so the claim that all supported branches are fully compatible is false. It looks like someone just overlooked merging the changes into 2.3. |
@kalzekdor would you mind opening a PR against 2.3? |
@nicolas-grekas Sorry, I'm not too familiar with GitHub, so I'm not sure what you're asking for. Here is a commit to the 2.6 branch that appears to address the issue, but as far as I can tell it was never applied to the 2.3 branch. |
@kalzekdor @nicolas-grekas wanted to ask you if wou wanted to correct this issue by forking and working on that issue ;). |
Please check #18336 |
This PR was merged into the 2.3 branch. Discussion ---------- [Debug] Fix handling of php7 throwables | Q | A | ------------- | --- | Branch? | 2.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18269 | License | MIT | Doc PR | - Should not be merged into 2.7 because 2.7 already has the required logic. Commits ------- b032096 [Debug] Fix handling of php7 throwables
Great! Thanks @nicolas-grekas for the quick turn-around. |
Hello. It still doesn't work if I register only ExceptionHandler. Like |
@masterjus 2.3 is not maintained anymore though |
ExceptionHandler needs to be used in conjunction with ErrorHandler, you should not (and cannot on PHP7) use it standalone. |
Symfony v2.4.10 also have problem with this bug. |
Symfony 2.4 is not maintained anymore. You need to update to Symfony 2.7, 2.8, 3.2 or higher. |
Yes. Thank you. |
As of today 3.2 is not maintained anymore as well. |
I am having this issue on 2.7 using PHP 7.0.29 (cli) |
You are aware 2.7 is going out of active support in 3 weeks? You should urgently upgrade to 2.8 and then 3.4. |
In any case, comments on closed issues are likely to get lost. Please open a new one with some steps on how to reproduce it. |
If you're still running something on Symfony 2.3 (I won't judge), this may cause you headaches. It seems the code in #18336 is just an incomplete hack. When an E_NOTICE or anything else passes through the ErrorHandler, it's supposed to call the ExceptionHandler, which in turn serves the user with this: The ErrorHandler does that by retrieving the ExceptionHandler first and then checking the below before finally calling the ExceptionHandler: if (is_array($exceptionHandler) && $exceptionHandler[0] instanceof ExceptionHandler) {
} Obviously, since the code in the referenced PR adds a closure as handler, this check evaluates to false. Therefore, no E_NOTICE, E_WARNING etc will ever be translated to an HTML page about the PHP error anymore. |
There was a blog post on August 11th claiming that all maintained Symfony branches were 100% compatible with PHP 7. At the time, (and as of right now), 2.3 is a maintained branch.
However, if you view the code under the Debug section, you'll see that there is no support for the new Error type. Function typing should be using \Throwable, but instead are still using \Exception.
Which leads to errors like:
So... is 2.3 fully compatible with PHP 7 or not?
The text was updated successfully, but these errors were encountered: