Bug #13974 Updated: file functions fail without trailing slash on urls with only the domain

From: Date: Fri, 09 Nov 2001 10:44:13 +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-69866@lists.php.net to get a copy of this message
ID: 13974 User updated by: pgl@instinct.org Reported By: pgl@instinct.org Old Status: Feedback Status: Closed Bug Type: Filesystem function related Operating System: FreeBSD 4.3 PHP Version: 4.0.6 New Comment: works fine now: [mini:pgl]:~ $ /usr/local/bin/php -v 4.2.0-dev [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 opened file regards, Peter Lowe. Previous Comments: ------------------------------------------------------------------------ [2001-11-08 13:06:35] derick@php.net This should be fixed, can you try a snapshot from snaps.php.net and report back wheter it works or not? Derick ------------------------------------------------------------------------ [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

« previous php.dev (#69866) next »