[PHP-BUG] Bug #52398 [NEW]: Include() sporadicly fails when is_file()/is_readable() == TRUE

2010-07-21 Thread smiths73v3 at gmail dot com
From: 
Operating system: 
PHP version:  5.3.2
Package:  Filesystem function related
Bug Type: Bug
Bug description:Include() sporadicly fails when is_file()/is_readable() == TRUE 

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 'Include retval='.$retval.'';

if ($retval == '')

{

  echo 'Include failed';



}else

{

  echo 'Include Success';

}

} else 

{

echo 'File not readable';

}

Test script:
---
$path = 'somefile.php';



if (is_readable($path)) 

{

$retval = include $path;

echo 'Include retval='.$retval.'';

if ($retval == '')

{

  echo 'Include failed';



}else

{

  echo 'Include Success';

}

} else 

{

echo 'File not readable';

}

Expected result:

Include Success

Actual result:
--
Include failed

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52398&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52398&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52398&r=trysnapshot53
Try a snapshot (trunk):  
http://bugs.php.net/fix.php?id=52398&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52398&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52398&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52398&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=52398&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=52398&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=52398&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=52398&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=52398&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=52398&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=52398&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52398&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=52398&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=52398&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=52398&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=52398&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=52398&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=52398&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=52398&r=mysqlcfg



Bug #52398 [Com]: Include() sporadicly fails when is_file()/is_readable() == TRUE

2010-07-21 Thread smiths73v3 at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=52398&edit=1

 ID:  52398
 Comment by:  smiths73v3 at gmail dot com
 Reported by: smiths73v3 at gmail dot com
 Summary: Include() sporadicly fails when is_file()/is_readable() ==
  TRUE
 Status:  Open
 Type:Bug
 Package: Filesystem function related
 PHP Version: 5.3.2

 New Comment:

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.


Previous Comments:

[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 'Include retval='.$retval.'';

if ($retval == '')

{

  echo 'Include failed';



}else

{

  echo 'Include Success';

}

} else 

{

echo 'File not readable';

}

Test script:
---
$path = 'somefile.php';



if (is_readable($path)) 

{

$retval = include $path;

echo 'Include retval='.$retval.'';

if ($retval == '')

{

  echo 'Include failed';



}else

{

  echo 'Include Success';

}

} else 

{

echo 'File not readable';

}

Expected result:

Include Success

Actual result:
--
Include failed






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52398&edit=1


Bug #52398 [Bgs]: Include() sporadicly fails when is_file()/is_readable() == TRUE

2010-07-23 Thread smiths73v3 at gmail dot com
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] ahar...@php.net

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 'Include retval='.$retval.'';

if ($retval == '')

{

  echo 'Include failed';



}else

{

  echo 'Include Success';

}

} else 

{

echo 'File not readable';

}

Test script:
---
$path = 'somefile.php';



if (is_readable($path)) 

{

$retval = include $path;

echo 'Include retval='.$retval.'';

if ($retval == '')

{

  echo 'Include failed';



}else

{

  echo 'Include Success';

}

} else 

{

echo 'File not readable';

}

Expected result:

Include Success

Actual result:
--
Include failed






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52398&edit=1