php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12097 fseek bug
Submitted: 2001-07-12 08:04 UTC Modified: 2002-06-02 14:05 UTC
From: volkov at coke dot kmr dot kuzbass dot net Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.6 OS: Win2000 prof
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: volkov at coke dot kmr dot kuzbass dot net
New email:
PHP Version: OS:

 

 [2001-07-12 08:04 UTC] volkov at coke dot kmr dot kuzbass dot net
function conf_append($file,$in,$top="<?php\r\n",$bottom=");?>")
{
 $ya=file_exists($file)?1:0;
 eval("if(\$ourfile=fopen(\$file,'".($ya?'r':'a')."+b'))
  {".($ya?"fseek(\$ourfile,-strlen(\$bottom),SEEK_END);":"")."
  fwrite(\$ourfile,".(!$ya?"\$top.":"")."\$in.\$bottom);
  fclose(\$ourfile);}");
}
  We can't change pointer file position when we open it 
with 'a+', but may when 'r+'/ So we need for create open with 'a+', and if file exists 'r+'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-02 14:05 UTC] derick@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

This should be fixed with the streams implementation.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 31 23:01:30 2024 UTC