|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-03-30 21:52 UTC] cmb@php.net
-Type: Bug
+Type: Documentation Problem
-Package: Documentation problem
+Package: Filesystem function related
[2015-04-13 19:59 UTC] peehaa@php.net
-Assigned To:
+Assigned To: peehaa
[2017-10-24 06:27 UTC] kalle@php.net
-Status: Assigned
+Status: Open
-Assigned To: peehaa
+Assigned To:
[2020-11-18 15:01 UTC] cmb@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cmb
[2020-11-18 15:01 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 11:00:01 2025 UTC |
Description: ------------ The online documentation states that LOCK_NB to achieve a non-blocking lock-attempt is not supported on windows. The given test script, if started twice, just returns stating that the lock can not be aquired. Therefor, since it does not block, using LOCK_NB seems to work on windows and the documentation should be updated accordingly. If this is not the expected behaviour, the documentation should reflect the possible situations, where using LOCK_NB does indeed not work. Furthermore the statement "The automatic unlocking when the file's resource handle is closed was removed. Unlocking now always has to be done manually." should be checked. My test show that closing the file pointer with fclose() does release the lock. Test script: --------------- <?php $lockfile = 'dummy.lock'; $fp = fopen( $lockfile, 'w+' ); if ( !$fp ) { echo "unable to open lockfile\n"; exit; } if ( !flock( $fp, LOCK_EX | LOCK_NB ) ) { echo "unable to aquire lock\n"; exit; } sleep( 10 ); Expected result: ---------------- According to documentation, script should block (since LOCK_NB is not supported) Actual result: -------------- flock does not block