note 101331 deleted from function.parse-url by cmb

From: Date: Sun, 19 Jan 2020 08:31:49 +0000
Subject: note 101331 deleted from function.parse-url by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213905@lists.php.net to get a copy of this message
Note Submitter: Mark Dobrinic ---- It seems the host-part strips off the last [:port] off the end of the hostname When something is wrong in the actual request, this proves to be the wrong way to do things. It would be better to not strip off the [:port], but to keep the string *before* the first [:port] as the hostname. Problem with (maybe malformed) provided HTTP_HOST hostname:443:443 that resolved in 'host' => 'hostname:443' Which gave me problems. Solution would be to enforce this yourself, explicitly: <?php $p = parse_url( $url ); $host = explode(':', $p['host']); $hostname = $host[0]; ?>

« previous php.notes (#213905) next »