[wp-trac] [WordPress Trac] #22400: Remove all, or at least most, uses of extract() within WordPress

WordPress Trac noreply at wordpress.org
Sat Nov 10 07:59:54 UTC 2012


#22400: Remove all, or at least most, uses of extract() within WordPress
--------------------------+------------------------------
 Reporter:  Viper007Bond  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  lowest        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.4.2
 Severity:  minor         |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Changes (by MikeSchinkel):

 * cc: mike@… (added)


Comment:

 Replying to [comment:2 Viper007Bond]:
 > Having `$defaults` contain all valid parameters certainly helps a lot
 but I still think `extract()` is bad.
 >
 > If I see `$foo` somewhere deep in the function, it's not immediately
 clear if this is a function-set value or a user-supplied value. Yes, I
 probably have to search either way to see where the variable comes from
 but by instead using `$args['foo']`, it's immediately clear that this is a
 configuration argument rather than just a data storage variable.

 +1

 Replying to [comment:7 DrewAPicture]:
 > In many contexts, I'd argue that unless you have intimate knowledge of
 the codebase, the `$defaults` array is ''the best'' in-line documentation
 available for incoming args, regardless of whether `extract()` is used or
 not.

 Definitely agree.

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


More information about the wp-trac mailing list