ID:               27256
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dmitry at koteroff dot ru
-Status:           Open
+Status:           Analyzed
-Bug Type:         Filesystem function related
+Bug Type:         Documentation problem
 Operating System: Windows NT, 2000, XP, 2003
 PHP Version:      4.3.4
 New Comment:

flock() is mandatory under winNT and it's derivatives.  

This is a documentation bug.


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

[2004-02-14 18:48:05] dmitry at koteroff dot ru

Description:
------------
This code does not work on Windows:

 

<?

$f1 = fopen("/tmp/a", "a+b");

flock($f1, LOCK_SH);

$f2 = fopen("/tmp/a", "r+b");

fwrite($f2, "test");

?>

 

It creates zero-length file. On Linux everything is OK.

 

If I delete flock() or call flock($f1, LOCK_UN) just after first
flock(), all works correctly.



Flock() is ADVISORY lock, but it works as mandatory lock. Bad luck.

Reproduce code:
---------------
$f1 = fopen("/tmp/a", "a+b");

flock($f1, LOCK_SH);

$f2 = fopen("/tmp/a", "r+b");

fwrite($f2, "test");



Expected result:
----------------
Create non-empty file.

Actual result:
--------------
Creates empty file.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27256&edit=1

Reply via email to