lbarnaud                Tue Nov  4 00:42:19 2008 UTC

  Added files:                 
    /php-src/ext/standard/tests/streams bug46024.phpt 

  Modified files:              
    /php-src/ext/standard       streamsfuncs.c 
  Log:
  Fixed bug #46024 (stream_select() doesn't return the correct number)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.127&r2=1.128&diff_format=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.127 
php-src/ext/standard/streamsfuncs.c:1.128
--- php-src/ext/standard/streamsfuncs.c:1.127   Thu Oct 30 14:30:02 2008
+++ php-src/ext/standard/streamsfuncs.c Tue Nov  4 00:42:19 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: streamsfuncs.c,v 1.127 2008/10/30 14:30:02 felipe Exp $ */
+/* $Id: streamsfuncs.c,v 1.128 2008/11/04 00:42:19 lbarnaud Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -836,6 +836,12 @@
 
                retval = stream_array_emulate_read_fd_set(r_array TSRMLS_CC);
                if (retval > 0) {
+                       if (w_array != NULL) {
+                               zend_hash_clean(Z_ARRVAL_P(w_array));
+                       }
+                       if (e_array != NULL) {
+                               zend_hash_clean(Z_ARRVAL_P(e_array));
+                       }
                        RETURN_LONG(retval);
                }
        }

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/bug46024.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/streams/bug46024.phpt
+++ php-src/ext/standard/tests/streams/bug46024.phpt
--TEST--
Bug #46024 stream_select() doesn't return the correct number
--SKIPIF--
<?php if (!getenv('TEST_PHP_EXECUTABLE')) die("TEST_PHP_EXECUTABLE not 
defined"); ?>
--FILE--
<?php
$php = getenv('TEST_PHP_EXECUTABLE'); 
$pipes = array();
$proc = proc_open(
        "$php -n -i"
        ,array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'))
        ,$pipes, dirname(__FILE__), array(), array('binary_pipes' => true)
);
var_dump($proc);
if (!$proc) {
        exit(1);
}
$r = array($pipes[1]);
$w = array($pipes[0]);
$e = null;
$ret = stream_select($r, $w, $e, 1);
var_dump($ret === (count($r) + count($w)));
fread($pipes[0], 1);

$r = array($pipes[1]);
$w = array($pipes[0]);
$e = null;
$ret = stream_select($r, $w, $e, 1);
var_dump($ret === (count($r) + count($w)));


foreach($pipes as $pipe) {
        fclose($pipe);
}
proc_terminate($proc);
if (defined('SIGKILL')) {
        proc_terminate($proc, SIGKILL);
} else {
        proc_terminate($proc);
}
proc_close($proc);
?>
--EXPECTF--
resource(%d) of type (process)
bool(true)
bool(true)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to