PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTTP » HTTP » Bug #3421

HTTP::absoluteURI adds slash to short URLs on Windows

Details

Request #3421HTTP::absoluteURI adds slash to short URLs on Windows
Submitted2005-02-10 01:57 UTC
Frombug at halfempty dot org
Assignedmike
StatusClosed
PackageHTTP
PHP Version4.3.10
OSLinux
Roadmaps(Not assigned)

Comments

[2005-02-10 01:57 UTC] bug at halfempty dot org

Description:
------------
On Windows, dirname() (used by HTTP::absoluteURI) will turn "/index.php" to "\". absoluteURI will in turn take that "\", see that there is no "/" at the end of $path and add one. Right before the method ends, you have a $path of "\/". The strtr call will convert that to "//". The double-slashes will confuse forms, firefox, etc. I believe getting "//" when just a "/" is expected and seen on other platform is a bug.

dirname() very nearly serves its purpose in this method, but eventually fails because we're not looking at paths, we're looking at URLs.

Reproduce code:
---------------
// On Windows
HTTP::absoluteURI('/index.php');

Expected result:
----------------
http://server/index.php

Actual result:
--------------
http://server//index.php