|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37960 file_get_contents() returns false but is_readable() returns true
Submitted: 2006-06-29 10:31 UTC Modified: 2006-06-29 10:37 UTC
From: Assigned:
Status: Not a bug Package: *Web Server problem
PHP Version: 5.1.4 OS: Windows 2000 (Windows NT WEB 5.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
37 - 1 = ?
Subscribe to this entry?

 [2006-06-29 10:31 UTC]
file_get_contents() returns false but is_readable() returns true where file.php is a blank PHP file (0 bytes) with full world writable permissions.

phpinfo() output at

Server API: CGI/FastCGI

Reproduce code:
if (!file_get_contents('file.php'))
	echo 'file_get_contents: false';
	echo 'file_get_contents: true';
<br />
if (!is_readable('file.php'))
	echo 'is_readable: false';
	echo 'is_readable: true';

Expected result:
file_get_contents: true
is_readable: true

Actual result:
file_get_contents: false
is_readable: true


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-29 10:37 UTC]
file_get_contents() returns *empty string* when the target file is empty.
Do you think it should return something else?
Not PHP problem -> bogus.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 21 13:03:33 2021 UTC