1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-26 03:01:23 +02:00

Check if file exists on FileStorage (#777)

This commit is contained in:
erikn69
2025-05-08 03:16:00 -05:00
committed by GitHub
parent 61334cf54e
commit 9824065696
2 changed files with 7 additions and 2 deletions

View File

@@ -386,7 +386,7 @@ class DebugBar implements ArrayAccess
$datasets = $stackedData; $datasets = $stackedData;
} }
return $datasets; return array_filter($datasets);
} }
/** /**

View File

@@ -41,7 +41,12 @@ class FileStorage implements StorageInterface
*/ */
public function get($id) public function get($id)
{ {
return json_decode(file_get_contents($this->makeFilename($id)), true); $fileName = $this->makeFilename($id);
if (!file_exists($fileName)) {
return [];
}
return json_decode(file_get_contents($fileName), true);
} }
/** /**