|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81322 file_put_contents should support LOCK_NB
Submitted: 2021-08-02 12:46 UTC Modified: -
From: divinity76 at gmail dot com Assigned:
Status: Open Package: *Directory/Filesystem functions
PHP Version: Next Minor Version OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: divinity76 at gmail dot com
New email:
PHP Version: OS:


 [2021-08-02 12:46 UTC] divinity76 at gmail dot com
file_put_contents should support LOCK_NB just like it supports LOCK_EX.

luckily file_put_contents does not currently support any flags with the same value as LOCK_NB( LOCK_NB is 4 and FILE_USE_INCLUDE_PATH is 1 and FILE_APPEND is 8)

Test script:

Expected result:
bool(false) and perhaps some error about being unable to lock.

Actual result:
script hangs indefinitely, because file_put_contents doesn't understand LOCK_NB


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Oct 27 03:03:34 2021 UTC