#51109 [Fbk->Opn]: Filesys functions write duplicate output

From: Date: Mon, 22 Feb 2010 05:30:45 +0000
Subject: #51109 [Fbk->Opn]: Filesys functions write duplicate output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-147937@lists.php.net to get a copy of this message
ID: 51109 User updated by: animatorboy at verizon dot net Reported By: animatorboy at verizon dot net -Status: Feedback +Status: Open Bug Type: Filesystem function related Operating System: Linux PHP Version: 5.2.12 New Comment: 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? Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#147937) next »