From 044b6965707ebecc2967bcb2f7567401512eb8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 8 Dec 2005 19:36:32 +0000 Subject: [PATCH] Do not choke on arrays in $_SERVER array (bug #1370414). --- ChangeLog | 2 ++ libraries/grab_globals.lib.php | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9d2b703b..3d073f609 100755 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,8 @@ $Source$ writable permissions, refuse to work with existing config dir. * lang/*, libraries/auth/config.auth.lib.php: Suggest to run setup script if auth with default values fails. + * libraries/grab_globals.lib.php: Do not choke on arrays in $_SERVER + array (bug #1370414). 2005-12-08 Sebastian Mendel * libraries/tbl_move_copy.php: added PMA_table_rename() diff --git a/libraries/grab_globals.lib.php b/libraries/grab_globals.lib.php index 75fbc4d74..7443d1646 100644 --- a/libraries/grab_globals.lib.php +++ b/libraries/grab_globals.lib.php @@ -192,8 +192,21 @@ if ( $__redirect || ! defined( 'PMA_NO_VARIABLES_IMPORT' ) ) { $_COOKIE['goto'] ); } // end if - array_walk( $_SERVER, 'strip_tags' ); - array_walk( $_ENV, 'strip_tags' ); + /** + * Recursive wrapper around strip_tags to process also arrays. + * + * @param mixed array or string to strip tags + */ + function array_strip_tags(&$item) { + if (is_array($item)) { + array_walk($item, 'array_strip_tags'); + } else { + strip_tags($item); + } + } + + array_walk( $_SERVER, 'array_strip_tags' ); + array_walk( $_ENV, 'array_strip_tags' ); } ?>