#12098 [Com]: fseek bug
| From: | chat-teen1258 at hotmail dot com | Date: | Tue, 20 Jul 2004 15:10:10 +0000 |
| Subject: | #12098 [Com]: fseek bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63130@lists.php.net to get a copy of this message | ||
ID: 12098
Comment by: chat-teen1258 at hotmail dot com
Reported By: volkov at coke dot kmr dot kuzbass dot net
Status: Bogus
Bug Type: Filesystem function related
Operating System: Win2000 prof
PHP Version: 4.0.6
New Comment:
<a href=http://a-russian-fighting.da.ru>chat
teen</a>
Previous Comments:
------------------------------------------------------------------------
[2001-08-19 03:43:37] sniper@php.net
submitted twice ( Open: #12097 )
------------------------------------------------------------------------
[2001-07-12 08:07:32] 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+'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12098&edit=1