fix: remove dead libxml_set_external_entity_loader guard in Config Dom#40944
Open
lbajsarowicz wants to merge 1 commit into
Open
fix: remove dead libxml_set_external_entity_loader guard in Config Dom#40944lbajsarowicz wants to merge 1 commit into
lbajsarowicz wants to merge 1 commit into
Conversation
Magento 2.4-develop only supports PHP versions where ext-libxml provides libxml_set_external_entity_loader(), so this early return is unreachable. Removing it also prevents schema validation from being silently skipped if the guard were ever taken.
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Contributor
Author
|
@magento run all tests |
Contributor
|
@magento create issue |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Remove the dead
libxml_set_external_entity_loader()availability guard fromMagento\Framework\Config\Dom::validateDomDocument().Problem
The method starts with a guard that is always false:
libxml_set_external_entity_loader()is provided by ext-libxml, which is bundled with PHP and cannot be disabled; the function has existed since PHP 5.4. Since Magento requires PHP 8.3+, this branch is unreachable.Worse, if the branch were ever taken it would return an empty error list — silently skipping XSD schema validation entirely and reporting the document as valid.
Solution
Remove the dead guard. Behavior on every supported PHP version is unchanged.
Files Changed
lib/internal/Magento/Framework/Config/Dom.phpRelated Pull Requests
Same cleanup pattern as #40686, #40687, #40688.
Manual testing scenarios (*)
lib/internal/Magento/Framework/Config/Test/Unit/DomTest.php— all validation tests pass.Magento/Framework/Configintegration suite — schema validation behaves as before.Contribution checklist (*)
Resolved issues: