From: wulff at ratatosk dot net
Operating system: Windows XP SP2
PHP version: 5.1.2
PHP Bug Type: Filesystem function related
Bug description: Empty file when copying to flocked destination
Description:
------------
On Windows, when the destination file in copy() is flocked, the
destination ends up as an empty file.
On linux, the example code works as expected.
Reproduce code:
---------------
// echo foo > foo.txt
// echo bar > bar.txt
$fp = fopen('foo.txt', 'r');
@flock($fp, LOCK_EX);
copy('bar.txt', 'foo.txt');
fclose($fp);
Expected result:
----------------
c:\cat foo.txt bar.txt
foo
bar
Actual result:
--------------
c:\cat foo.txt bar.txt
bar
(File foo.txt is empty.)
--
Edit bug report at http://bugs.php.net/?id=37072&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37072&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=37072&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37072&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37072&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37072&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37072&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37072&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37072&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37072&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37072&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37072&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37072&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37072&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37072&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37072&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37072&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37072&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37072&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37072&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37072&r=mysqlcfg