Annotation of embedaddon/php/ext/standard/tests/streams/bug46024.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #46024 stream_select() doesn't return the correct number
! 3: --SKIPIF--
! 4: <?php if (!getenv('TEST_PHP_EXECUTABLE')) die("skip TEST_PHP_EXECUTABLE not defined"); ?>
! 5: --FILE--
! 6: <?php
! 7: $php = realpath(getenv('TEST_PHP_EXECUTABLE'));
! 8: $pipes = array();
! 9: $proc = proc_open(
! 10: "$php -n -i"
! 11: ,array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'))
! 12: ,$pipes, dirname(__FILE__), array(), array('binary_pipes' => true)
! 13: );
! 14: var_dump($proc);
! 15: if (!$proc) {
! 16: exit(1);
! 17: }
! 18: $r = array($pipes[1]);
! 19: $w = array($pipes[0]);
! 20: $e = null;
! 21: $ret = stream_select($r, $w, $e, 1);
! 22: var_dump($ret === (count($r) + count($w)));
! 23: fread($pipes[1], 1);
! 24:
! 25: $r = array($pipes[1]);
! 26: $w = array($pipes[0]);
! 27: $e = null;
! 28: $ret = stream_select($r, $w, $e, 1);
! 29: var_dump($ret === (count($r) + count($w)));
! 30:
! 31:
! 32: foreach($pipes as $pipe) {
! 33: fclose($pipe);
! 34: }
! 35: proc_terminate($proc);
! 36: if (defined('SIGKILL')) {
! 37: proc_terminate($proc, SIGKILL);
! 38: } else {
! 39: proc_terminate($proc);
! 40: }
! 41: proc_close($proc);
! 42: ?>
! 43: --EXPECTF--
! 44: resource(%d) of type (process)
! 45: bool(true)
! 46: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>