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

See #27881.

Built from https://develop.svn.wordpress.org/trunk@28746


git-svn-id: http://core.svn.wordpress.org/trunk@28560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-06-11 20:00:15 +00:00
parent 9a286d75fd
commit 69fbe27f48
1 changed files with 8 additions and 10 deletions

View File

@ -274,17 +274,15 @@ function url_shorten( $url ) {
* @param array $vars An array of globals to reset.
*/
function wp_reset_vars( $vars ) {
for ( $i=0; $i<count( $vars ); $i += 1 ) {
$var = $vars[$i];
global $$var;
if ( empty( $_POST[$var] ) ) {
if ( empty( $_GET[$var] ) )
$$var = '';
else
$$var = $_GET[$var];
foreach ( $vars as $var ) {
if ( empty( $_POST[ $var ] ) ) {
if ( empty( $_GET[ $var ] ) ) {
$GLOBALS[ $var ] = '';
} else {
$GLOBALS[ $var ] = $_GET[ $var ];
}
} else {
$$var = $_POST[$var];
$GLOBALS[ $var ] = $_POST[ $var ];
}
}
}