[PHP-DEV] Bug #1695: fgets read to few data (1 byte) From: andreas.rieber <email protected>
Date: 07/11/99

From: andreas.rieber <email protected>
Operating system: Linux (different Types)
PHP version: 3.0.11
PHP Bug Type: Other
Bug description: fgets read to few data (1 byte)

<?
$fp = fsockopen( "localhost", 7); // echo port

fputs( $fp, "12345 this fail 67890\n"); // send data
$string = fgets( $fp, 3); // read first 3 bytes
echo "$string\n"; // echo them
$string = fgets( $fp, 100); // read to LF
echo "$string\n"; // echo

fclose($fp);
?>

With php3.0.9, php3.0.11 it reads only 2 bytes and than byte 3 to LF.

I fix one line and it will work!

functions/fsock.c
615c615
< amount = MIN(amount, maxlen - 1);

---
> 	amount = MIN(amount, maxlen); /*  - 1); */

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>