ID: 48271
Updated by: [email protected]
Reported By: my dot email dot subscriptions at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: windows xp spIII, Apache 2.2.3
PHP Version: 5.2.9
New Comment:
Your code is not usable, please provide a self contained script,
something like:
$fp = fopen('a.txt');
if (!$fp) die("cannot open a.txt\n");
$bytes = fwrite($fp, 'abc');
if (!$bytes) die("cannot write to a.txt\n");
fclose($fp);
Previous Comments:
------------------------------------------------------------------------
[2009-05-14 02:37:34] my dot email dot subscriptions at gmail dot com
Description:
------------
Using this code I get two files written in my user directory.
$thisFilePointer = fopen( $tempFileName, 'x' );
die;
The first one is the file I named as "thisFile1.png", the second is the
same name plus 1, that is 'someFile2.png', both files are empty.
If I write an image, the first and second files contains two different
images, one is the image I want the other is alike but not the same
content.
If the file is a pdf file, I get two files also but the same content in
both of them.
Reproduce code:
---------------
$thisFile = $pdfFileName . $fileType;
$tempFileName = tempFilesDir . $thisFile;
$thisFilePointer = fopen( $tempFileName, 'x' );
if ( !$thisFilePointer ) {
# Here we prepare the error output into 'userErr';
trigger_error( userErr, E_USER_ERROR );
} //if
$fileHandler = fwrite( $thisFilePointer, $pdfContent );
if ( !$fileHandler ) {
# Here we prepare the error output into 'userErr';
trigger_error( userErr, E_USER_ERROR );
} //if
fclose( $thisFilePointer );
Expected result:
----------------
Get only one file with the desired content.
This did not happened to me under php 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48271&edit=1