Bug #75473 [Nab]: Strange behavior of file_put_contents
| From: | testreal at i dot ua | Date: | Sat, 12 Dec 2020 13:32:07 +0000 |
| Subject: | Bug #75473 [Nab]: Strange behavior of file_put_contents | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231039@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
User updated by: testreal at i dot ua
Reported by: testreal at i dot ua
Summary: Strange behavior of file_put_contents
Status: Not a bug
Type: Bug
Package: Filesystem function related
Operating System: Windows 7
PHP Version: 7.1.11
Block user comment: N
Private report: N
New Comment:
I change my email
Previous Comments:
------------------------------------------------------------------------
[2017-11-03 10:18:43] spam2 at rhsoft dot net
what i don't understand is why you did
not run the pretend 2 liner you posted as reproducer isolated and if it's only to be sure it
shows the problem which it didn't
------------------------------------------------------------------------
[2017-11-03 09:55:01] namonexarap at gmail dot com
I found a problem in my program. This is not a PHP bug.
------------------------------------------------------------------------
[2017-11-02 08:47:34] requinix@php.net
Pretty sure you're running it twice.
------------------------------------------------------------------------
[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] testreal at i dot ua
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