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

Bug #12672 PHP_SELF ending on / causes incorrect redirects
Submitted: 2007-12-12 14:19 UTC
From: mj Assigned: jausions
Status: No Feedback Package: HTTP (version CVS)
PHP Version: 5.2.5 OS:
Roadmaps: (Not assigned)    

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:
Solve the problem : 33 - 25 = ?

 [2007-12-12 14:19 UTC] mj (Martin Jansen)
Description: ------------ When $_SERVER['PHP_SELF'] ends on /, HTTP::absoluteURI() calling dirname($_SERVER['PHP_SELF']) results in everything after the leading / getting chopped off, which causes incorrect redirects for relative URIs. That attached patch against HEAD fixes this behaviour by not touching PHP_SELF when it comes with a trailing slash. Test script: --------------- Assuming $_SERVER['PHP_SELF'] is /foobar/. <?php require_once "HTTP.php"; HTTP::redirect("page.html"); ?> Expected result: ---------------- A redirect to http://myhost.tld/foobar/page.html. Actual result: -------------- A redirect to http://myhost.tld/page.html.


 [2008-01-26 20:41 UTC] jausions (Philippe Jausions)
The HTTP package trims PATH_INTO (in your example "/" or "/foobar/") to resolves relative URLs to the script itself. The patch cannot be accepted because it would cause a backward compatibility break. I'm working on solution to handle redirection taking into account the PATH_INFO, REQUEST_URI and generally friendlier to rewrite rules.
 [2008-01-30 04:52 UTC] jausions (Philippe Jausions)
Thank you for taking the time to report a problem with the package. This problem may have been already fixed by a previous change that is in the CVS of the package. Please log into CVS with: cvs -d login and check out the CVS repository of this package and upgrade cvs -d co pear/HTTP pear upgrade pear/HTTP/package2.xml or pear upgrade pear/HTTP/package.xml If you are able to reproduce the bug with the latest CVS, please change the status back to "Open". Again, thank you for your continued support of PEAR.