| @@ -58,9 +58,13 @@ | ||
| 58 | 58 | return [$host, $port]; |
| 59 | 59 | } |
| 60 | 60 | private static function isValidHostHeaderHost(string $host) : bool |
| 61 | 61 | { |
| 62 | - if (\preg_match('/[\\x00-\\x20\\x7F\\/\\?#@\\\\]/', $host)) { | |
| 62 | + $invalidHost = \preg_match('/[\\x00-\\x20\\x7F\\/\\?#@\\\\]/', $host); | |
| 63 | + if ($invalidHost === \false) { | |
| 64 | + return \false; | |
| 65 | + } | |
| 66 | + if ($invalidHost === 1) { | |
| 63 | 67 | return \false; |
| 64 | 68 | } |
| 65 | 69 | if (\strpos($host, '[') !== \false || \strpos($host, ']') !== \false) { |
| 66 | 70 | if ($host[0] !== '[' || \substr($host, -1) !== ']') { |