To reproduce do a fresh install of wordpress and turn on debug mode. Visit the homepage and you'll see the notices.
Notice: Undefined index: port in <removed>/wp-includes/canonical.php on line 181
Notice: Undefined index: query in <removed>/wp-includes/canonical.php on line 181
Notice: Undefined index: port in <removed>/wp-includes/canonical.php on line 181
Notice: Undefined index: query in <removed>/wp-includes/canonical.php on line 181
To fix this issue, I think we can ignore any extraneous initialization code and suppress the notices with @, as the operation array() !== array() is not affected undefined indexes internally.
Please see my patch for fixing this issue, thanks.