Warning: DOMXPath::query(): Recursion limit exceeded #39273
Labels
Issue: needs update
Additional information is require, waiting for response
Reported on 2.4.7-p3
Indicates original Magento version for the Issue report.
Preconditions and environment
Magento 2.4.5-p10
Steps to reproduce
Import a large number of products, e.g. 2000 products
Expected result
Import succeds without warnings
Actual result
Exception: Warning: DOMXPath::query(): Recursion limit exceeded in vendor/magento/framework/Validator/HTML/ConfigurableWYSIWYGValidator.php on line 125
Additional information
Magento\Framework\Validator\HTML\ConfigurableWYSIWYGValidator
method validateConfigured(\DOMXPath $xpath) is changed as:
//Validating tags
$this->allowedTags = array_merge($this->allowedTags, ["body", "html"]);
$found = $xpath->query(
'//*['
. implode(
' and ',
array_map(
function (string $tag): string {
return "name() != '$tag'";
},
$this->allowedTags
)
)
.']'
);
$this->allowedTags is charged with two items "body" and "html" every time validateConfigured is called, so in the end xpath recursion limit is exceeded and such warning appears.
Maybe such bug is not triggered in test because recursion limit is quite high.
It is MANDATORY to revert method to the previous version:
//Validating tags
$this->allowedTags = array_merge($this->allowedTags, ["body", "html"]);
$found = $xpath->query(
'//*['
. implode(
' and ',
array_map(
function (string $tag): string {
return "name() != '$tag'";
},
$this->allowedTags
)
)
.']'
);
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: