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  


 [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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!