php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51109 Filesys functions write duplicate output
Submitted: 2010-02-22 04:59 UTC Modified: 2010-02-22 05:37 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: animatorboy at verizon dot net Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.2.12 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: animatorboy at verizon dot net
New email:
PHP Version: OS:

 

 [2010-02-22 04:59 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-22 05:21 UTC] 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 05:30 UTC] 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:37 UTC] rasmus@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 03:01:33 2024 UTC