Req #81322 [NEW]: file_put_contents should support LOCK_NB
| From: | divinity76 at gmail dot com | Date: | Mon, 02 Aug 2021 12:46:34 +0000 |
| Subject: | Req #81322 [NEW]: file_put_contents should support LOCK_NB | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-235525@lists.php.net to get a copy of this message | ||
From: divinity76 at gmail dot com
Operating system:
PHP version: Next Minor Version
Package: *Directory/Filesystem functions
Bug Type: Feature/Change Request
Bug description:file_put_contents should support LOCK_NB
Description:
------------
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:
---------------
<?php
$file=__FILE__;
$fp=fopen($file,"rb");
flock($fp,LOCK_EX);
var_dump(file_put_contents($file,"test",LOCK_EX|LOCK_NB));
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
--
Edit bug report at https://bugs.php.net/bug.php?id=81322&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81322&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81322&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81322&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81322&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81322&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81322&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81322&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81322&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81322&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81322&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81322&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81322&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81322&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81322&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81322&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81322&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81322&r=mysqlcfg