From: federico at galassi dot net
Operating system: gentoo linux
PHP version: 5.2.0
PHP Bug Type: Program Execution
Bug description: when used inside a function, proc_open generated pipes are
closed upon return
Description:
------------
When calling proc_open inside the body
of a function, pipes generated don't survive
function's lifespan. resource is still there
but stream is closed.
Reproduce code:
---------------
function foobar() {
$proc = proc_open(
"/usr/bin/php",
array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w')
),
$pipes
);
var_dump($pipes);
return $pipes;
}
$should_be_pipes = foobar();
var_dump($should_be_pipes);
Expected result:
----------------
array(3) {
[0]=>
resource(6) of type (stream)
[1]=>
resource(7) of type (stream)
[2]=>
resource(8) of type (stream)
}
array(3) {
[0]=>
resource(6) of type (stream)
[1]=>
resource(7) of type (stream)
[2]=>
resource(8) of type (stream)
}
Actual result:
--------------
array(3) {
[0]=>
resource(6) of type (stream)
[1]=>
resource(7) of type (stream)
[2]=>
resource(8) of type (stream)
}
array(3) {
[0]=>
resource(6) of type (Unknown)
[1]=>
resource(7) of type (Unknown)
[2]=>
resource(8) of type (Unknown)
}
--
Edit bug report at http://bugs.php.net/?id=39982&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39982&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39982&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39982&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39982&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39982&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39982&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39982&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39982&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39982&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39982&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39982&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39982&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39982&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39982&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39982&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39982&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39982&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39982&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39982&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39982&r=mysqlcfg