From: vma1 at abv dot bg
Operating system: Windows XP
PHP version: 5CVS-2004-08-17 (dev)
PHP Bug Type: Filesystem function related
Bug description: file_get_contents() fails with the file:// wrapper
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 bug report at http://bugs.php.net/?id=29723&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29723&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29723&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29723&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29723&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29723&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29723&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29723&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29723&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29723&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29723&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29723&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29723&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29723&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29723&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29723&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29723&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29723&r=float