[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 03:36:08 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 DrewAPicture):
* cc: xoodrew@… (added)
Comment:
Replying to [comment:2 Viper007Bond]:
> Having `$defaults` contain all valid parameters certainly helps a lot
but I still think `extract()` is bad.
In many contexts, I'd argue that unless you have intimate knowledge of the
codebase, the `$defaults` array is ''the best'' documentation available
for incoming args, regardless of whether `extract()` is used or not.
I've read several places that using `extract()` often creates confusion,
though I think as you pointed out, a lot of that stems from the lack of
distinction with the resulting variables. With what seems to be widespread
use in core (as evidenced in comment:3), I'm surprised `EXTR_PREFIX_ALL`
never got used to set unique prefixes.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22400#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list