[wp-trac] Re: [WordPress Trac] #3299: clean_url() not working for non-HTTP URLS

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 1 18:08:02 GMT 2007


#3299: clean_url() not working for non-HTTP URLS
----------------------+-----------------------------------------------------
 Reporter:  redclown  |        Owner:  pishmishy
     Type:  defect    |       Status:  assigned 
 Priority:  normal    |    Milestone:           
Component:  General   |      Version:  2.0.5    
 Severity:  normal    |   Resolution:           
 Keywords:            |  
----------------------+-----------------------------------------------------
Changes (by pishmishy):

  * owner:  anonymous => pishmishy
  * status:  new => assigned
  * summary:  @ character stripped from mailto link, http:// inserted in
              string => clean_url() not working for non-HTTP
              URLS

Comment:

 The following code from clean_url() strips @ from URLs.
 {{{
 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%]|i', '', $url);
 }}}

 The following code from clean_url() prepends http:// onto non-http URLs
 {{{
 if ( strpos($url, '://') === false &&
                 substr( $url, 0, 1 ) != '/' &&
 !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
                 $url = 'http://' . $url;
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3299#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list