[wp-trac] [WordPress Trac] #38073: Goodbye wp_reset_vars()

WordPress Trac noreply at wordpress.org
Sun Jun 18 20:09:24 UTC 2017


#38073: Goodbye wp_reset_vars()
----------------------------------------+------------------------------
 Reporter:  swissspidy                  |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  General                     |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:  administration
----------------------------------------+------------------------------

Comment (by weijland):

 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?
 Something like this:

 {{{#!php
 $action = wp_assign_request_var( 'action' );
 }}}

 {{{#!php
 function wp_assign_request_var( $var ) {
    if ( empty( $_POST[ $var ] ) ) {
         if ( empty( $_GET[ $var ] ) ) {
              return '';
         } else {
              return $_GET[ $var ];
         }
    } else {
         return $_POST[ $var ];
    }
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38073#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list