#24560 [Opn->Asn]: parse_url() missing "host" with file:// scheme
| From: | sniper@php.net | Date: | Wed, 09 Jul 2003 22:11:45 +0000 |
| Subject: | #24560 [Opn->Asn]: parse_url() missing "host" with file:// scheme | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-43581@lists.php.net to get a copy of this message | ||
ID: 24560
Updated by: sniper@php.net
Reported By: tim at digicol dot de
-Status: Open
+Status: Assigned
Bug Type: URL related
Operating System: Red Hat Linux 7.3
PHP Version: 4.3.2
-Assigned To:
+Assigned To: iliaa
New Comment:
Ilia, you have been touching this a lot..
file://localhost/some/path == file:///some/path
ie. They should both produce same path: /some/path ??
(and the // one should have host set too)
(at least that's how I interpret this:
http://www.w3.org/Addressing/URL/4_1_File.html)
Previous Comments:
------------------------------------------------------------------------
[2003-07-09 06:31:06] tim at digicol dot de
Description:
------------
parse_url() now prepends the "path" part with the hostname for
"file://" scheme URLs.
In PHP 4.3.0 and all previous versions we've used (including PHP 3),
"file://localhost/path" produced "[path] => /path".
In 4.3.2, this has become "[path] => localhost/path", which obviously
breaks any code trying to access this on the filesystem.
Please fix this in PHP 4.3.3 to keep backwards compatibility.
(Maybe this has been broken while fixing
http://bugs.php.net/bug.php?id=23445 ?)
Workaround:
Use "file:/path" URLs (not tested under PHP 3).
"file:///path" doesn't work in older PHP versions (PHP 4.0.6 says "PHP
Warning: unable to parse url").
Reproduce code:
---------------
<?php
print_r(parse_url('file://localhost/dir/subdir/file.txt'));
?>
Expected result:
----------------
Array
(
[scheme] => file
[host] => localhost
[path] => /dir/subdir/file.txt
)
Actual result:
--------------
Array
(
[scheme] => file
[path] => localhost/dir/subdir/file.txt
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24560&edit=1