Bug #51433 [Com]: file_put_contents() doesn't overwrites a existent file
| From: | imaggens at gmail dot com | Date: | Tue, 30 Mar 2010 11:42:23 +0000 |
| Subject: | Bug #51433 [Com]: file_put_contents() doesn't overwrites a existent file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149186@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51433&edit=1
ID: 51433
Comment by: imaggens at gmail dot com
Reported by: ggens at gmail dot com
Summary: file_put_contents() doesn't overwrites a existent file
Status: Feedback
Type: Bug
Package: Filesystem function related
Operating System: Windows XP SP3
PHP Version: 5.3.2
New Comment:
I don't know how to use CLI, and it's not a Zend Server problem.
Previous Comments:
------------------------------------------------------------------------
[2010-03-30 13:34:40] johannes@php.net
And please use our PHP builds. For support for Zend Server please got to
Zend.
------------------------------------------------------------------------
[2010-03-30 11:16:08] pajoye@php.net
Can you try a small script using CLI?
------------------------------------------------------------------------
[2010-03-30 02:59:56] ggens at gmail dot com
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 this bug report at http://bugs.php.net/bug.php?id=51433&edit=1