From: huoqi29 at 163 dot com Operating system: Linux DevelopWeb 2.6.8-24-smp #1 PHP version: 5.0.3 PHP Bug Type: Sockets related Bug description: I think it's the socket daemon script 's bug
Description: ------------ If you uncomment the '//echo "Bug";' and when you run this script ,you will get the expect result if you don't logout, and when you login and "ps -aux " you can find it. But where you "telnet 127.0.0.1 99999" you can't connect it . Reproduce code: --------------- <?php if(pcntl_fork()){exit;} posix_setsid(); chdir("/"); umask(0); $sock=socket_create(AF_INET,SOCK_STREAM,SOL_TCP); socket_bind($sock,"127.0.0.1",99999); socket_listen($sock); $R=array($sock); while(1) { $T=$R; if($C=socket_select($T,$W=NULL,$E=NULL,0,0)) { foreach($T as $sock2) { if($sock2==$sock) { $client=socket_accept($sock); array_push($R,$client); } else{ //echo "Bug"; //socket_getpeername($sock2,&$add,&$prot); $B=socket_recv($sock2,$Buf,1024,0); if($B==0 || chop($Buf)=="quit" || chop($Buf)=="exit") { $I=array_search($sock2,$R); unset($R[$I]); socket_close($sock2); }else socket_send($sock2,"Hello".$Buf,1024,0); } } } } ?> -- Edit bug report at http://bugs.php.net/?id=32184&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32184&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32184&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32184&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32184&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32184&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32184&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32184&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32184&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32184&r=support Expected behavior: http://bugs.php.net/fix.php?id=32184&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32184&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32184&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32184&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32184&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32184&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32184&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32184&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32184&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32184&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32184&r=mysqlcfg