php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6023 Problem with either fgets or ftell in ISAPI
Submitted: 2000-08-08 10:33 UTC Modified: 2000-10-02 23:03 UTC
From: slords at mail dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 4.0.1pl2 OS: Windows 2000 Pro
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: slords at mail dot com
New email:
PHP Version: OS:

 

 [2000-08-08 10:33 UTC] slords at mail dot com
<? 
  $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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-02 22:28 UTC] sniper@php.net
Have you tried php4.0.2 or latest CVS or snapshot from http://snaps.php.net ??
Does this problem still exist in newer versions?

--Jani
 [2000-10-02 23:03 UTC] sniper@php.net
No feedback. Please upgrade to php4.0.3 when it is released real soon now and reopen this bug report if problem still exists.

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 14:01:30 2024 UTC