[wp-trac] [WordPress Trac] #33837: We should avoid Superglobals when possible

WordPress Trac noreply at wordpress.org
Wed Sep 16 17:43:17 UTC 2015


#33837: We should avoid Superglobals when possible
-------------------------------------+-----------------------------
 Reporter:  wonderboymusic           |       Owner:  wonderboymusic
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.4
Component:  General                  |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch 2nd-opinion  |     Focuses:
-------------------------------------+-----------------------------

Comment (by kitchin):

 Ack, 33837.stringish.diff is the best I have for behavior. I looked at
 making it more like WP_List_Table::current_action() in how it works, but
 the goal is to replace $_REQUEST generally, so this still seems best to
 me, whatever the name:
 {{{
 function wp_raw_request_value( $field, $value = null ) {
         if ( is_string( $field ) && isset( $_REQUEST[ $field ] ) ) {
                 $raw = $_REQUEST[ $field ];
                 if ( is_string( $raw ) ) {
                         if ( $value !== null ) {
                                 return $value === $raw;
                         }
                         return $raw;
                 }
         }
 }
 }}}

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


More information about the wp-trac mailing list