WordPress.org

Make WordPress Core

Opened 10 months ago

Last modified 3 months ago

#24556 closed defect (bug)

wptexturize() edge case bug with specific sentence structure — at Version 3

Reported by: jkudish Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Formatting Keywords: needs-unit-tests reporter-feedback
Focuses: Cc:

Description (last modified by jkudish)

I discovered a very very edge case bug with wptexturize() where the below text will be output with the opening quote as the closing quote html entity (e.g. ”) instead of the opening quote html entity (e.g. “) as expected.

Here's the text. The words can be replaced with anything else as long as they follow the same pattern.

Uppercase. "Uppercase lowercase word-with-apostrophe's lowercase lowercase"

Here's how it gets output on the front-end:

https://dl.dropbox.com/s/zbrilmyoo8awkjo/2013-06-10%20at%203.08.39%20PM.png

The exact same problem happens regardless of the theme used. I can also consistently reproduce on WordPress 3.5.1 as well as with trunk. No plugins installed.

I've tracked the bug down to the, opening quote regex in wp_texturize().

My regex foo isn't good enough to figure out a proper solution here unfortunately.

Change History (3)

comment:1 follow-up: jkudish10 months ago

Hah, and it seems trac uses wptexturize() or a similar function too as it broke my example on here...

comment:2 in reply to: ↑ 1 SergeyBiryukov10 months ago

Replying to jkudish:

Hah, and it seems trac uses wptexturize() or a similar function too as it broke my example on here...

I don't think Trac uses any kind of texturizing function, it looks like you've pasted an already formatted string here.

Could not reproduce with regular quotes. This string:

Uppercase. "Uppercase lowercase word-with-apostrophe’s lowercase lowercase"

gives me this in both 3.5.1 and trunk:

Uppercase. “Uppercase lowercase word-with-apostrophe’s lowercase lowercase”

comment:3 jkudish10 months ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.