jani            Tue Apr  8 08:45:52 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/standard/tests/general_functions       bug44667.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/standard       proc_open.c 
  Log:
  MFH: - Fixed bug #44667 (proc_open() does not handle pipes with the mode "wb" 
correctly)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1134&r2=1.2027.2.547.2.1135&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1134 php-src/NEWS:1.2027.2.547.2.1135
--- php-src/NEWS:1.2027.2.547.2.1134    Tue Apr  8 00:03:34 2008
+++ php-src/NEWS        Tue Apr  8 08:45:51 2008
@@ -1,6 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Apr 2008, PHP 5.2.6
+- Fixed bug #44667 (proc_open() does not handle pipes with the mode 'wb'
+  correctly). (Jani)
 - Fixed bug #44591 (imagegif's filename parameter). (Felipe)
 
 03 Apr 2008, PHP 5.2.6RC4
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.18&r2=1.36.2.1.2.19&diff_format=u
Index: php-src/ext/standard/proc_open.c
diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.18 
php-src/ext/standard/proc_open.c:1.36.2.1.2.19
--- php-src/ext/standard/proc_open.c:1.36.2.1.2.18      Mon Dec 31 07:20:13 2007
+++ php-src/ext/standard/proc_open.c    Tue Apr  8 08:45:51 2008
@@ -15,7 +15,7 @@
    | Author: Wez Furlong <[EMAIL PROTECTED]>                           |
    +----------------------------------------------------------------------+
  */
-/* $Id: proc_open.c,v 1.36.2.1.2.18 2007/12/31 07:20:13 sebastian Exp $ */
+/* $Id: proc_open.c,v 1.36.2.1.2.19 2008/04/08 08:45:51 jani Exp $ */
 
 #if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__))
 # define _BSD_SOURCE           /* linux wants this when XOPEN mode is on */
@@ -624,7 +624,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