|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-14 18:56 UTC] gschlossnagle@php.net
[2004-02-14 19:34 UTC] dmitry at koteroff dot ru
[2004-02-14 19:48 UTC] wez@php.net
[2004-02-18 14:49 UTC] nlopess@php.net
[2020-02-07 06:12 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 23:00:01 2025 UTC |
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.