Skip to content

Commit f63579d

Browse files
bug symfony#27669 [Filesystem] fix file lock on SunOS (fritzmg)
This PR was merged into the 2.8 branch. Discussion ---------- [Filesystem] fix file lock on SunOS | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - See symfony#27668 Commits ------- 7adb641 fix file lock on SunOS
2 parents 749410a + 7adb641 commit f63579d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Filesystem/LockHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ public function lock($blocking = false)
7575
$error = $msg;
7676
});
7777

78-
if (!$this->handle = fopen($this->file, 'r')) {
78+
if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
7979
if ($this->handle = fopen($this->file, 'x')) {
8080
chmod($this->file, 0444);
81-
} elseif (!$this->handle = fopen($this->file, 'r')) {
81+
} elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
8282
usleep(100); // Give some time for chmod() to complete
83-
$this->handle = fopen($this->file, 'r');
83+
$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
8484
}
8585
}
8686
restore_error_handler();

0 commit comments

Comments
 (0)