Bug #72950 [Opn->Dup]: file_put_contents: LOCK_EX unsupported for userland stream wrappers
| From: | cmb@php.net | Date: | Mon, 02 Aug 2021 12:53:30 +0000 |
| Subject: | Bug #72950 [Opn->Dup]: file_put_contents: LOCK_EX unsupported for userland stream wrappers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235526@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72950&edit=1
ID: 72950
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: file_put_contents: LOCK_EX unsupported for userland
stream wrappers
-Status: Open
+Status: Duplicate
Type: Bug
Package: Filesystem function related
Operating System: *
PHP Version: 7.1Git-2016-08-26 (Git)
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This is actually a duplicate of bug #61201.
Previous Comments:
------------------------------------------------------------------------
[2017-03-02 00:04:36] juliangut at gmail dot com
Using [vfsStream](https://github.com/mikey179/vfsStream) I get the same error (PHP 7.0.15)
Workaround: fopen/flock/fwrite/flock/fclose
------------------------------------------------------------------------
[2016-08-26 16:36:37] cmb@php.net
Description:
------------
When the LOCK_EX flag is passed to file_put_contents() with a
userland stream wrapper URL that supports locking, the function
fails.
This bug has been introduced with commit 17d22a5[1] to fix
bug #44501.
[1] <https://github.com/php/php-src/commit/17d22a5>
Test script:
---------------
See <https://gist.github.com/cmb69/c3492b5f3c827edbe656eac215b1fad0>.
Expected result:
----------------
bool(true)
line1
line2
line3
string(18) "line1
line2
line3
"
string(3) "foo"
Actual result:
--------------
bool(true)
line1
line2
line3
string(18) "line1
line2
line3
"
Warning: file_put_contents(): Exclusive locks may only be set for regular files in
/vagrant/varstream.php on line 118
string(18) "line1
line2
line3
"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72950&edit=1