Bug #75473 [Com]: Strange behavior of file_put_contents
| From: | samayo at 2itb dot com | Date: | Thu, 02 Nov 2017 08:38:34 +0000 |
| Subject: | Bug #75473 [Com]: Strange behavior of file_put_contents | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212403@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
Comment by: samayo at 2itb dot com
Reported by: namonexarap at gmail dot com
Summary: Strange behavior of file_put_contents
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: Windows 7
PHP Version: 7.1.11
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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