|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-08-18 23:28 UTC] phpdocbot@php.net
[2020-08-18 23:28 UTC] phpdocbot@php.net
-Status: Open
+Status: Closed
[2020-08-18 23:29 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
[2020-08-19 03:05 UTC] phpdocbot@php.net
[2020-12-30 11:59 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 05:00:01 2025 UTC |
Description: ------------ The documentation of SplFileObject::flock specifies that LOCK_NB is a valid operation whereas flock() says that one needs to add this option as a bitmask to the operation argument. As SplFileObject::flock just calls PHP's normal flock function (or at least attempts to) we need to look at its implementation. The behaviour of flock is correctly documented as one can see by the following implementation details (on master) [Note: PHP_LOCK_NB = 4] : /* flock_values contains all possible actions if (operation & 4) we won't block on the lock */ act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0); And it warns/throw (on master) if passed on its own as can be seen: act = operation & 3; if (act < 1 || act > 3) { zend_argument_value_error(2, "must be either LOCK_SH, LOCK_EX, or LOCK_UN"); RETURN_THROWS(); }