[wp-trac] [WordPress Trac] #9088: string replacement changed to incorrect regex replacement

WordPress Trac wp-trac at lists.automattic.com
Wed Feb 11 10:29:49 GMT 2009


#9088: string replacement changed to incorrect regex replacement
--------------------------+-------------------------------------------------
 Reporter:  pne           |       Owner:  anonymous
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  2.7.2    
Component:  General       |     Version:           
 Severity:  normal        |    Keywords:  regex    
--------------------------+-------------------------------------------------
 I saw that from 2.7 (r10049) to 2.7.1 (r10482), wp-admin/link-manager.php
 changed by turning
 {{{
 str_replace('www.', '', $short_url)
 }}}
 into
 {{{
 preg_replace('/^www./i', '', $short_url)
 }}}

 I think that the regex should be
 {{{
 /^www\./i
 }}}
 with a backslash before the dot, since dot is special in regexes ('match
 any character'), which is probably not what is intended here.

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


More information about the wp-trac mailing list