#24556 closed defect (bug) (worksforme)
wptexturize() edge case bug with specific sentence structure
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 )
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:
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 (7)
#2
in reply to:
↑ 1
;
follow-up:
↓ 4
@
12 years 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”
#4
in reply to:
↑ 2
;
follow-up:
↓ 7
@
12 years ago
Replying to SergeyBiryukov:
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.
You are correct - it seems I indadvertedly copied the formatted string into Trac. I've just fixed the description here.
However, I am positive about being able to reproduce the problem in WordPress. I just typed up the exact sentence into a new post (no copy paste) into the text editor (not visual) and it reproduced the issue.
#6
@
11 years ago
- Keywords reporter-feedback added
I can't reproduce this either, here's what I get in trunk:
Uppercase. “Uppercase lowercase word-with-apostrophe’s lowercase lowercase”
#7
in reply to:
↑ 4
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
Replying to jkudish:
However, I am positive about being able to reproduce the problem in WordPress. I just typed up the exact sentence into a new post (no copy paste) into the text editor (not visual) and it reproduced the issue.
Also cannot reproduce this in 3.9-alpha, using these steps.
Feel free to re-open with a unit test or something else to demonstrate the behavior.
Hah, and it seems trac uses
wptexturize()
or a similar function too as it broke my example on here...