Bug #1077 Updated: fgets and fgetc require strlen for lengths read

From: Date: Mon, 18 Jan 1999 11:54:21 +0000
Subject: Bug #1077 Updated: fgets and fgetc require strlen for lengths read
Groups: php.dev 
Request: Send a blank email to php-dev+get-3600@lists.php.net to get a copy of this message
ID: 1077 User Update by: timothy@ametro.net Status: Open Bug Type: Misbehaving function Description: fgets and fgetc require strlen for lengths read I am going to let this stand until someone reads it, but I found fread. =) Perhaps that should be linked on the fgetc/fgets pages. This is the only quick way I know to show the problem, but various testing after this reveals that fgetc (and fgets) are the culprits. After you ponder the output, notice that /tmp/b.gif is signifigantly smaller than a.gif. I hex editor reveals that it is exactly number of bytes smaller as the number of NULLS encountered. <?php $fp=fopen("a.gif","r"); $fp2=fopen("/tmp/b.gif","w"); while(!feof($fp)) { echo fputs($fp2,fgetc($fp)); echo "<br>"; } fclose($fp); fclose($fp2); ?> BTW- A patch is welcomed, I am going to try as well, but that part of the code looks a bit hairy, hence the reason it got like that to begin with. Full Bug description available at: http://ca.php.net/bugs.php3?id=1077 -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3600) next »