Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection][Translator] Silent deprecation triggered by libxml_disable_entity_loader#39068
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
stof commentedNov 12, 2020
could we suffer from issues on PHP 8 due to other libraries changing such global state too ? Or is PHP 8 turning that into a no-op ? |
jderusse commentedNov 12, 2020
@stof I don't think so, we will suffer from the same issue. a solution could be to implement a method by our self that check the status of the entity loader and use this instead of checking the version. |
derrabus commentedNov 12, 2020
Yes, this change only buys us some time. The main problem is that php 8 triggers a seprecation without offering us an alternative.
As far as I understood it, the functionality is the same. @jderusse The PR title tells quite the opposite of what this PR is doing. 😉 |
stof commentedNov 12, 2020
Then this should be reported to PHPbefore the release of PHP 8. Deprecating an API without an alternative is not OK. |
jderusse commentedNov 12, 2020
This is deprecated, because nobody should call it in PHP >= 8. |
stof commentedNov 12, 2020
That's precisely the issue. As it is deprecated without being a no-op, it still affects the global state for everyone. And so shared libraries (which cannot know what else is running in the project) cannot assume the global state and so are forced to keep calling the deprecated API. And that makes the deprecation warning an issue. |
Uh oh!
There was an error while loading.Please reload this page.
jderusse commentedNov 12, 2020
Bug openedhttps://bugs.php.net/bug.php?id=80357 |
derrabus left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm okay with the change because it fixes the regression for now. We can iterate further when we have feedback from PHP.
derrabus commentedNov 12, 2020
Thank you. 😃 |
0fd32cc to137e31fComparejderusse commentedNov 12, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I changed the patch to
Disabling entity loaded is not needed sin libXml 2.9 (this is the reason on the deprecation in PHP 8 by the way).
Because the method is deprecated in 8.0 and we are still calling it with |
derrabus commentedNov 12, 2020
So, it's silencing now according to the feedback we've received? Well okay, let's silence the error then. |
src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
jderusse commentedNov 19, 2020
I don't know if PHP 8 will fix the issue, I the meantime, I suggest this patch that check if the entity loader is disabled by trying to validate a wellknown document |
fabpot commentedNov 27, 2020
PHP won't fix the issue as PHP 8 is now released. Let's merge this one then. |
…xml_disable_entity_loader
fabpot commentedNov 27, 2020
Thank you@jderusse. |
JarJak commentedDec 11, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There may be more places that require a fix, i.e. |
jderusse commentedDec 11, 2020
These 2 lines are about disabling the This PR is about enabling the |
Uh oh!
There was an error while loading.Please reload this page.
The XML entity loader is disabled by default since libxml 2.9
But, since PHP 8.0, calling the method
libxml_disable_entity_loadertriggers a deprecation which has been solved in symfony by callinglibxml_disable_entity_loaderonly for libxml < 2.9The issue is, some dependencies, enable the entity loader and does not restore the initial state afterward, leading to exceptions triggered by Symfony iteself.
In previous versions symfony was resilient by disabling the flag before working, which is not the case anymore to avoid the deprecation.
This PR restore the resiliency of Symfony for PHP < 8.0, which is not yet deprecated.
But we have no way to check the status of the entity loader without triggering a deprecation with Symfony 8.