From: ipseno at yahoo dot com
Operating system: WIN XP SP3
PHP version: 5.3SVN-2009-09-30 (snap)
PHP Bug Type: Filesystem function related
Bug description: fclose is not enough to dereference file
Description:
------------
fclose is not enough to dereference file
Reproduce code:
---------------
This WORKED before:
.... php code here ....
// The file that the transfer should be written to, $fp is open file
handle in writing(binary) mode
curl_setopt($this->ch, CURLOPT_FILE, $fp);
// Store image to file
curl_exec($this->ch);
// Close /path/temp/image.tmp
fclose($fp);
// HERE IS A CATCH!
rename(/path/temp/image.tmp, /path/temp/image.tmp.png);
Expected result:
----------------
To rename a file
Actual result:
--------------
NOW, it issues error and DOES NOT rename file:
Warning: rename(/path/temp/image.tmp, /path/temp/image.tmp.png)
[function.rename]: No such file or directory in /path/script.php on line
53536440
FIX: adding unset()!
.... php code here ....
unset($fp);
// HERE IS A CATCH!
rename(/path/temp/image.tmp, /path/temp/image.tmp.png);
Problem: In 5.2 it worked without unset($fp); code line!
--
Edit bug report at http://bugs.php.net/?id=49727&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49727&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49727&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49727&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49727&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=49727&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49727&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=49727&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=49727&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=49727&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=49727&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=49727&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=49727&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=49727&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49727&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49727&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49727&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=49727&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=49727&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=49727&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=49727&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=49727&r=mysqlcfg