Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#9821 closed defect (bug) (fixed)

wp_specialchars doesn't capture pre-encoded entities correctly

Reported by: westi Owned by: westi
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.8
Component: Formatting Keywords:
Focuses: Cc:


Working on updating some of the wordpress-tests test cases for the formatting code to work with the new special chars and it looks like the capture of pre-encoded entities doesn't work correct.

Test Cases are here: http://svn.automattic.com/wordpress-tests/wp-testcase/jacob/TestFormatting.php

The one that fails is:

    function test_ignores_existing_entities() {
        $source = '& £  &';
        $res = '& £  &';
        $this->assertEquals($res, wp_specialchars($source));

Attachments (2)

wp_specialchars.diff (772 bytes) - added by westi 9 years ago.
Proposed fix to wp_specialchars so that it catches all existing entities
wp_specialchars.2.diff (718 bytes) - added by sambauers 9 years ago.

Download all attachments as: .zip

Change History (5)

9 years ago

Proposed fix to wp_specialchars so that it catches all existing entities

#1 @westi
9 years ago

  • Cc sambauers added

CC: sambauers as this may affect bbPress as well. Once committed will need to merge into BackPress trunk

Related ticket is #8767

#2 @sambauers
9 years ago

Totally true, well spotted...

I've made a minor change to the patch though, the regexp is case insensitive, so there is no need for the upper case chars.

#3 @westi
9 years ago

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

(In [11338]) Ensure that wp_specialchars captures all pre-encoded entities correctly when preventing double encoding. Fixes #9821.

Note: See TracTickets for help on using tickets.