1--TEST--
2Bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly)
3--SKIPIF--
4<?php if (!is_executable('/bin/cat')) echo 'skip cat not found'; ?>
5--FILE--
6<?php
7
8$pipes = array();
9
10$descriptor_spec = array(
11    0 => array('pipe', 'rb'),
12    1 => array('pipe', 'wb'),
13);
14
15$proc = proc_open('cat', $descriptor_spec, $pipes);
16
17fwrite($pipes[0], 'Hello', 5);
18fflush($pipes[0]);
19fclose($pipes[0]);
20
21$result = fread($pipes[1], 5);
22fclose($pipes[1]);
23
24proc_close($proc);
25
26echo "Result is: ", $result, "\n";
27
28echo "Done\n";
29
30?>
31--EXPECT--
32Result is: Hello
33Done
34