Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.1

Bug #7130 HTTP::absoluteURI("?foo") resolves to wrong URI
Submitted: 2006-03-15 19:25 UTC
From: pear dot php dot net at chsc dot dk Assigned: mike
Status: Closed Package: HTTP (version 1.4.0)
PHP Version: 5.0.5 OS: Linux
Roadmaps: (Not assigned)    

 [2006-03-15 19:25 UTC] pear dot php dot net at chsc dot dk (Christian Schmidt)
Description: ------------ When HTTP::absoluteURI("?bar") is called from the script <>, it returns "". According to RFC 3986, it should return "". RFC 3986, section 5.4 mentions an example: When the base URL is <http://a/b/c/d;p?q> and the relative URI is <?y>, the target URL is <http://a/b/c/d;p?y>. Test script: --------------- Put the following in a file foo.php: <?php require_once "HTTP.php"; $uri = "?bar"; print HTTP::absoluteURI($uri); print " <a href='$uri'>link</a>"; ?> Expected result: ---------------- link Actual result: -------------- link Note that Firefox 1.5 and Internet Explorer 6 resolves the link correctly to <>.


 [2006-03-15 21:23 UTC] pear dot php dot net at chsc dot dk
Protocol-relative URIs (e.g. <//>) aren't supported either. Section 5.2 in RFC 3986 describes an algorithm for resolving relative URIs. I think it is fairly simple to implement this using PHP's parse_uri().
 [2006-04-23 14:23 UTC] mike (Michael Wallner)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.