From:             james at jamesreno dot com
Operating system: Debian 5.0.1 (lenny); 2.6.26-2-a
PHP version:      5.2.9
PHP Bug Type:     Unknown/Other Function
Bug description:  PHP FD-Leak - FastCGI + auto_prepend

Description:
------------
PHP leaks file descriptors by not closing the requested file at the end of
request. 

See: http://pastebin.com/m3edccacf

*** REGARDLESS of suhosin being enabled/compiled or disable and NOT
patched, the same problem appears. I have removed suhosin from php and yet
the issue still appears. Please dont just "blame suhosin" and ignore this
fact.

No third-party modules are enabled - apc has been disabled & uninstalled
as well.

This seems like an off-by-one somewhere in relation to the auto_prepend.

removing the auto_prepend statement from the php.ini fixes the problem.

Reproduce code:
---------------
Request http://127.0.0.1/somescript.php

auto_prepend_file = "/tmp/test.php";

#/tmp/test.php
<? include("/tmp/test2.php"); ?>

#/tmp/test2.php
<? echo "hello"; ?>

#/var/www/html/somescript.php
echo " world";

Expected result:
----------------
Output of "hello World";

and PHP should close all of its files it opened.

Actual result:
--------------
Output is proper.

PHP opens:
1) /tmp/test.php
2) /tmp/test2.php
3) /var/www/html/somescript.php

however, php only closes:
1) /tmp/test.php
2) /tmp/test2.php

it does NOT close 3) /var/www/html/somescript.php


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

Reply via email to