#15117 [Com]: fopen and fwrite writes to much data in mode a and a+
| From: | WGFTARE at RET dot DE | Date: | Mon, 30 Jul 2007 13:19:35 +0000 |
| Subject: | #15117 [Com]: fopen and fwrite writes to much data in mode a and a+ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115557@lists.php.net to get a copy of this message | ||
ID: 15117
Comment by: WGFTARE at RET dot DE
Reported By: bitbybit at fibre dot a2000 dot nl
Status: No Feedback
Bug Type: Filesystem function related
Operating System: W2K
PHP Version: 4.1.1
New Comment:
Hi,
'a+' Mode always insert my string two times instead of one time. It
really sucks (i have to use php4 here) and this bug is so annyoing, FIX
IT!
Previous Comments:
------------------------------------------------------------------------
[2002-08-11 01:00:12] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2002-07-10 23:50:59] sniper@php.net
Please try this snapshot:
http://snaps.php.net/win32/php4-win32-latest.zip
------------------------------------------------------------------------
[2002-01-26 00:10:47] webmaster at lxtype dot com
Reproduced it. However, after the first two times, the same code
stopped doing it (I only changed the string?). Seems to be semi-random
at least, or something. Could it be a browser bug, having the page
"accidentally" being submitted/reloaded?
Temporary "fix" is to conditionally open it:
if(!file_exists('orders.txt') || @file_size('orders.txt')==0)
$fp = fopen('orders.txt', 'w');
else
$fp = fopen('orders.txt', 'a');
------------------------------------------------------------------------
[2002-01-20 06:26:27] bitbybit at fibre dot a2000 dot nl
It doesn't really matter with fopen() in append mode. It just opens the
file to append new data to the end of the file. What data will be added,
depents on when(?) and what(?)data the user submitted with the form.
Till that point it goes fine. But then there is this string with same
time mark being added to the file. Ofcourse multiple submitions result
in this same pattern being repeated over and over again.
------------------------------------------------------------------------
[2002-01-20 04:16:40] sander@php.net
Are you sure the file is empty before the fopen() call?
See www.php.net/fopen for some more info...
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/15117
--
Edit this bug report at http://bugs.php.net/?id=15117&edit=1