Bug #13974 Updated: file functions fail without trailing slash on urls with only the domain
| From: | derick@php.net | Date: | Thu, 08 Nov 2001 18:06:35 +0000 |
| Subject: | Bug #13974 Updated: file functions fail without trailing slash on urls with only the domain | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-69813@lists.php.net to get a copy of this message | ||
ID: 13974
Updated by: derick
Reported By: pgl@instinct.org
Old Status: Open
Status: Feedback
Bug Type: Filesystem function related
Operating System: FreeBSD 4.3
PHP Version: 4.0.6
New Comment:
This should be fixed, can you try a snapshot from snaps.php.net and report back wheter it works or
not?
Derick
Previous Comments:
------------------------------------------------------------------------
[2001-11-07 06:45:17] pgl@instinct.org
if the trailing slash is left off urls when using fopen(), file() etc, php doesn't open the
location.
eg:
[mini:pgl]:~/public_html/test $ cat fopen.php
#!/usr/local/bin/php -q
<?
$loc = 'http://www.php.net/';
if ($fp = fopen($loc, "r")) echo "opened file\n";
?>
[mini:pgl]:~/public_html/test $ ./fopen.php
opened file
but:
[mini:pgl]:~ $ cat fopen.php
#!/usr/local/bin/php -q
<?
$loc = 'http://www.php.net'; // no trailing
slash
if ($fp = fopen($loc, "r")) echo "opened file\n";
?>
[mini:pgl]:~ $ ./fopen.php
<br>
<b>Warning</b>: fopen("http://www.php.net","r") -
Undefined error: 0 in <b>./fopen.php</b> on line <b>3</b><br>
same with file():
[mini:pgl]:~ $ cat file.php
#!/usr/local/bin/php -q
<?
$loc = 'http://www.php.net/';
echo count(file($loc));
?>
[mini:pgl]:~ $ ./file.php
531
take away the trailing slash:
[mini:pgl]:~ $ ./file.php
<br>
<b>Warning</b>: file("http://www.php.net") - Undefined error: 0 in
<b>./file.php</b> on line <b>3</b><br>
1
[mini:pgl]:~ $ /usr/local/bin/php -v
4.0.6
regards,
Peter Lowe.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13974&edit=1