- Issue created by @itaran
- Status changed to Postponed: needs info
almost 2 years ago 10:57pm 19 March 2023 - π¦πΉAustria drunken monkey Vienna, Austria
Thanks for reporting this issue!
Can you reliably reproduce this error message? If so, could you try to debug what is going on in thatprocessFieldValue()
method? Specifically, are there any other warnings/errors?
From looking at the code, it seems the only way for$text
to beNULL
at that point is for the previouspreg_replace()
call to fail with an error.We might still want to guard against such errors, but first it would be good to know if there are other problems in that code.
- Status changed to Active
over 1 year ago 10:31am 10 May 2023 I have just updated search_api from 8.x-1.25 => 8.x-1.29 and ran into this problem when I tried to rebuild the index.
One of the problem pages has an image pasted directly into the text, so the html is:
<p><img alt="" src="image/png;base64,iVBORw0 - LONG HEX STRING FOLLOWS
It has the alt="" which matches the original description of the problem.
I've attached a copy of the contents of $value that was passed into function processFieldValue()
- Status changed to Needs review
over 1 year ago 7:02pm 12 May 2023 - last update
over 1 year ago 498 pass, 5 fail - last update
over 1 year ago 535 pass - π¦πΉAustria drunken monkey Vienna, Austria
Thanks a lot for this additional information, that enabled me to reproduce the problem.
Well, using regular expressions there was the lazy way out, but I guess that fails when the backtracking gets too much. So, attached is a reimplementation using just normalmb_strpos()
calls and one very straight-forward regular expression that only uses possessive quantifiers.Please test/review!
The last submitted patch, 4: 3347610-4--fix_html_filter_for_overlong_attributes--tests_only.patch, failed testing. View results β
I can confirm that the deprecation error no longer appears after applying the patch, and `$value` ends up the same. I'll hold off on RTBC for now because I have not reviewed patch contents.
-
drunken monkey β
committed 542e798b on 8.x-1.x
Issue #3347610 by drunken monkey, itaran: Fixed error in HTML filter...
-
drunken monkey β
committed 542e798b on 8.x-1.x
- Status changed to Fixed
over 1 year ago 9:06am 3 June 2023 - π¦πΉAustria drunken monkey Vienna, Austria
If it works for you, thatβs already good to know, thanks. Since there is automated test coverage, I think thatβs already enough.
Merged. Thanks again! Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
about 1 year ago 6:50pm 3 November 2023 - π«π·France Chris64 France
Some things not clear.
but I guess that fails when the backtracking gets too much.
Is it the real problem or juste an idea?
Soalt=""
produces this error? And why? Since parameter #3 ($subject) is the reterned value of preg_replace, null if an error occurred.
And what is such an error? What is the connection?""
makes a problem since matching no expression in,
$text = preg_replace('/<[-a-z_]+[^>]*["\s]alt\s*=\s*("([^"]+)"|\'([^\']+)\')[^>]*>/i', ' <img>$2$3</img> ', $text);
Look not nice. To get an alternative expression in the same idea, and to match""
or''
,
$text = preg_replace('/<[-a-z_]+[^>]*["\s]alt\s*=\s*(?|"([^"]*)"|\'([^\']*)\')[^>]*>/i', ' <img>$1</img> ', $text);
In the same spirit instead of,
$text = preg_replace('/(<[-a-z_]+[^>]*["\s])title\s*=\s*("([^"]+)"|\'([^\']+)\')([^>]*>)/i', '$1 $5 $3$4 ', $text);
rather,
$text = preg_replace('/(<[-a-z_]+[^>]*["\s])title\s*=\s*(?|"([^"]*)"|\'([^\']*)\')([^>]+>)/i', '$1 $3 $2 ', $text);