summaryrefslogtreecommitdiff
path: root/ext/standard/tests/streams/bug72853.phpt
blob: 48bd60e7a62935a4f5e4e66bfcce77fb40c8ccc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--TEST--
Bug #72853 (stream_set_blocking doesn't work)
--SKIPIF--
<?php
if(substr(PHP_OS, 0, 3) == 'WIN' ) {
    die('skip not for windows');
}
?>
--FILE--
<?php

$descs = array(
	0 => array('pipe', 'r'), // stdin
	1 => array('pipe', 'w'), // stdout
);

$p = proc_open("ls", $descs, $pipes, '.', NULL, NULL);

stream_set_blocking($pipes[1], false);
var_dump(stream_get_meta_data($pipes[1]));
stream_set_blocking($pipes[1], true);
while ($outs = fgets($pipes[1], 1024)) {
}
var_dump(stream_get_meta_data($pipes[1]));
proc_close($p);
?>
--EXPECTF--
array(7) {
  ["timed_out"]=>
  bool(false)
  ["blocked"]=>
  bool(false)
  ["eof"]=>
  bool(false)
  ["stream_type"]=>
  string(5) "STDIO"
  ["mode"]=>
  string(1) "r"
  ["unread_bytes"]=>
  int(0)
  ["seekable"]=>
  bool(false)
}
array(7) {
  ["timed_out"]=>
  bool(false)
  ["blocked"]=>
  bool(true)
  ["eof"]=>
  bool(true)
  ["stream_type"]=>
  string(5) "STDIO"
  ["mode"]=>
  string(1) "r"
  ["unread_bytes"]=>
  int(0)
  ["seekable"]=>
  bool(false)
}