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

WordPress Trac noreply at wordpress.org
Fri Nov 6 00:06:33 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:
-------------------------------+------------------------------
Changes (by johnbillion):

 * keywords:   => reporter-feedback


Old description:

> Current code in do_item() of class.wp-script.php on line 172:
>
> {{{
> $src = $this->base_url . $src;
> }}}
>
> may produce duplicate slashes "//", resulting in problems.
>
> This might be fixed with code:
> {{{
> $src = $this->base_url . $src;
> }}}
>
> Currently:
> * WP_Scripts contains: "public $base_url; // Full URL with trailing
> slash" and
> * script-loader.php contains calls $scripts->add() with initial "/" in
> relative paths
>
> Together this produces doubled slashes "//". For example:
> http://www.ocelovehaly.cz/ll//wp-includes/js/jquery/jquery.js?ver=1.11.3
>
> This makes W3TC include script  in minified version, but not to remove it
> from the original HTML.
>
> Including jQuery twice makes LayerSlider not to work.
>
> Please, could you bugfix class.wp-script.php on line 172?
>
> Thank you :-)

New description:

 Current code in `do_item()` of class.wp-script.php on line 172:

 {{{
 $src = $this->base_url . $src;
 }}}

 may produce duplicate slashes `"//"`, resulting in problems.

 This might be fixed with code:
 {{{
 $src = $this->base_url . $src;
 }}}

 Currently:
 * WP_Scripts contains: `"public $base_url; // Full URL with trailing
 slash"` and
 * script-loader.php contains calls `$scripts->add()` with initial `"/"` in
 relative paths

 Together this produces doubled slashes `"//"`. For example:
 http://www.ocelovehaly.cz/ll//wp-includes/js/jquery/jquery.js?ver=1.11.3

 This makes W3TC include script  in minified version, but not to remove it
 from the original HTML.

 Including jQuery twice makes LayerSlider not to work.

 Please, could you bugfix class.wp-script.php on line 172?

 Thank you :-)

--

Comment:

 Thanks for the report, @jan.mazanek.

  * Can you explain a little more about why you think this double slash is
 appearing?
  * What's the value of the `home` option in the `wp_options` table in your
 database?
  * Does the bug remain if you disable all the plugins on your site and
 switch to one of the default themes?
  * Is there anything unusual about the configuration of your site?

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


More information about the wp-trac mailing list