mirror of
https://github.com/php/php-src.git
synced 2024-09-29 05:46:06 +00:00
Merge branch 'master' of https://git.php.net/push/php-src
* 'master' of https://git.php.net/push/php-src: updated NEWS updated NEWS Fixed bug #64770 stream_select() fails with pipes
This commit is contained in:
commit
86fbf51ac1
@ -601,7 +601,7 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t
|
||||
{
|
||||
zval **elem;
|
||||
php_stream *stream;
|
||||
php_socket_t this_fd;
|
||||
php_socket_t this_fd = 0;
|
||||
int cnt = 0;
|
||||
|
||||
if (Z_TYPE_P(stream_array) != IS_ARRAY) {
|
||||
@ -638,7 +638,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
|
||||
zval **elem, **dest_elem;
|
||||
php_stream *stream;
|
||||
HashTable *new_hash;
|
||||
php_socket_t this_fd;
|
||||
php_socket_t this_fd = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (Z_TYPE_P(stream_array) != IS_ARRAY) {
|
||||
|
51
ext/standard/tests/streams/bug64770.phpt
Normal file
51
ext/standard/tests/streams/bug64770.phpt
Normal file
@ -0,0 +1,51 @@
|
||||
--TEST--
|
||||
Bug #64770 stream_select() fails with pipes from proc_open()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$descs = array(
|
||||
0 => array('pipe', 'r'), // stdin
|
||||
1 => array('pipe', 'w'), // stdout
|
||||
2 => array('pipe', 'w'), // strerr
|
||||
);
|
||||
|
||||
$other_opts = array('suppress_errors' => false, 'binary_pipes' => true);
|
||||
|
||||
$p = proc_open('dir', $descs, $pipes, '.', NULL, $other_opts);
|
||||
|
||||
if (is_resource($p)) {
|
||||
$data = '';
|
||||
|
||||
while (1) {
|
||||
$w = $e = NULL;
|
||||
$n = stream_select($pipes, $w, $e, 300);
|
||||
|
||||
if ($n === false) {
|
||||
echo "no streams \n";
|
||||
break;
|
||||
} else if ($n === 0) {
|
||||
echo "process timed out\n";
|
||||
proc_terminate($p, 9);
|
||||
break;
|
||||
} else if ($n > 0) {
|
||||
$line = fread($pipes[1], 8192);
|
||||
if (strlen($line) == 0) {
|
||||
/* EOF */
|
||||
break;
|
||||
}
|
||||
$data .= $line;
|
||||
}
|
||||
}
|
||||
var_dump(strlen($data));
|
||||
|
||||
$ret = proc_close($p);
|
||||
var_dump($ret);
|
||||
} else {
|
||||
echo "no process\n";
|
||||
}
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
int(%d)
|
||||
int(0)
|
||||
==DONE==
|
Loading…
Reference in New Issue
Block a user