- Issue created by @adam-vessey
- 🇳🇿New Zealand quietone
Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies → .
Attempting to acquire a lock non-blockingly from a LocalStream
stream-wrapper file handle will always report success, despite failing to acquire a lock.
https://www.drupal.org/project/drupal/issues/1308054#comment-6774742 →
calls into question the direct return TRUE;
while highlighting disconnects between in the upstream PHP documentation (for which I have raised https://github.com/php/doc-en/issues/4299 )
In one process, acquire a lock on a stream-wrapped file and sleep; for example:
$file = fopen('temporary://testfile', 'cb');
var_dump(flock($file, LOCK_SH));
sleep(600);
In a second process attempt to acquire an exclusive lock non-blockingly (LOCK_EX | LOCK_NB
) on the same file in another process, and output the result and $would_block
values.
$file = fopen('temporary://testfile', 'cb');
$would_block = FALSE;
var_dump(flock($file, LOCK_EX | LOCK_NB, $would_block));
var_dump($would_block);
Expected behavior: The second process should report that it failed to acquire the lock and that it would block.
Actual behavior: The second process reports that it acquired the lock without blocking.
One or both of:
LocalStream::stream_lock()
to be aware of the non-blocking modesLocalStream::stream_lock()
to return FALSE;
Active
11.1 🔥
file system
Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies → .