We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c7ca63 commit b9d9a53Copy full SHA for b9d9a53
src/Caching/Storages/FileStorage.php
@@ -147,16 +147,11 @@ public function lock($key)
147
if ($this->useDirs && !is_dir($dir = dirname($cacheFile))) {
148
@mkdir($dir); // @ - directory may already exist
149
}
150
- $handle = @fopen($cacheFile, 'r+b'); // @ - file may not exist
151
- if (!$handle) {
152
- $handle = fopen($cacheFile, 'wb');
153
154
- return;
155
- }
+ $handle = fopen($cacheFile, 'c+b');
+ if ($handle) {
+ $this->locks[$key] = $handle;
+ flock($handle, LOCK_EX);
156
157
-
158
- $this->locks[$key] = $handle;
159
- flock($handle, LOCK_EX);
160
161
162
0 commit comments