[wp-trac] [WordPress Trac] #34591: BugFix to WP_Scripts::do_item(), remove doubled "//"

WordPress Trac noreply at wordpress.org
Fri Nov 6 15:36:46 UTC 2015


#34591: BugFix to WP_Scripts::do_item(), remove doubled "//"
-------------------------------+------------------------------
 Reporter:  jan.mazanek        |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Script Loader      |     Version:  4.3.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by jan.mazanek):

 John, thank for reply.

 My configuration is highly unusual to get high speed, shared data and use
 multiple host names without domain preffixes or suffixes. I developed a
 Child Theme based on Avada, I use plugins W3 Total Cache and A3 Lazy Load
 and some other.

 The key info for this ticket might be, that I do override options siteurl,
 home, page_on_front, blogname, blogdescription with filters:
 pre_option_siteurl
 pre_option_home
 pre_option_blogname
 pre_option_blogdescription

 If I remember correct, I did remove trailing slash from siteurl and home
 options afer writting this ticket.

 But to simplify things. wp-includes/class.wp-scripts.php contains:
 1) line 20:
 {{{
 public $base_url; // Full URL with trailing slash
 }}}
 2) line 172:
 {{{
 $src = $this->base_url . $src;
 }}}

 So together: if I do respect comment and $this->base_url contains trailing
 slash
 and if $src starts with slash (as is now used in script-loader.php)
 then together this will produce two slashes.

 Possible solutions - alternatives:
 1) Change documentation, that $this->base_url should not contain trailing
 slash
 2) Remove initial slash from script-loader.php calls to $scripts->add()
 3) My original suggestion (or any other code) which will prevent doubled
 slashes

 Currently I solved the problem for myself and I am not going to test, if
 "Does the bug remain if you disable all the plugins on your site and
 switch to one of the default themes?", but I am almost sure, that the
 problem would disappear (which doesn't mean, that the code is safe and
 should not be changed).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34591#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list