Ask a Question related to PHP Bugs, Design and Development.
-
federico at galassi dot net #1
#39982 [NEW]: when used inside a function, proc_open generated pipes are closed upon return
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 [url]http://bugs.php.net/?id=39982&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39982&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39982&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39982&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39982&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=39982&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=39982&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39982&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=39982&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=39982&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=39982&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=39982&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=39982&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=39982&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39982&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=39982&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=39982&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39982&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=39982&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39982&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39982&r=mysqlcfg[/url]
federico at galassi dot net Guest
-
return() inside eval
This works as needed: #!/usr/local/bin/perl use strict; use Exception::Class( 'Exception' ); sub test() { eval { return( param1 => 'first',... -
#24967 [Bgs]: fopen when placed within a function causes function to return
ID: 24967 User updated by: laurie at oneuponedown dot co dot uk Reported By: laurie at oneuponedown dot co dot uk Status: ... -
#24967 [NEW]: fopen when placed within a function causes function to return
From: laurie at oneuponedown dot co dot uk Operating system: Linux PHP version: 4.3.2 PHP Bug Type: *Directory/Filesystem... -
Photoshp.exe has generated erros and will be closed (PS6.0.1)
Hi! My PS6.0.1 is not inicializing. it appears an dialog box with the message: "Program Error. Photoshp.exe has generated erros and will be... -
Function/Global var to return name of calling function?
I'm sure I saw this somewhere but can't remember where and can't find it now... Is there a PHP function or global variable that will return name... -
tony2001@php.net #2
#39982 [Opn->Bgs]: when used inside a function, proc_open generated pipes are closed upon return
ID: 39982
Updated by: [email]tony2001@php.net[/email]
Reported By: federico at galassi dot net
-Status: Open
+Status: Bogus
Bug Type: Program Execution
Operating System: gentoo linux
PHP Version: 5.2.0
New Comment:
The $pipes are dependant resources of the $proc, so if $proc dies, they
are closed too.
Return both $proc and $pipes and everything will be ok.
Previous Comments:
------------------------------------------------------------------------
[2006-12-29 01:13:24] federico at galassi dot net
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 this bug report at [url]http://bugs.php.net/?id=39982&edit=1[/url]
tony2001@php.net Guest



Reply With Quote

