jani            Tue Apr  8 08:42:05 2008 UTC

  Added files:                 
    /php-src/ext/standard/tests/general_functions       bug44667.phpt 

  Modified files:              
    /php-src/ext/standard       proc_open.c 
  Log:
  - Fixed bug #44667 (proc_open does not handle pipes with the mode "wb" 
correctly)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.60&r2=1.61&diff_format=u
Index: php-src/ext/standard/proc_open.c
diff -u php-src/ext/standard/proc_open.c:1.60 
php-src/ext/standard/proc_open.c:1.61
--- php-src/ext/standard/proc_open.c:1.60       Mon Dec 31 07:12:16 2007
+++ php-src/ext/standard/proc_open.c    Tue Apr  8 08:42:05 2008
@@ -15,7 +15,7 @@
    | Author: Wez Furlong <[EMAIL PROTECTED]>                           |
    +----------------------------------------------------------------------+
  */
-/* $Id: proc_open.c,v 1.60 2007/12/31 07:12:16 sebastian Exp $ */
+/* $Id: proc_open.c,v 1.61 2008/04/08 08:42:05 jani Exp $ */
 
 #if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__))
 # define _BSD_SOURCE           /* linux wants this when XOPEN mode is on */
@@ -600,7 +600,7 @@
                                        goto exit_fail;
                                }
 
-                               if (strcmp(Z_STRVAL_PP(zmode), "w") != 0) {
+                               if (strncmp(Z_STRVAL_PP(zmode), "w", 1) != 0) {
                                        descriptors[ndesc].parentend = 
newpipe[1];
                                        descriptors[ndesc].childend = 
newpipe[0];
                                        descriptors[ndesc].mode |= 
DESC_PARENT_MODE_WRITE;

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/bug44667.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/bug44667.phpt
+++ php-src/ext/standard/tests/general_functions/bug44667.phpt
--TEST--
Bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly)
--SKIPIF--
<?php if (!is_executable('/bin/cat')) echo 'skip cat not found'; ?>
--FILE--
<?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";        

echo "Done\n";

?>
--EXPECTF--
Result is: Hello
Done



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to