Bug #12097 Updated: fseek bug
| From: | derick@php.net | Date: | Sun, 02 Jun 2002 18:05:33 +0000 |
| Subject: | Bug #12097 Updated: fseek bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9199@lists.php.net to get a copy of this message | ||
ID: 12097
Updated by: derick@php.net
Reported By: volkov@coke.kmr.kuzbass.net
-Status: Open
+Status: Closed
Bug Type: Filesystem function related
Operating System: Win2000 prof
PHP Version: 4.0.6
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2001-07-12 08:04:46] volkov@coke.kmr.kuzbass.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=12097&edit=1