#41857 [NEW]: proc_close() sometimes returns 0 but most times returns -1
| From: | charpour at gnet dot gr | Date: | Fri, 29 Jun 2007 20:52:34 +0000 |
| Subject: | #41857 [NEW]: proc_close() sometimes returns 0 but most times returns -1 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-114471@lists.php.net to get a copy of this message | ||
From: charpour at gnet dot gr
Operating system: Debian 4.0 etch/Slackware 10.2.0
PHP version: 5.2.3
PHP Bug Type: Program Execution
Bug description: proc_close() sometimes returns 0 but most times returns -1
Description:
------------
Sometimes proc_close() returns the expected value "0" but most times
returns -1.
Configure command:
'./configure' '--prefix=/usr/local/php5.2' '--with-mysql'
'--with-mysql-sock' '--with-sqlite' '--enable-sqlite-utf8'
'--with-zlib'
'--with-zlib-dir' '--with-bz2'
'--with-config-file-path=/usr/local/php5.2'
'--enable-mbstring' '--enable-sigchild' '--enable-pcntl'
'--enable-shmop'
'--enable-sysvsem' '--enable-cli' '--disable-cgi'
Reproduce code:
---------------
<?php
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "/tmp/error-output.txt", "a")
);
$cwd = '/tmp';
$process = proc_open('ls -lap', $descriptorspec, $pipes, $cwd);
if (is_resource($process)) {
fclose($pipes[0]);
echo stream_get_contents($pipes[1]);
fclose($pipes[1]);
$return_value = proc_close($process);
echo "command returned $return_value\n";
}
?>
Expected result:
----------------
command returned 0.
Actual result:
--------------
command returned 0. or command returned -1.
--
Edit bug report at http://bugs.php.net/?id=41857&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41857&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41857&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41857&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41857&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41857&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41857&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41857&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41857&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41857&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41857&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41857&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41857&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41857&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41857&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41857&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41857&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41857&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41857&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41857&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41857&r=mysqlcfg