Merge pull request #7518 from nupplaphil/bug/lock_unlink

Fix Lock-Unlink
This commit is contained in:
Hypolite Petovan 2019-08-15 12:11:01 -04:00 committed by GitHub
commit feb720a3ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,8 +68,10 @@ class SemaphoreLock extends Lock
if (!empty(self::$semaphore[$key])) { if (!empty(self::$semaphore[$key])) {
try { try {
$success = @sem_release(self::$semaphore[$key]) && $success = @sem_release(self::$semaphore[$key]);
unlink(self::keyToFile($key)); if (file_exists(self::keyToFile($key)) && $success) {
$success = unlink(self::keyToFile($key));
}
unset(self::$semaphore[$key]); unset(self::$semaphore[$key]);
$this->markRelease($key); $this->markRelease($key);
} catch (\Exception $exception) { } catch (\Exception $exception) {