Make WordPress Core

Opened 5 years ago

Closed 11 months ago

Last modified 10 months ago

#48602 closed defect (bug) (duplicate)

wptexturize: smart quotes: should ignore tags inside quotes

Reported by: kurakin_alexander's profile kurakin_alexander Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Formatting Keywords: has-patch needs-unit-tests
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Source (in editor):

"abc <a href="">def</a>".

After save:

Actual: «abc [ def]«.
Expected: «abc [ def]».

Change History (6)

#1 @SergeyBiryukov
5 years ago

  • Component changed from General to Formatting
  • Description modified (diff)

#2 @jeremyfelt
5 years ago

  • Keywords has-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release

Thanks for opening this ticket, @kurakin_alexander, I've run into this myself recently.

A few variations:

# This should be 8220 and 8221
wp> wptexturize( '"<em>these quotes are wrong!</em>"' );
string(46) "&#8220;<em>these quotes are wrong!</em>&#8220;"

# This should be 8220 and 8221. The em dash causes a flip of sorts.
wp> wptexturize( 'Interrupt this with a quote—"<em>these quotes are wrong!</em>"' );
string(76) "Interrupt this with a quote—&#8221;<em>these quotes are wrong!</em>&#8220;"

# And as a bonus, this should be 8220 and 8221, but has no tags, just a preceding em dash.
wp> wptexturize( 'Interrupt this with a quote—"these quotes are wrong!"' );
string(67) "Interrupt this with a quote—&#8221;these quotes are wrong!&#8221;"

A first patch could probably add those to the tests.

#3 @mikeywil
4 years ago

Thanks for raising this ticket. I came across the same issue today, and mentioned it in support. In a reply, @vladytimy helpfully replicated and illustrated the problem more clearly.

#4 @edent
3 years ago

This also occurs when using MarkDown in the classic editor:

Read "[Text](".

Renders as

Read “<a href="">text</a>“.

#5 @ellatrix
11 months ago

  • Resolution set to duplicate
  • Status changed from new to closed

I believe this is a duplicate of #18549. Feel free to reopen if I'm mistaken!

#6 @desrosj
10 months ago

  • Milestone Future Release deleted
  • Version changed from 5.2.2 to 3.2.1
Note: See TracTickets for help on using tickets.