php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12098 fseek bug
Submitted: 2001-07-12 08:07 UTC Modified: 2001-08-19 03:43 UTC
From: volkov at coke dot kmr dot kuzbass dot net Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0.6 OS: Win2000 prof
Private report: No CVE-ID: None
 [2001-07-12 08:07 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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-19 03:43 UTC] sniper@php.net
submitted twice ( Open: #12097 )
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC