Fixes xsd schema to work with libxml 2.12 and higher. #38553
Closed
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 (*)
The latest libxml2 library (2.12.*) contains more strict requirements for xsd schema files:
There is one xsd file in Magento which now fails these more stricter checks:
app/code/Magento/Elasticsearch/etc/esconfig.xsd
When using any Magento version with libxml2 version 2.12.* in developer mode, whenever an xml file with
esconfig.xsd
schema is being loaded, it will now fail with this error:This PR fixes this. It should be mostly backwards compatible. With the exception that it now always expect the
type
element to be in front of thedefault
element in thestemmer
section, but that matches how Magento's xml files are already setup:This PR fixes an additional problem - by splitting out the types for
stemmer
andstopwords_file
. Previously, there was no requirement ontype
element, even though the code that parses this xml file requires thetype
to exist. That's been fixed by no longer usingmixedDataType
for bothstemmer
andstopwords_file
elements, but splitting it out in 2 distinct types where the one forstemmer
now requires atype
element to exist.I've tested these changes with libxml2 versions 2.9.14 and 2.12.6 and both work correctly.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
test-xsd.php
file in the root of the magento project with this contents:php test-xsd.php
, expected is to see no errorsphp test-xsd.php
, expected is to see no errorsAlternative steps:
bin/magento indexer:reindex catalogsearch_fulltext
, expect to get no errorsQuestions or comments
I haven't found time or energy to add/update unit tests, if this is required, it would be appreciated if somebody could lend a hand.
Contribution checklist (*)