ID:               22199
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Feedback
 Bug Type:         Sockets related
 Operating System: Suse Linux 7.2
 PHP Version:      4CVS-2003-02-12 (stable)
 New Comment:

We need a short script to reproduce this problem, and more
information.

Are your sockets blocking or non-blocking?
Do you check for the case where fgets() returns false?
Do you use socket_set_timeout() (now known as stream_set_timeout())?

Are you 100% sure that your code is correct and follows the IRC
protocol correctly? IRC servers don't send any
data until you have successfully connected (the 5 line script you
provided will just sit and wait for the server to respond, while the
server waits for the script to send data).


Previous Comments:
------------------------------------------------------------------------

[2003-02-13 06:44:24] [EMAIL PROTECTED]

I had it enabled and not. This does not make a difference. Also this is
reproducable. Everytime i change from php 4.2.3 to 4.3.x this start to
happen. Going back to 4.2.3 and everything works smoothly again.

And about that, check your code statement. I actually did check my code
for hours after finally deciding, that this is not my fault. Also it's
hard to make something wrong in 5 lines 5 lines of code.

------------------------------------------------------------------------

[2003-02-13 03:30:35] [EMAIL PROTECTED]

Do you have auto_detect_line_endings enabled in your php.ini?


------------------------------------------------------------------------

[2003-02-12 23:16:08] [EMAIL PROTECTED]

I'm pretty sure you're doing something wrong since I'm using
PHP 4.3.1-dev for running a bot (it uses the PEAR class 'SmartIRC') and
it works just fine. 

Do check your code..


------------------------------------------------------------------------

[2003-02-12 22:16:33] [EMAIL PROTECTED]

I have written a IRC Nickserv/Authserv/Chanserv bot in php. Using a
socket connection to the irc server. After updating from php 4.2.3 to
4.3.1-dev (tried stable version of 7.2 and 13.2) fgets() reacts very
strange.

The main code (very simplified), that produces the error is this:

$sock = fsockopen($ircServer, $ircPort);
while($line = fgets($sock)) {
  echo $line;
}
fclose($sock);

While handshaking and exchanging data between the irc bot and the irc
server there are more than 200 lines of text, that is sent to the bot.
Using PHP 4.2.3 all the lines are displayed. Using PHP 4.3.1-dev only
two lines are returned. The first line of the whole text and a part of
a line inbetween. Nothing else. Also, when a user sends the command:

/join #test,#test1,#test2,#test3

fgets() in PHP 4.3.1-dev only returns /join #test

That is a very strange behavior i must say.

May configuration line:
./configure --prefix=/usr/share --datadir=/usr/share/php
--bindir=/usr/bin --libdir=/usr/share --with-config-file-path=/etc
--with-exec-dir=/usr/lib/php/bin --with-mysql=/usr --with-gd=yes
--enable-gd-native-ttf --enable-gd-imgstrttf --with-tiff-dir=/usr
--with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr/X11R6
--with-ldap=yes --with-zlib=yes --with-bz2 --with-gmp --with-xml
--with-ttf --with-t1lib --with-mcal=/usr --with-imap-ssl=yes
--with-sablot --with-ftp --with-ndbm --with-gdbm --with-mcrypt
--with-gettext --with-gd=yes --enable-versioning --enable-yp
--enable-bcmath --enable-trans-sid --enable-inline-optimization
--enable-track-vars --enable-magic-quotes --enable-safe-mode
--enable-sockets --enable-sysvsem --enable-sysvshm --enable-shmop
--enable-calendar --enable-mbstring --enable-mbstr-enc-trans
--enable-exif --enable-ftp --enable-memory-limit --enable-wddx
--enable-filepro --enable-dbase --enable-ctype --disable-debug
--enable-force-cgi-redirect --enable-discard-path --enable-sigchild


I hope this bug report is in any way usefull =)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22199&edit=1

Reply via email to