[wp-trac] [WordPress Trac] #25709: Searches with stopwords can trigger E_WARNING when PCRE is lacking UTF-8 support

WordPress Trac noreply at wordpress.org
Sat Oct 26 05:31:05 UTC 2013


#25709: Searches with stopwords can trigger E_WARNING when PCRE is lacking UTF-8
support
--------------------------+--------------------
 Reporter:  nacin         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  high          |   Milestone:  3.7.1
Component:  General       |     Version:  3.7
 Severity:  major         |  Resolution:
 Keywords:                |
--------------------------+--------------------

Comment (by nacin):

 I'd say we silence it, certainly for 3.7.1, yes.

 {{{
 $ ack --php "preg_.*u['\"]"
 src/wp-includes/formatting.php
 529:            $utf8_pcre = @preg_match( '/^./u', 'a' );
 2230:           preg_match_all( '/./u', $text, $words_array );

 src/wp-includes/pomo/po.php
 138:                    preg_match_all('/./u', $line, $chars);

 src/wp-includes/query.php
 1990:                   if ( ! $term || preg_match( '/^\p{L}$/u', $term )
 )

 src/wp-includes/shortcodes.php
 295:    $text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);

 src/wp-includes/SimplePie/Misc.php
 1926:           return (bool)
 preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u',
 $string);

 src/wp-includes/wp-diff.php
 495:            $words  = preg_split( '/([^\w])/u', $string, -1,
 PREG_SPLIT_DELIM_CAPTURE );
 }}}

 Also, allowing for an additional character between "u" and the closing
 quote:
 {{{
 $ ack --php "preg_.*u.['\"]"
 src/wp-includes/compat.php
 30:     preg_match_all( '/./us', $str, $match );

 src/wp-includes/formatting.php
 537:    if ( 1 === @preg_match( '/^./us', $string ) ) {
 }}}

 These are tough to match for; there might be others.

 pomo/po.php isn't used in core. Other than that, how have we never
 received a report of this for shortcode_parse_atts() or elsewhere?
 Something smells funny.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25709#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list