magento2
magento2 copied to clipboard
Warning: DOMXPath::query(): Recursion limit exceeded
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
- [X] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.