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

WordPress Trac noreply at wordpress.org
Fri Nov 9 23:22:52 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:                |
--------------------------+------------------------------

Comment (by Viper007Bond):

 Having `$defaults` contain all valid parameters certainly help 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 more clear that this is a configuration
 argument rather than just a data storage variable.

 I think another question is what's the advantage to using `extract()`? I
 can't think of any other than saving keystrokes which shouldn't be a valid
 reason.

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


More information about the wp-trac mailing list