Fix EZP-22446: AllowedRedirectHosts fix won't work with ports

https://jira.ez.no/browse/EZP-22446

Note that I made the binary operator compatible with PHP 5.2 (original request is for eZ 4.7).