Bug #75473 [Csd->Nab]: Strange behavior of file_put_contents

From: Date: Fri, 03 Nov 2017 14:48:20 +0000
Subject: Bug #75473 [Csd->Nab]: Strange behavior of file_put_contents
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212429@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: Closed +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 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] 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

« previous php.bugs (#212429) next »