Make WordPress Core

Opened 7 years ago

Closed 4 months ago

Last modified 4 months ago

#47470 closed defect (bug) (worksforme)

XML parsing error: undefined entity (revisited)

Reported by: RavanH Owned by:
Priority: normal Milestone:
Component: Feeds Version: 5.2.1
Severity: normal Keywords:
Cc: Focuses:

Description

After 10 years, bug #8464 seems to be back in 5.2.1
On a completely fresh install (no plugins, default theme) I added a tag with a ' (single quote) in the title. This converts to ’ in the feed title. This in turn, generates

This feed does not validate.

line 11, column 9: XML parsing error: <unknown>:11:9: undefined entity

for the tag's feed on ​https://validator.w3.org/feed/

See ​https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2F2607.fr%2Ftag%2Flapostrophe%2Ffeed%2F for example

Attachments (1)

ticket-47470-proof.png​ (129.1 KB ) - added by jorgelopezrepiso 4 months ago.

Download all attachments as: .zip

Change History (8)

#1 @swissspidy
7 years ago

  • Component I18N → Feeds

#2 follow-up: @RavanH
7 years ago

Strange, I tested on several other installations and on some the single quote gets converted to &rsquo; (invalid) but on others to &#8217; (valid). Switching PHP version from 7.1 to 7.2 to 7.3, Nginx or Apache, I see no consistency in the behavior :/

Last edited 7 years ago by RavanH (previous) (diff)

#3 in reply to: ↑ 2 @SergeyBiryukov
7 years ago

  • Keywords needs-patch added

Replying to RavanH:

Strange, I tested on several other installations and on some the single quote gets converted to &rsquo; (invalid) but on others to &#8217; (valid).

&#8217; is a translatable string​ in wptexturize(), so some locales may have translated it to &rsquo;.

For feeds, we generally run the content through ​ent2ncr and other filters​ to prevent this kind of issues. Looks like in addition to post titles we have to run it on term titles as well.

#4 @jorgelopezrepiso
4 months ago

Hi! It seems that this issue is no longer reproducible in current versions of WordPress.

I have tested this scenario using a clean environment in WP Playground. As far as I can see, when creating a tag with an apostrophe (L'apostrophe), the RSS feed output successfully wraps the term inside a CDATA block, preventing any incorrect entity conversion or broken XML structures:

<![CDATA[ L'apostrophe ]]>

I attach a screenshot (ticket-47470-proof.png) showing the source code of the general feed (/?feed=rss2) where this behavior can be verified. It looks like the bug is resolved.

#5 @RavanH
4 months ago

  • Resolution → invalid
  • Status new → closed

Yes, looks like it indeed. I'll mark this one as resolved (as invalid because I don't have regular fixed as an option) :)

#6 @sabernhardt
4 months ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review
  • Resolution invalid → worksforme

I switched to "works for me" since it cannot be reproduced now.

This ticket was mentioned in ​Slack in #core-test by jorge_lopez_repiso. ​View the logs.


4 months ago

Note: See TracTickets for help on using tickets.