-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 ? |
@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. |
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. 😉 |
Then this should be reported to PHP before the release of PHP 8. Deprecating an API without an alternative is not OK. |
This is deprecated, because nobody should call it in PHP >= 8. |
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. |
Bug opened https://bugs.php.net/bug.php?id=80357 |
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.
Thank you. 😃 |
0fd32cc
to
137e31f
Compare
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 |
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
Outdated
Show resolved
Hide resolved
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 |
PHP won't fix the issue as PHP 8 is now released. Let's merge this one then. |
…xml_disable_entity_loader
Thank you @jderusse. |
There may be more places that require a fix, i.e. |
These 2 lines are about disabling the This PR is about enabling the |
The XML entity loader is disabled by default since libxml 2.9
But, since PHP 8.0, calling the method
libxml_disable_entity_loader
triggers a deprecation which has been solved in symfony by callinglibxml_disable_entity_loader
only 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.