File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -344,7 +344,9 @@ PHP_FUNCTION(flock)
344
344
345
345
PHP_STREAM_TO_ZVAL (stream , res );
346
346
347
- act = operation & 3 ;
347
+ act = operation & PHP_LOCK_UN ;
348
+ // TODO doesn't this fail if operation is a bitmask with LOCK_NB?
349
+ //if (act != PHP_LOCK_SH && act != PHP_LOCK_EX && act != PHP_LOCK_UN) {
348
350
if (act < 1 || act > 3 ) {
349
351
zend_argument_value_error (2 , "must be either LOCK_SH, LOCK_EX, or LOCK_UN" );
350
352
RETURN_THROWS ();
@@ -354,7 +356,7 @@ PHP_FUNCTION(flock)
354
356
ZEND_TRY_ASSIGN_REF_LONG (wouldblock , 0 );
355
357
}
356
358
357
- /* flock_values contains all possible actions if (operation & 4 ) we won't block on the lock */
359
+ /* flock_values contains all possible actions if (operation & PHP_LOCK_NB ) we won't block on the lock */
358
360
act = flock_values [act - 1 ] | (operation & PHP_LOCK_NB ? LOCK_NB : 0 );
359
361
if (php_stream_lock (stream , act )) {
360
362
if (operation && errno == EWOULDBLOCK && wouldblock ) {
You can’t perform that action at this time.
0 commit comments