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

Bug #4310 absoluteURI() loses directory path in php-cgi
Submitted: 2005-05-10 10:11 UTC
From: rosier Assigned: mike
Status: Closed Package: HTTP
PHP Version: 4.3.10 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 : 27 - 10 = ?

 
 [2005-05-10 10:11 UTC] rosier
Description: ------------ Under linux running PHP in CGI-mode absoluteURI() loses the directory path, returning http://domain.tld/script.php instead of http://domain.tld/path/script.php This is caused on line 323 of HTTP.php v1.3.5 ($Id: HTTP.php,v 1.42 2005/02/15 19:15:39 mike Exp $) when running PHP in CGI-mode $_SERVER['PATH_INFO'] is an empty string instead of unset. The result is that the if statement on line 323 evaluates to true. Then $path is set to an empty string because strlen($_SERVER['PATH_INFO']) = 0 on line 324. I don't know if it is an php bug that $_SERVER['PATH_INFO'] is an empty string in CGI-mode, but an fix / workaround is changing line 323 to: if (!empty($_SERVER['PATH_INFO']) && $_SERVER['PHP_SELF'] != $_SERVER['PATH_INFO']) {

Comments

 [2005-05-17 13:20 UTC] mike
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.