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)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 5 - 1 = ?

 
 [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 <http://example.org/foo.php>, it returns "http://example.org/?bar". According to RFC 3986, it should return "http://example.org/foo.php?bar". 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: ---------------- http://example.org/foo.php?bar link Actual result: -------------- http://example.org/?bar link Note that Firefox 1.5 and Internet Explorer 6 resolves the link correctly to <http://example.org/foo.php?bar>.

Comments

 [2006-03-15 21:23 UTC] pear dot php dot net at chsc dot dk
Protocol-relative URIs (e.g. <//php.net>) 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 pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net 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.