#51109 [Opn->Bgs]: Filesys functions write duplicate output
| From: | rasmus@php.net | Date: | Mon, 22 Feb 2010 05:37:29 +0000 |
| Subject: | #51109 [Opn->Bgs]: Filesys functions write duplicate output | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-147938@lists.php.net to get a copy of this message | ||
ID: 51109
Updated by: rasmus@php.net
Reported By: animatorboy at verizon dot net
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Linux
PHP Version: 5.2.12
New Comment:
None whatsoever. We can't fix something we can't see. And 5.2.6 is
ancient. If you can reliably reproduce it in a current version, let us
know.
Previous Comments:
------------------------------------------------------------------------
[2010-02-22 05:30:45] animatorboy at verizon dot net
I could not believe it either, I have pulling my hair out all day!
Let me try and give a little more information.
This is my server, pretty basic.
/
/dev
/dev/logs/
/public_html/
/public_html/logs/
I have a live version (/public_html/) and a dev server (/dev/). On
the live server the code works great, on the dev server it doesn't.
I sent the code to a friend to see if he could help and his server
started doing the same thing!
I made a small mistake on the PHP version when I submitted, it's 5.2.6
not .12 but I don't think that will make a HUGE difference with this
bug, not that I have any control over it anyway because the host that
is running my site won't update!
Any ideas?
------------------------------------------------------------------------
[2010-02-22 05:21:20] rasmus@php.net
Really? That simple 3-line test write "TEST" twice to the file?
Forget your other code, just run the simple test. I certainly can't
reproduce that here and I am very skeptical that you can reproduce it
with that code as well.
------------------------------------------------------------------------
[2010-02-22 04:59:38] animatorboy at verizon dot net
Description:
------------
When I try to write to a file, whether the file exists or not the text
sent is written twice. I tried using a counter to see if it was
looping
somewhere however it proved that the code was only run once.
Reproduce code:
---------------
$msg = 'TEST';
$fp = ('./logs/somefile.php');
file_put_contents($fp,$msg,FILE_APPEND);
or
$msg = 'TEST';
$fp = fopen('./logs/somefile.php','ab');
flock($fp, LOCK_EX);
fwrite($fp, $msg);
flock($fp, LOCK_UN);
fclose($fp);
Expected result:
----------------
TEST
Actual result:
--------------
TESTEST
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=51109&edit=1