> oops. Variable should be $this->components, not $result.

Hah I never spotted that!

> As for why, that code is executed when URL is schema-relative. Such URLs cannot have port numbers.

Port numbers are perfectly valid without a scheme-relative URL, I've tried it in Chrome and it works.

> A scheme-relative URL must be "//", optionally followed by userinfo and "@", followed by a host, optionally followed by ":" and a port, optionally followed by an absolute-path-relative URL.

http://url.spec.whatwg.org/#concept-scheme-relative-url