[wp-trac] [WordPress Trac] #35022: WP allows Unicode 0x00a0 spaces in editor but shortcode parser can't handle them

WordPress Trac noreply at wordpress.org
Fri Dec 11 19:38:39 UTC 2015


#35022: WP allows Unicode 0x00a0 spaces in editor but shortcode parser can't handle
them
--------------------------+-----------------------------
 Reporter:  steevithak    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Shortcodes    |    Version:  4.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Since the release of WP 4.4, we have complaints on multiple sites that
 shortcodes are "mysteriously" failing despite being syntactically correct.
 Users claim merely editing and re-saving articles breaks the shortcodes.
 After several days of research, I discovered the problem with the non-
 working shortcodes is that they contain 0x00a0 Unicode non-breaking space
 characters. I've been unable to determine how the space characters are
 being created or why it has started generating complaints for us since the
 release of 4.4 but I have looked at the code in /wp-
 includes/shortcodes.php and verified that it will fail on shortcodes
 containing 0x00a0 characters in white space despite the editor apparently
 allowing them as legal white space characters.

 Part of the problem is this line of code which can't identify a shortcode
 tag if it is followed by a 0x00a0 instead of a 0x20 space character. There
 are further problems parsing the shortcode parameters. (adding \xc2\xa0 to
 the regex seems to fix this line).


 {{{
 // Find all registered tag names in $content.
 preg_match_all( '@\[([^<>&/\[\]\x00-\x20]++)@', $content, $matches
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35022>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list