bug #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 https://github.com/symfony/symfony/pull/27668
Commits
-------
7adb641d7c
fix file lock on SunOS
This commit is contained in:
commit
f63579d360
@ -75,12 +75,12 @@ class LockHandler
|
||||
$error = $msg;
|
||||
});
|
||||
|
||||
if (!$this->handle = fopen($this->file, 'r')) {
|
||||
if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
|
||||
if ($this->handle = fopen($this->file, 'x')) {
|
||||
chmod($this->file, 0444);
|
||||
} elseif (!$this->handle = fopen($this->file, 'r')) {
|
||||
} elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
|
||||
usleep(100); // Give some time for chmod() to complete
|
||||
$this->handle = fopen($this->file, 'r');
|
||||
$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
|
||||
}
|
||||
}
|
||||
restore_error_handler();
|
||||
|
Reference in New Issue
Block a user