[wp-trac] [WordPress Trac] #25017: Dont allow empty $src parameter in wp_register_script
WordPress Trac
noreply at wordpress.org
Mon Aug 12 20:49:13 UTC 2013
#25017: Dont allow empty $src parameter in wp_register_script
--------------------------+-----------------------------
Reporter: oskarhane | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.6
Severity: normal | Keywords: needs-patch
--------------------------+-----------------------------
In Codex the $src parameter in ''wp_register_script( $handle, $src, $deps,
$ver, $in_footer )'' is required but is allowed to be empty.
This makes it easy to make a plugin/theme that breaks other plugins.
Some themes have this code loaded in init-hook:
{{{
if (!is_admin()) {
wp_deregister_script('jquery');
// De-Register jQuery
wp_register_script('jquery', '', '', '', true);
// It's already in the Header
}
}}}
If a plugin that uses jQuery is used on the login page, it'll be broken.
And you can't check if the script was correctly registered or not:
{{{
//This will return true even though $src was empty.
if(wp_script_is('jquery', 'registered'))
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25017>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list