public function write(CacheInterface $cache) { $content = $cache->toJson(); $bytesWritten = @file_put_contents($this->file, $content, LOCK_EX); if (false === $bytesWritten) { throw new IOException(sprintf('Failed to write file "%s".', $this->file), 0, null, $this->file); } }
public function write(CacheInterface $cache) { $content = $cache->toJson(); $bytesWritten = @file_put_contents($this->file, $content, LOCK_EX); if (false === $bytesWritten) { $error = error_get_last(); throw new IOException(sprintf('Failed to write file "%s", "%s".', $this->file, $error ? $error['message'] : 'no reason available'), 0, null, $this->file); } }