Fixes wrong replacements when having multibyte characters in tag attr… #50
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.
…ibute values
I had a closer look to the problem with the "infinite loop" (which means that at the end you are running into the maximum execution time error) mentioned in joomla/joomla-cms#34967.
The problem is, that
escapeAttributeValues()
does not handle multibyte characters correctly. It makes wrong replacements in the tag attribute values which leads to the "infinite loop" in the further processing after the function has been applied.One can reproduce the wrong replacement by doing the following changes to a fresch installation of Joomla 4.0.0
protected function escapeAttributeValues($source)
in /libraries/vendor/joomla/filter/src/InputFilter.php from protected to public.... online!" "ame=
.The problem is, that
$matches[0][1]
counts in bytes and$attributeValue = StringHelper::substr($remainder, $nextBefore, $nextAfter - $nextBefore);
counts in multibyte characters.After applying the patch there is no wrong replacement any more.