Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -239,15 +239,18 @@ |
240 | 240 | * used for undoing the evil that is magic_quotes_gpc. |
241 | 241 | * |
242 | 242 | * @param $arr array: will be modified |
243 | | - * @param $recursion bool Used to modify behaviour based on recursion |
| 243 | + * @param $topLevel bool Specifies if the array passed is from the top |
| 244 | + * level of the source. In PHP5 magic_quotes only escapes the first level |
| 245 | + * of keys that belong to an array. |
244 | 246 | * @return array the original array |
| 247 | + * @see http://www.php.net/manual/en/function.get-magic-quotes-gpc.php#49612 |
245 | 248 | */ |
246 | | - private function &fix_magic_quotes( &$arr, $recursion = false ) { |
| 249 | + private function &fix_magic_quotes( &$arr, $topLevel = true ) { |
247 | 250 | $clean = array(); |
248 | 251 | foreach( $arr as $key => $val ) { |
249 | 252 | if( is_array( $val ) ) { |
250 | | - $cleanKey = !$recursion ? stripslashes( $key ) : $key; |
251 | | - $clean[$cleanKey] = $this->fix_magic_quotes( $arr[$key], true ); |
| 253 | + $cleanKey = $topLevel ? stripslashes( $key ) : $key; |
| 254 | + $clean[$cleanKey] = $this->fix_magic_quotes( $arr[$key], false ); |
252 | 255 | } else { |
253 | 256 | $cleanKey = stripslashes( $key ); |
254 | 257 | $clean[$cleanKey] = stripslashes( $val ); |