ID: 22199 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Feedback +Status: Open Bug Type: Sockets related Operating System: Suse Linux 7.2 PHP Version: 4CVS-2003-02-12 (stable) New Comment:
Sockets are set to non-blocking after searching a while in doc after first notice of this problem. Tho it did not effect the main problem i have. If fgets() would return a false, then the while function would stop. This does not happen, so fgets() does not return a false. Yes, i used stream_set_timeout() with php 4.3.x (not needed in 4.2.3) with a timeout of 600 seconds. This is clearly enough, because my server pings every 60s anyway. As already said before, the irc services are 100% working with php 4.2.3 and they are running for over 5 month already. I only updated to 4.3.x and the problems started. First i had to find out, that there are now new functions needed (mainly to set to non-blocking - setting a timeout is not really needed i think), but somehow this did not solve the main problem i had. The code i sent you is ofc much too short, but still it's the main functions that produce the error, none else are needed. All the handshakes and stuff are left away, because of security issues. I'm for sure using correct server2server protocol for my ircd (see above) Previous Comments: ------------------------------------------------------------------------ [2003-02-13 07:22:41] [EMAIL PROTECTED] 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). ------------------------------------------------------------------------ [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