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

From: Date: Mon, 18 Jan 1999 11:15:56 +0000
Subject: Bug #1077: fgets and fgetc require strlen for lengths read
Groups: php.dev 
Request: Send a blank email to php-dev+get-3597@lists.php.net to get a copy of this message
From: timothy@ametro.net Operating system: linux 2.0.36 PHP version: 3.0.6 PHP Bug Type: Misbehaving function Bug description: fgets and fgetc require strlen for lengths read 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); ?> -- 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 (#3597) next »