PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTTP » HTTP » Bug #3484

absoluteURI() loses directory path

Details

Submitted2005-02-15 17:55 UTC
Frompjswaine at alphazero dot freeserve dot co dot uk
Assignedmike
StatusClosed
PackageHTTP
PHP Version4.3.10
OSWindows
Roadmaps(Not assigned)

Comments

[2005-02-15 17:55 UTC] pjswaine at alphazero dot freeserve dot co dot uk

Description:
------------
Under IIS6 running PHP 4.3.10 absoluteURI() loses the directory path, returning the server name plus file name without anything in-between.

This is caused on line 324 of HTTP.php v1.3.4 when using $_SERVER['PATH_INFO'], which under IIS is exactly the same as $_SERVER['PHP_SELF']. What effectively happens is that $path is set to an empty string.

Reproduce code:
---------------
HTTP.php v1.3.4, line 324:

$path = dirname(substr($_SERVER['PHP_SELF'], 0, -strlen($_SERVER['PATH_INFO'])));

Expected result:
----------------
Dont know what is supposed to happen ordinarily, as I'm not sure what $_SERVER['PATH_INFO'] looks like on other servers. Not set on the Linux/Apache hosting server I use.

Actual result:
--------------
// if $_SERVER['PATH_INFO'] = '/path/to/script.php'
// if $_SERVER['PHP_SELF'] = '/path/to/script.php'

$path = dirname(substr($_SERVER['PHP_SELF'], 0, -strlen($_SERVER['PATH_INFO'])));

// becomes

$path = dirname(substr('/path/to/script.php', 0, -strlen('/path/to/script.php')));

// becomes

$path = dirname(substr('/path/to/script.php', 0, -19));

// becomes

$path = dirname('');

// becomes

$path = '';