From:             mike at silverorange dot com
Operating system: Irrelevant
PHP version:      5.2CVS-2008-04-08 (CVS)
PHP Bug Type:     Program Execution
Bug description:  proc_open does not handle pipes with the mode 'wb' correctly

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 bug report at http://bugs.php.net/?id=44667&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44667&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44667&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44667&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44667&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44667&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44667&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44667&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44667&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44667&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44667&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44667&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44667&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44667&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44667&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44667&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44667&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44667&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44667&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44667&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44667&r=mysqlcfg

Reply via email to