#37072 [Opn->Bgs]: Empty file when copying to flocked destination

From: Date: Tue, 18 Apr 2006 14:15:40 +0000
Subject: #37072 [Opn->Bgs]: Empty file when copying to flocked destination
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95936@lists.php.net to get a copy of this message
 ID:               37072
 Updated by:       iliaa@php.net
 Reported By:      wulff at ratatosk dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Filesystem function related
 Operating System: win32 only
 PHP Version:      5.1.2
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

#1 you are trying to copy over a locked file #2 you are trying 
to overwrite a currently open file. Win32 will reject this 
combinatioln on the OS level, not a PHP bug.


Previous Comments:
------------------------------------------------------------------------

[2006-04-13 14:49:39] wulff at ratatosk dot net

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 this bug report at http://bugs.php.net/?id=37072&edit=1


Thread (2 messages)

« previous php.bugs (#95936) next »