The code below comes from wordpress. Listed here are a couple of things I do not understand:

/**
 * Turn register globals off.
 *
 * @access private
 * @since 2.1.0
 * @return null Will return null if register_globals PHP directive was disabled
 */
function wp_unregister_GLOBALS() {
if ( !ini_get( 'register_globals' ) )
    return;

if ( isset( $_REQUEST['GLOBALS'] ) )
    die( /*WP_I18N_GLOBALS_OVERWRITE*/'GLOBALS overwrite attempt detected'/*/WP_I18N_GLOBALS_OVERWRITE*/ );

// Variables that shouldn't be unset
$no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );

$input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
foreach ( $input as $k => $v )
    if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
        $GLOBALS[$k] = null;
        unset( $GLOBALS[$k] );
    }
}

First: so how exactly does "$_REQUEST['GLOBALS']" overwrite the globals? Second:

$GLOBALS[$k] = null;
unset( $GLOBALS[$k] );

Why set the $GLOBALS[$k] value null before unset it? Can one unset the $GLOBALS[$k] directly only?

First: so how exactly does "$_REQUEST['GLOBALS']" overwrite the globals?

This was once possible in PHP with register_globals enabled. Because of that, sSetting $_REQUEST["GLOBALS"] might have brought towards the GLOBALS array being overwritten.

Regarding the double unset() and null call, it might have related to what many people claim within the comments to [cde]: that unset() only removes the variable in the current scope, but does not always immediately destroy it and release the area allotted into it.

For the reason that situation, it might seem sensible to first "overwrite" the variable by setting it to null, then truly unsetting it. I'm not sure whether this is correct, though.