From 58685f9fd54d2516f5a97d61992fa2128015041d Mon Sep 17 00:00:00 2001 From: John Du Hart Date: Thu, 29 Sep 2011 20:21:32 +0000 Subject: [PATCH] Followup r95921, clearer PHPDoc and better variable names per CR --- includes/WebRequest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 2abc3d2b05..84e7e78a06 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -239,15 +239,18 @@ class WebRequest { * used for undoing the evil that is magic_quotes_gpc. * * @param $arr array: will be modified - * @param $recursion bool Used to modify behaviour based on recursion + * @param $topLevel bool Specifies if the array passed is from the top + * level of the source. In PHP5 magic_quotes only escapes the first level + * of keys that belong to an array. * @return array the original array + * @see http://www.php.net/manual/en/function.get-magic-quotes-gpc.php#49612 */ - private function &fix_magic_quotes( &$arr, $recursion = false ) { + private function &fix_magic_quotes( &$arr, $topLevel = true ) { $clean = array(); foreach( $arr as $key => $val ) { if( is_array( $val ) ) { - $cleanKey = !$recursion ? stripslashes( $key ) : $key; - $clean[$cleanKey] = $this->fix_magic_quotes( $arr[$key], true ); + $cleanKey = $topLevel ? stripslashes( $key ) : $key; + $clean[$cleanKey] = $this->fix_magic_quotes( $arr[$key], false ); } else { $cleanKey = stripslashes( $key ); $clean[$cleanKey] = stripslashes( $val ); -- 2.20.1