note 121721 deleted from function.parse-url by cmb

From: Date: Sun, 08 Sep 2019 10:31:27 +0000
Subject: note 121721 deleted from function.parse-url by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212145@lists.php.net to get a copy of this message
Note Submitter: anna ---- This function will attempt to parse relative URLs but relaying on it can produce unexpected behavior that can cause some hard to track bugs. (The following results are obtained from PHP 5.5.19) Attempting to parse a url like this http://example.com/entities/GOA:98/?search=8989157d1f22 Correctly produces <?php array ( 'scheme' => 'http', 'host' => 'example.com', 'path' => '/entities/GOA:98/', 'query' => 'search=8989157d1f22', ); ?> However, Attempting to parse the relative URL entities/GOA:98/?search=8989157d1f22 <?php array ( 'host' => 'entities', 'port' => 98, 'path' => '/GOA:98/', 'query' => 'search=8989157d1f22', ) ?> If I change :98 to :A98 parse_url parses the URL correctly as <?php array ( 'path' => 'entities/GOA:A98/', 'query' => 'search=8989157d1f22', ) ?> Bottom line, Avoid using parse_url for relative urls unless you have tested the expected input and you know parse_url will handle them well. https://forum.jdael.net/

« previous php.notes (#212145) next »