PHP探秘(一)--魔术引用(2):mediawiki对魔术引用的处理
MediaWiki 默认是关掉魔术引用的。/** * Recursively strips slashes from the given array; * used for undoing the evil that is magic_quotes_gpc. * @param $arr array: will be modified * @return array the original array * @private */ function &fix_magic_quotes( &$arr ) { foreach( $arr as $key => $val ) { if( is_array( $val ) ) { $this->fix_magic_quotes( $arr[$key] ); } else { $arr[$key] = stripslashes( $val ); } } return $arr; } /** * If magic_quotes_gpc option is on, run the global arrays * through fix_magic_quotes to strip out the stupid slashes. * WARNING: This should only be done once! Running a second * time could damage the values. * @private */ function checkMagicQuotes() { if ( function_exists( \'get_magic_quotes_gpc\' ) && get_magic_quotes_gpc() ) { $this->fix_magic_quotes( $_COOKIE ); $this->fix_magic_quotes( $_ENV ); $this->fix_magic_quotes( $_GET ); $this->fix_magic_quotes( $_POST ); $this->fix_magic_quotes( $_REQUEST ); $this->fix_magic_quotes( $_SERVER ); } }
页:
[1]