Bug #1695: fgets read to few data (1 byte)
| From: | andreas dot rieber at tlc dot de | Date: | Mon, 12 Jul 1999 03:39:16 +0000 |
| Subject: | Bug #1695: fgets read to few data (1 byte) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-8374@lists.php.net to get a copy of this message | ||
From: andreas.rieber@tlc.de
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); */