[wp-trac] [WordPress Trac] #38073: Goodbye wp_reset_vars()
WordPress Trac
noreply at wordpress.org
Sat Jul 8 09:13:29 UTC 2017
#38073: Goodbye wp_reset_vars()
-------------------------------------------------+-------------------------
Reporter: swissspidy | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
Component: General | Review
Severity: normal | Version:
Keywords: good-first-bug dev-feedback has- | Resolution:
patch | Focuses:
| administration
-------------------------------------------------+-------------------------
Changes (by swissspidy):
* keywords: needs-patch good-first-bug => good-first-bug dev-feedback has-
patch
Comment:
> Since all wp_reset_vars does is (re)assigning the value of a POST or GET
request to a variable if it exists, isn't it an idea to write a new
function which does exactly the same, but without the use of globals?
I don't really the see the value in `wp_assign_request_var()` because you
could probably just as well use `$_REQUEST`.
However, in pretty much all places where `wp_reset_vars()` is used, the
variables actually only come from a single source, either only `$_GET` or
only `$_POST`. So I think in our code we should be specific enough to make
this clear for developers to prevent confusion and bugs. Something like
`isset( $_GET['xy'] ) ? sanitization_function( $_GET['xy'] ) : 'default'`
is much clearer than having `wp_assign_request_var()` all over the place.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38073#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list