From:             Slig at free dot fr
Operating system: linux-64
PHP version:      5CVS-2007-09-16 (snap)
PHP Bug Type:     Streams related
Bug description:  stream_select indicate info readable when no more

Description:
------------
stream_select fails to return the number of modified descriptors.

The bug happen on linux amd64 (tested on a quad core xeon, debian etch
amd64) but not on x86 install (tested on a similar computer but dual core
xeon, debian etch x86).
It seems to happen only when php is built with openssl (i tried many
combinaisons), with php 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, php5 snap, and
also php6 snap.

This bug is the same as #40735 but I am unable to modify the status of
that bug.


I can eventually provide a ssh access to the computer further tests and
debug (ask me by email).

Reproduce code:
---------------
<?php
// replace with your smtp ip if needed, need a tcp server which reply data
immediatly
$handle = fsockopen('tcp://smtp',25);

while(!feof($handle)) {

  $r = array($handle);
  $w = null;
  $e = array($handle);
  $nb = stream_select($r,$w,$e,3);
  echo "select : $nb, r=".count($r).', w='.count($w).',
e='.count($e)."\n";

  while($nb>0){
    echo "Reading...\n";
    $contents = fread($handle,8192);
    echo "Contents: [$contents]\n";

    $r = array($handle);
    $w = null;
    $e = array($handle);
    $nb = stream_select($r,$w,$e,1);
    echo "select : $nb, r=".count($r).', w='.count($w).',
e='.count($e)."\n";
  }

  usleep(20000);
}
fclose($handle);
?>


Expected result:
----------------
select : 1, r=1, w=0, e=0
Reading...
Contents: [220 naxos2.unice.fr ESMTP Sendmail 8.13.1/8.13.1; Sun, 16 Sep
2007 22:23:04 +0200
]
select : 0, r=0, w=0, e=0


Actual result:
--------------
select : 0, r=1, w=0, e=0
select : 0, r=1, w=0, e=0
select : 0, r=1, w=0, e=0
select : 0, r=1, w=0, e=0
select : 0, r=1, w=0, e=0


-- 
Edit bug report at http://bugs.php.net/?id=42682&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42682&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42682&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42682&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42682&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42682&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42682&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42682&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42682&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42682&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42682&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42682&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42682&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42682&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42682&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42682&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42682&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42682&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42682&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42682&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42682&r=mysqlcfg

Reply via email to