[wp-trac] [WordPress Trac] #25021: Improve sanitize_title_with_dashes % removal

WordPress Trac noreply at wordpress.org
Tue Aug 13 11:45:00 UTC 2013


#25021: Improve sanitize_title_with_dashes % removal
--------------------------+-----------------------------
 Reporter:  duck_         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Formatting    |    Version:  1.5
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 The current method of % removal involves placeholders to prevent stomping
 on escape sequences:

 {{{
 // Preserve escaped octets.
 $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
 // Remove percent signs that are not part of an octet.
 $title = str_replace('%', '', $title);
 // Restore octets.
 $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
 }}}

 This leads to `sanitize_title_with_dashes('---aa---')` producing `%aa`
 instead of just `aa`.

 [2189]

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25021>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list