[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
Wed Apr 17 17:43:49 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:  3.5
Component:  General           |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch revert  |
------------------------------+--------------------------
Changes (by Otto42):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 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.

 Looks to me like you can just remove those checks in function all_deps, or
 change them to keep going anyway but throw a debugging error.

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


More information about the wp-trac mailing list