[wp-trac] [WordPress Trac] #4046: script-loader not https compatible

WordPress Trac wp-trac at lists.automattic.com
Thu Mar 29 23:44:54 GMT 2007


#4046: script-loader not https compatible
---------------------+------------------------------------------------------
 Reporter:  abtime   |       Owner:  anonymous
     Type:  defect   |      Status:  new      
 Priority:  low      |   Milestone:  2.4      
Component:  General  |     Version:  2.1.2    
 Severity:  normal   |    Keywords:           
---------------------+------------------------------------------------------
 When siteurl starts with https, the function _print_scripts in wp-includes
 /script-loader.php outputs a wrong url, because it checks for the
 existence of "http://" at the beginning of the url, and mistakenly
 prepends a second time the siteurl.

 My patch:

 Replace this line:
 {{{
 $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ?
 $this->scripts[$handle]->src : get_option( 'siteurl' ) .
 $this->scripts[$handle]->src;
 }}}
 with this code:
 {{{
 $src = $this->scripts[$handle]->src;
 if (!preg_match("/^https?:\/\//", $src)) {
   $src = get_option( 'siteurl' ) . $src;
 }
 }}}

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


More information about the wp-trac mailing list