#44667 [Asn->Csd]: proc_open does not handle pipes with the mode 'wb' correctly
| From: | jani@php.net | Date: | Tue, 08 Apr 2008 09:47:21 +0000 |
| Subject: | #44667 [Asn->Csd]: proc_open does not handle pipes with the mode 'wb' correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124071@lists.php.net to get a copy of this message | ||
ID: 44667
Updated by: jani@php.net
Reported By: mike at silverorange dot com
-Status: Assigned
+Status: Closed
Bug Type: Program Execution
Operating System: *
PHP Version: 5.2CVS-2008-04-08 (CVS)
Assigned To: jani
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-04-08 08:22:47] jani@php.net
Fixed, need to merge around.
------------------------------------------------------------------------
[2008-04-08 03:21:59] mike at silverorange dot com
Description:
------------
proc_open.c checks if the mode parameter != "w" instead of checking the
first character of the mode parameter. This prevents the mode 'wb' from
working properly.
Reproduce code:
---------------
<?php
$pipes = array();
$descriptor_spec = array(
0 => array('pipe', 'rb'),
1 => array('pipe', 'wb'),
);
$proc = proc_open('cat', $descriptor_spec, $pipes);
fwrite($pipes[0], 'Hello', 5);
fflush($pipes[0]);
fclose($pipes[0]);
$result = fread($pipes[1], 5);
fclose($pipes[1]);
proc_close($proc);
echo "Result is: ", $result, "\n";
?>
Expected result:
----------------
Result is: Hello
Actual result:
--------------
on stderr:
cat: write error: Bad file descriptor
on stdout:
Result is:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44667&edit=1