Edit report at http://bugs.php.net/bug.php?id=52398&edit=1
ID: 52398
User updated by: smiths73v3 at gmail dot com
Reported by: smiths73v3 at gmail dot com
Summary: Include() sporadicly fails when is_file()/is_readable()
== TRUE
Status: Bogus
Type: Bug
Package: Filesystem function related
PHP Version: 5.3.2
New Comment:
I agree this does look like an environment thing, however there is
evidence to
the contrary.
"is_readable()" for the file succeeds immediately prior to the include
failure.
A simple rollback from 5.3 to 5.2 resolved the issue, nothing else was
changed
in the environment. Many other includes function properly without any
issues, so
this is not as simple as 1:5 includes fails. There must be some other
contributing factor. I suspected an fd shortage, but increasing the fds
and
checking the environment showed this was not the case.
Previous Comments:
------------------------------------------------------------------------
[2010-07-23 12:27:55] [email protected]
This seems fairly unlikely to be a PHP bug. One in five includes
failing on 5.3 installs would result in an awful lot of bug
reports. :)
I'd suggest following this up with one of the support channels,
although a wild guess would be that one of your FastCGI instances
is getting its environment or working directory clobbered somehow.
------------------------------------------------------------------------
[2010-07-22 02:38:02] smiths73v3 at gmail dot com
The failure generates the following output in the lighttpd error log
when debug.log-request-handling = "enable"
-------------------
2010-07-18 23:37:29: (mod_fastcgi.c.2711) FastCGI-stderr:
PHP Warning:
include(/var/www/components/com_php/files/special_include.php):
failed to open stream: No such file or directory in
/var/www/components/com_php/php.php on line 50
-------------------
Downgrading the system to 5.2.10 (karmic) is a workaround for the issue.
------------------------------------------------------------------------
[2010-07-22 02:30:35] smiths73v3 at gmail dot com
Description:
------------
Running Joomla with lighttpd, fastcgi, mysql.
About 1 in 5 loads of alternating pages, an error is encountered where
is_readable($path) is true, but the include fails. The file system has
plenty of space, the file does exist, permissions are correct, and
the file is loaded successfully the other 4 times.
The code snippet below will sometimes fail with "Include failed"
and then a subsequent reload of the page will succeed with "Include
Success"
-----------------------------
$path = 'somefile.php';
if (is_readable($path))
{
$retval = include $path;
echo '<span class="note">Include retval='.$retval.'</span>';
if ($retval == '')
{
echo '<span class="note">Include failed</span>';
}else
{
echo '<span class="note">Include Success</span>';
}
} else
{
echo '<span class="note">File not readable</span>';
}
Test script:
---------------
$path = 'somefile.php';
if (is_readable($path))
{
$retval = include $path;
echo '<span class="note">Include retval='.$retval.'</span>';
if ($retval == '')
{
echo '<span class="note">Include failed</span>';
}else
{
echo '<span class="note">Include Success</span>';
}
} else
{
echo '<span class="note">File not readable</span>';
}
Expected result:
----------------
Include Success
Actual result:
--------------
Include failed
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52398&edit=1