zendframework/zf2 — pull request #561 by lubko (2011-11-02 19:11:06+00:00)
Title: quickfix: app fails to run on non-standard port

Hello,

With the standard configuration running \Zend\Mvc\Application will fail on port!=80.

trace:
\Zend\Mvc\Application->getRequest() instantiates \Zend\Http\PhpEnvironment\Request
\Zend\Http\PhpEnvironment\Request->__construct() calls \Zend\Http\PhpEnvironment\Request->setServer()

On line 71 if the hostname is present, it will contain string "mydomain.local:1234".
This will trigger exception in \Zend\Uri\Http->setHost() as the string with name+colon+port fails hostname validation.

I am not quite sure what this string will look like if the url is say http://[1fff:0:a88:85a3::ac1f]:8001/index.html
But at least there wont be a regression, this fix deals with only one colon.

If the hostname can not be obtained from headers, things work fine, only the port is not recorded.