[wp-trac] [WordPress Trac] #20683: WP_Dependencies' constructor should accept a string/array value for $deps rather than converting a string to an empty array

WordPress Trac noreply at wordpress.org
Tue Apr 23 12:42:15 UTC 2013


#20683: WP_Dependencies' constructor should accept a string/array value for $deps
rather than converting a string to an empty array
-------------------------+------------------------------
 Reporter:  vhauri       |       Owner:  markjaquith
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------------------

Comment (by rmccue):

 Replying to [comment:11 Otto42]:
 > I don't accept that this is unsolvable.
 >
 > The problem here seems to be that by allowing $deps to be a string, then
 somebody who had accidentally put a version there (like in #22111) would
 get a non-existent dependency. The code in WP_Dependency would then simply
 not include the code because of a missing dependency.
 >
 > This problem can be solved by simply ignoring non-existent dependencies
 and letting the script/stylesheet load anyway. Yes, it may be broken, but
 it will definitely be broken if it doesn't load at all.
 >
 > Dependencies define the order of loading, but we don't necessarily have
 to state that they will also define absolute dependence upon the defined
 enqueued items. If somebody has a non-existent dependency, then that's
 clearly a coding error, and throwing a _doing_it_wrong but loading the
 scripts anyway would make more sense.

 Surprisingly, I agree with you. Dependencies do mean that the code relies
 on it, but getting a Javascript error with `jQuery is undefined` (e.g.)
 seems a little easier to debug than the script not loading at all.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20683#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list