Doc #79993 [NEW]: SplFileObject::flock has LOCK_NB as a valid operation

From: Date: Tue, 18 Aug 2020 21:04:11 +0000
Subject: Doc #79993 [NEW]: SplFileObject::flock has LOCK_NB as a valid operation
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17798@lists.php.net to get a copy of this message
From: girgias Operating system: PHP version: Irrelevant Package: SPL related Bug Type: Documentation Problem Bug description:SplFileObject::flock has LOCK_NB as a valid operation 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 bug report at https://bugs.php.net/bug.php?id=79993&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79993&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79993&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79993&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79993&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79993&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79993&r=support Expected behavior: https://bugs.php.net/fix.php?id=79993&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79993&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79993&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79993&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79993&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79993&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79993&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79993&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79993&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79993&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79993&r=mysqlcfg

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