From: John Du Hart Date: Thu, 29 Sep 2011 20:21:32 +0000 (+0000) Subject: Followup r95921, clearer PHPDoc and better variable names per CR X-Git-Tag: 1.31.0-rc.0~27365 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=58685f9fd54d2516f5a97d61992fa2128015041d;p=lhc%2Fweb%2Fwiklou.git Followup r95921, clearer PHPDoc and better variable names per CR --- 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 );