#29723 [Opn->Csd]: file_get_contents() fails with the file:// wrapper
| From: | tony2001@php.net | Date: | Tue, 31 Aug 2004 11:41:47 +0000 |
| Subject: | #29723 [Opn->Csd]: file_get_contents() fails with the file:// wrapper | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65507@lists.php.net to get a copy of this message | ||
ID: 29723
Updated by: tony2001@php.net
Reported By: vma1 at abv dot bg
-Status: Open
+Status: Closed
Bug Type: Filesystem function related
Operating System: Windows XP
PHP Version: 5CVS-2004-08-17 (dev)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Should be fixed both for 5.1.x & 5.0.x.
Previous Comments:
------------------------------------------------------------------------
[2004-08-19 21:15:41] vma1 at abv dot bg
The reproduce code should be:
file_get_contents ("file://D:\projects\index.tpl");
------------------------------------------------------------------------
[2004-08-17 23:45:25] vma1 at abv dot bg
Description:
------------
When file_get_contents() is used under Windows with the file://
wrapper, it gives the following error:
Warning: file_get_contents() [<function.file-get-contents>]: remote
host file access not supported
The bug is caused by the following code in main/streams/streams.c (for
PHP5-200408171230 it is on line 1457).
if (protocol && path[n+1] == '/' && path[n+2] == '/'
&& path[n+3] !=
'/') {
if (options & REPORT_ERRORS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "remote host file
access not supported, %s", path);
}
return NULL;
}
The condition path[n+3] != '/' works for UNIX filesystems only. On
Windows absolute path does not start with a /, but a drive letter
followed by ":", e.g. D:\projects\...
Reproduce code:
---------------
file_get_contents ("D:\projects\index.tpl");
Expected result:
----------------
No error messages.
Actual result:
--------------
Warning: file_get_contents() [<function.file-get-contents>]: remote
host file access not supported...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29723&edit=1