PHP 4.0 Bug #6200: fputs doesn't send, do not fflush after fgets.

From: Date: Wed, 16 Aug 2000 18:02:57 +0000
Subject: PHP 4.0 Bug #6200: fputs doesn't send, do not fflush after fgets.
Groups: php.dev 
Request: Send a blank email to php-dev+get-29171@lists.php.net to get a copy of this message
From: kh.wild@wicom.at Operating system: Linux 2.2.14 PHP version: 4.0.1pl2 PHP Bug Type: Misbehaving function Bug description: fputs doesn't send, do not fflush after fgets. $fd = fsockopen( $server, $port, &$errno, &$errstr ); if( ! $fd ) { print( "Couldn't connect to $server, errno: $errno, errstr: $errstr<br>\n" ); exit; } set_socket_blocking( $fd, false ); $ret = ''; while( ! feof( $fd ) ) { $ret .= fgets( $fd, 128 ); } if( trim( $ret ) <> '' ) { $key = strip_crlf( $ret ); } else { print( "Couldn't get key<br>\n" ); exit; } print( "got key: ---$key---<br>\n" ); $hash = md5( "$passwd.$key" ); $tmp = "$serviceid:$username:$hash"; fputs( $fd, "$tmp\n", strlen( $tmp ) + 1 ); fflush( $fd ); $ret = ''; while( ! feof( $fd ) ) { $r = fgets( $fd, 128 ); print( "-" . $r . "-" ); $ret .= $r; } print( "received id: $ret<br>\n" ); fclose( $fd );

« previous php.dev (#29171) next »