Bug #51433 [Fbk]: file_put_contents() doesn't overwrites a existent file
| From: | pajoye@php.net | Date: | Tue, 30 Mar 2010 11:59:05 +0000 |
| Subject: | Bug #51433 [Fbk]: file_put_contents() doesn't overwrites a existent file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149188@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
Updated by: pajoye@php.net
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:
And enable the error_reporting and show error as well, as I'm pretty
sure you get a nice error message (permissions or stmg like that).
Alternatively check your error log.
If you don't how to do it, please go to the Zend support forums or to
the PHP general mailing list.
Previous Comments:
------------------------------------------------------------------------
[2010-03-30 13:57:56] pajoye@php.net
Open a console:
cd c:\where\is\php
php.exe yourscript.php
------------------------------------------------------------------------
[2010-03-30 13:42:23] imaggens at gmail dot com
I don't know how to use CLI, and it's not a Zend Server problem.
------------------------------------------------------------------------
[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