Doc #79993 [Opn->Csd]: SplFileObject::flock has LOCK_NB as a valid operation

From: Date: Tue, 18 Aug 2020 23:28:11 +0000
Subject: Doc #79993 [Opn->Csd]: SplFileObject::flock has LOCK_NB as a valid operation
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17799@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79993&edit=1 ID: 79993 Updated by: phpdocbot@php.net Reported by: girgias@php.net Summary: SplFileObject::flock has LOCK_NB as a valid operation -Status: Open +Status: Closed Type: Documentation Problem Package: SPL related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Automatic comment on behalf of cmb Revision: http://git.php.net/?p=doc/en.git;a=commit;h=5236d760cea563c9f335947a2e511f75815f626b Log: Fix #79993: SplFileObject::flock has LOCK_NB as a valid operation Previous Comments: ------------------------------------------------------------------------ [2020-08-18 21:04:11] girgias@php.net 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(); } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79993&edit=1

« previous php.doc.bugs (#17799) next »