Why is the domain name missing from the logout redirect?

I have traced the problem to this code in wp-login.php:

case 'logout' :
    check_admin_referer('log-out');

    $user = wp_get_current_user();

    wp_logout();

    echo "hello";
    echo $_REQUEST['redirect_to'];

    if ( ! empty( $_REQUEST['redirect_to'] ) ) {
        $redirect_to = $requested_redirect_to = $_REQUEST['redirect_to'];
    } else {
        $redirect_to = 'wp-login.php?loggedout=true';
        $requested_redirect_to = '';
    }

It appears if I change this line:

$redirect_to = 'wp-login.php?loggedout=true';

to this:

$redirect_to = 'http://wp-login.php?loggedout=true';

Then it works as expected. Not sure why. In fact I can also change it to any of the following and it still works as expected:

$redirect_to = ‘http://’;

or

$redirect_to = ‘http://somerandomsite’;

Not sure what is going on.