PHP 4.0 Bug #6023: Problem with either fgets or ftell in ISAPI
| From: | slords at mail dot com | Date: | Tue, 08 Aug 2000 14:33:19 +0000 |
| Subject: | PHP 4.0 Bug #6023: Problem with either fgets or ftell in ISAPI | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-28107@lists.php.net to get a copy of this message | ||
From: slords@mail.com
Operating system: Windows 2000 Pro
PHP version: 4.0.1pl2
PHP Bug Type: Misbehaving function
Bug description: Problem with either fgets or ftell in ISAPI
<?
$file = fopen("C:\Test.Txt", "w");
fputs($file, "0123456789\r\n");
fputs($file, "0123456789\r\n");
fclose($file);
$file = fopen("C:\Test.Txt", "r+");
$line = fgets($file, 1024);
echo ftell($file)."<P>";
echo strlen($line)."<P>";
fseek($file, ftell($file) - strlen($line));
fputs($file, "test");
fclose($file);
echo "Done";
?>
The code above produces different outputs depending on if php.exe or php4isapi.dll is run. Both
create a file with 2 lines with 0-9 on a line. The php.exe will then back up and overwrite the 0-3,
but the php4isapi.dll will back up and overwrite the 1-4.
Output of pgp.exe
=================
12<P>12<P>Done
Output of php4isapi.dll
=======================
13<P>12<P>Done
This bug has been reproduced on Windows 95/98/NT/2000 and on version 4.0, 4.0.1, 4.0.1pl1, 4.0.1pl2.