Bug #75473 [Opn->Fbk]: Strange behavior of file_put_contents
| From: | requinix@php.net | Date: | Thu, 02 Nov 2017 08:47:36 +0000 |
| Subject: | Bug #75473 [Opn->Fbk]: Strange behavior of file_put_contents | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212404@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75473&edit=1
ID: 75473
Updated by: requinix@php.net
Reported by: namonexarap at gmail dot com
Summary: Strange behavior of file_put_contents
-Status: Open
+Status: Feedback
Type: Bug
Package: Filesystem function related
Operating System: Windows 7
PHP Version: 7.1.11
Block user comment: N
Private report: N
New Comment:
Pretty sure you're running it twice.
Previous Comments:
------------------------------------------------------------------------
[2017-11-02 08:38:12] samayo at 2itb dot com
This error seems to be working on 7.0 and 7.2 (not tested yet on 7.1)
Can you make sure you are not somehow calling the file twice? use microtime() or other better
methods to check if this is a valid bug
------------------------------------------------------------------------
[2017-11-02 08:21:41] namonexarap at gmail dot com
Description:
------------
See the test script.
Contents of file "my.txt" before running the test script
-------------------------
abc
-------------------------
Test script:
---------------
$data = file_get_contents("my.txt");
$data2 = $data.'Q';
file_put_contents("my.txt", $data2);
Expected result:
----------------
Contents of file "my.txt" after running the test script
-------------------------
abcQ
-------------------------
Actual result:
--------------
Contents of file "my.txt" after running the test script
-------------------------
abcQQ
-------------------------
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75473&edit=1