You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Config file schemas fail to load under certain scenarios. Below is a sample critical error:
[2014-06-30 06:24:39] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Validator\Exception\MappingException: "[WARNING 1549] failed to load external entity "/var/www/html/.../vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd" (in n/a - line 0, column 0) [ERROR 1757] Failed to locate the main schema resource at '/var/www/html/.../vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd'. (in n/a - line 0, column 0)" at /var/www/html/.../vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php line 195 {"exception":"[object] (Symfony\\Component\\Validator\\Exception\\MappingException: [WARNING 1549] failed to load external entity \"/var/www/html/.../vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd\" (in n/a - line 0, column 0)\n[ERROR 1757] Failed to locate the main schema resource at '/var/www/html/.../vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd'. (in n/a - line 0, column 0) at /var/www/html/.../vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php:195, InvalidArgumentException: [WARNING 1549] failed to load external entity \"/var/www/html/.../vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd\" (in n/a - line 0, column 0)\n[ERROR 1757] Failed to locate the main schema resource at '/var/www/html/.../vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd'. (in n/a - line 0, column 0) at /var/www/html/...
These are two scenarios that will cause this to happen:
libxml_disable_entity_loader is explicitly set to true.
libxml_disable_entity_loader is expected to be false, but it is set to true due to libxml_disable_entity_loader not being thread safe (see php bug https://bugs.php.net/bug.php?id=64938 ).
libxml_disable_entity_loader prevents libxml from loading even local files. It seems like the most reasonable approach is to read the file contents and load the source, as opposed to the xml packages attempting to load the files themselves.
…sable_entity_loader usage (ccorliss)
This PR was submitted for the 2.4 branch but it was merged into the 2.3 branch instead (closes#11259).
Discussion
----------
[Config] Fixed failed config schema loads due to libxml_disable_entity_loader usage
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #11258
| License | MIT
| Doc PR | N/A
PR #10493 helped this issue, but it can still affect users that:
1. Have libxml_disable_entity_loader set to true by default.
2. Experience libxml_disable_entity_loader php bug https://bugs.php.net/bug.php?id=64938
I used the same approach used in the DI xml validation.
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php#L452
Commits
-------
de2bef5 Fixed failed config schema loads due to libxml_disable_entity_loader usage.
Config file schemas fail to load under certain scenarios. Below is a sample critical error:
These are two scenarios that will cause this to happen:
libxml_disable_entity_loader prevents libxml from loading even local files. It seems like the most reasonable approach is to read the file contents and load the source, as opposed to the xml packages attempting to load the files themselves.
This also seems to be the standard approach elsewhere:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php#L452
This thread has more details on the issue #10493
I'll work on a PR.
The text was updated successfully, but these errors were encountered: