WordPress.org

Make WordPress Core

Changeset 28746


Ignore:
Timestamp:
06/11/2014 07:59:18 PM (6 years ago)
Author:
wonderboymusic
Message:

Don't use variable variables in wp_reset_vars(). Test by searching in list tables, etc.

See #27881.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/misc.php

    r28658 r28746  
    275275 */
    276276function wp_reset_vars( $vars ) {
    277     for ( $i=0; $i<count( $vars ); $i += 1 ) {
    278         $var = $vars[$i];
    279         global $$var;
    280 
    281         if ( empty( $_POST[$var] ) ) {
    282             if ( empty( $_GET[$var] ) )
    283                 $$var = '';
    284             else
    285                 $$var = $_GET[$var];
     277    foreach ( $vars as $var ) {
     278        if ( empty( $_POST[ $var ] ) ) {
     279            if ( empty( $_GET[ $var ] ) ) {
     280                $GLOBALS[ $var ] = '';
     281            } else {
     282                $GLOBALS[ $var ] = $_GET[ $var ];
     283            }
    286284        } else {
    287             $$var = $_POST[$var];
     285            $GLOBALS[ $var ] = $_POST[ $var ];
    288286        }
    289287    }
Note: See TracChangeset for help on using the changeset viewer.