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

From: Date: Fri, 03 Nov 2017 09:55:04 +0000
Subject: Bug #75473 [Fbk->Csd]: Strange behavior of file_put_contents
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212418@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: namonexarap at gmail dot com Reported by: namonexarap at gmail dot com Summary: Strange behavior of file_put_contents -Status: Feedback +Status: Closed 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 found a problem in my program. This is not a PHP bug. Previous Comments: ------------------------------------------------------------------------ [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 (#212418) next »