From: n dot escuder at intra-links dot com Operating system: Linux PHP version: 5.1.4 PHP Bug Type: Program Execution Bug description: proc_open let fd opened in the child process
Description: ------------ When executing a program with proc_open the child process that is started by proc_open have all fd's that was opened in the master script ex: file, database connection .... The child process must don't have any fd open expect the fd specified by $descriptorspec. Reproduce code: --------------- <? $fd = fopen("/tmp/test.log", "w"); $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $pipes = null; $process = proc_open("ls /proc/self/fd -l", $descriptorspec, $pipes); while ( ( $line = fgets($pipes[1]) ) ) { echo $line; } proc_close( $process ); fclose($fd ); ?> Expected result: ---------------- total 5 lr-x------ 1 root root 64 2006-06-07 12:44 0 -> pipe:[22573] l-wx------ 1 root root 64 2006-06-07 12:44 1 -> pipe:[22574] l-wx------ 1 root root 64 2006-06-07 12:44 2 -> pipe:[22575] lr-x------ 1 root root 64 2006-06-07 12:44 3 -> /proc/19964/fd Actual result: -------------- total 5 lr-x------ 1 root root 64 2006-06-07 12:44 0 -> pipe:[22573] l-wx------ 1 root root 64 2006-06-07 12:44 1 -> pipe:[22574] l-wx------ 1 root root 64 2006-06-07 12:44 2 -> pipe:[22575] l-wx------ 1 root root 64 2006-06-07 12:44 3 -> /tmp/test.log lr-x------ 1 root root 64 2006-06-07 12:44 4 -> /proc/19964/fd -- Edit bug report at http://bugs.php.net/?id=37726&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37726&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37726&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37726&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37726&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37726&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37726&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37726&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37726&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37726&r=support Expected behavior: http://bugs.php.net/fix.php?id=37726&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37726&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37726&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37726&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37726&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37726&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37726&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37726&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37726&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37726&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37726&r=mysqlcfg