8000 [Lock] use 'r+' for fopen (fixes issue on Solaris) · symfony/symfony@9c9ae7d · GitHub
[go: up one dir, main page]

Skip to content

Commit 9c9ae7d

Browse files
fritzmgnicolas-grekas
authored andcommitted
[Lock] use 'r+' for fopen (fixes issue on Solaris)
1 parent ff0de67 commit 9c9ae7d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Lock/Store/FlockStore.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ private function lock(Key $key, $blocking)
7979

8080
// Silence error reporting
8181
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
82-
if (!$handle = fopen($fileName, 'r')) {
82+
if (!$handle = fopen($fileName, 'r+') ?: fopen($fileName, 'r')) {
8383
if ($handle = fopen($fileName, 'x')) {
8484
chmod($fileName, 0444);
85-
} elseif (!$handle = fopen($fileName, 'r')) {
85+
} elseif (!$handle = fopen($fileName, 'r+') ?: fopen($fileName, 'r')) {
8686
usleep(100); // Give some time for chmod() to complete
87-
$handle = fopen($fileName, 'r');
87+
$handle = fopen($fileName, 'r+') ?: fopen($fileName, 'r');
8888
}
8989
}
9090
restore_error_handler();

0 commit comments

Comments
 (0)
0