[wp-trac] [WordPress Trac] #51019: convert_smilies() fails on large tags
WordPress Trac
noreply at wordpress.org
Tue Jun 25 22:51:50 UTC 2024
#51019: convert_smilies() fails on large tags
-------------------------------------------------+-------------------------
Reporter: podpirate | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.7
Component: Formatting | Version: 5.5
Severity: normal | Resolution:
Keywords: has-patch php80 has-unit-tests has- | Focuses:
testing-info needs-testing |
-------------------------------------------------+-------------------------
Comment (by dmsnell):
The patch I just posted should solve this through use of the HTML API
instead of regexes to parse the HTML. It should have the added benefit of
being able to reliable parse any given HTML. The only remaining quirk is
that the way we track CODE and PRE elements is prone to error if they
aren't properly balanced, but this is probably fine, and the consequences
are merely that smilies won't get converted in such a failure case - it
won't crash the site.
Might be an interesting test for the 6.7 cycle since we now have a long
time to test it.
One change present in this updated version is that text nodes containing
smilies _and other HTML character references_ will be modified such that
other character references are decoded as well. This is because the HTML
API only exposes decoded strings so that Core doesn't have to try and do
all string replacement logic multiple times (as evidenced in this existing
code where it checks for the UTF-8 encoded non-breaking space //and// for
` ` - this approach is guaranteed to corrupt data)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51019#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list