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

See #27881.


git-svn-id: https://develop.svn.wordpress.org/trunk@28746 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-06-11 19:59:18 +00:00
parent eb23569835
commit 61c1da236c

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 ];
}
}
}