[wp-trac] [WordPress Trac] #23816: wp_enqueue_script|style() dependency failures are silent

WordPress Trac noreply at wordpress.org
Sun May 11 18:44:59 UTC 2014


#23816: wp_enqueue_script|style() dependency failures are silent
---------------------------+------------------------------
 Reporter:  johnbillion    |       Owner:
     Type:  enhancement    |      Status:  reopened
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Script Loader  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------
Changes (by markjaquith):

 * status:  closed => reopened
 * component:  General => Script Loader
 * priority:  low => normal
 * milestone:   => Awaiting Review
 * resolution:  invalid =>


Old description:

> If I call `wp_enqueue_script()` or `wp_enqueue_style()` with a dependency
> that doesn't exist then I don't get told about it.
>
> Example:
>
> {{{
> wp_enqueue_script(
>         'my-script',
>         get_stylesheet_directory_uri() . '/my-script.js',
>         array( 'script-that-does-not-exist' )
> );
> }}}
>
> Actual result: 'my-script' gets enqueued, but I don't get told that
> 'script-that-does-not-exist' doesn't exist and wasn't enqueued.
>
> Expected result: When `WP_DEBUG` is true, I should get a PHP notice
> warning me that the dependency script doesn't exist.

New description:

 If I call `wp_enqueue_script()` or `wp_enqueue_style()` with a dependency
 that doesn't exist then I don't get told about it.

 Example:

 {{{
 wp_enqueue_script(
         'my-script',
         get_stylesheet_directory_uri() . '/my-script.js',
         array( 'script-that-does-not-exist' )
 );
 }}}

 Actual result: nothing is enqueued, and no notices are thrown.

 Expected result: When `WP_DEBUG` is true, I should get a PHP notice
 warning me that the dependency script doesn't exist.

--

Comment:

 Opening this back up. The original report is mostly valid. If you
 register/enqueue something with a bad dependency, you get silent failure.
 Nothing is output, and no notices are thrown. I typo'd 'wp-utils' instead
 of 'wp-util' and it was maddening trying to figure out why no scripts were
 printing.

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


More information about the wp-trac mailing list