Skip to content

Commit 6254b25

Browse files
Merge pull request #160 from neo4j-php/suppress_warning
Improve error handling in FileCache by checking fopen result
2 parents 9ca6d23 + ff082a7 commit 6254b25

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/helpers/FileCache.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ public function lock(string $key): bool
192192
{
193193
$this->validateKey($key);
194194

195-
$this->handles[$key] = fopen($this->tempDir . $key, 'c+');
195+
$handle = @fopen($this->tempDir . $key, 'c+');
196+
if ($handle === false) return false;
197+
$this->handles[$key] = $handle;
196198
return flock($this->handles[$key], LOCK_EX);
197199
}
198200

0 commit comments

Comments
 (0)