#48271 [NEW]: fopen creates two files

From: Date: Thu, 14 May 2009 02:37:35 +0000
Subject: #48271 [NEW]: fopen creates two files
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-137281@lists.php.net to get a copy of this message
From: my dot email dot subscriptions at gmail dot com Operating system: windows xp spIII, Apache 2.2.3 PHP version: 5.2.9 PHP Bug Type: Filesystem function related Bug description: fopen creates two files 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 bug report at http://bugs.php.net/?id=48271&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48271&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48271&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48271&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48271&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48271&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48271&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48271&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48271&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48271&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48271&r=support Expected behavior: http://bugs.php.net/fix.php?id=48271&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48271&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48271&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48271&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48271&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48271&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48271&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48271&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48271&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48271&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48271&r=mysqlcfg

« previous php.bugs (#137281) next »