|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-08-17 23:45 UTC] 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...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Feb 07 10:00:01 2026 UTC |
The reproduce code should be: file_get_contents ("file://D:\projects\index.tpl");