From: Operating system: Windows XP SP3 PHP version: 5.3.2 Package: Filesystem function related Bug Type: Bug Bug description:file_put_contents() doesn't overwrites a existent file
Description: ------------ PHP Version: 5.3.1 installed from Zend Server CE (This option is not present in dropdown menu) === Begin of Short Script === $file = file_get_contents( 'path/to/my/file' ); // ... if( ! file_put_contents( 'file/to/be/created', $file ) ) { // LOG } === End of Short Script === I've made all necessary routines to grab the content file correctly. If I change the content of file and refresh the page, I can see the changes (with print, echo or var_dump) But, no matter how many times I change the content and I refresh the page, the content of the created file doesn't changes. The only way to overwrite the file is restarting my PC. And the content is only overwritten at the first try. After some tries, I got the same "static" content. And more. Even if I remove the file, manually or by script, the File's Creation Date still the same as the date of the first call of file_put_contents() (currently, 28.03.2010). If I change the name of file to be created, the updated content is created succesfully. Another content change and page refresh, and the created file still with the same content. Test script: --------------- The base script is the Short Script posted above, the difference is, in my files, it is separate in factory and adapter classes. Expected result: ---------------- Well, the existent file with updated content, as in the source file. Actual result: -------------- At the first try, after turn on the computer, the content is updated. All the tries after the first one, he content doesn't changes. -- Edit bug report at http://bugs.php.net/bug.php?id=51433&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51433&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51433&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51433&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51433&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51433&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51433&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51433&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51433&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51433&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51433&r=support Expected behavior: http://bugs.php.net/fix.php?id=51433&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51433&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51433&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51433&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51433&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51433&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51433&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51433&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51433&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51433&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51433&r=mysqlcfg