|
18 | 18 | use function array_key_exists; |
19 | 19 | use function error_get_last; |
20 | 20 | use function is_array; |
21 | | -use function serialize; |
| 21 | +use function json_decode; |
| 22 | +use function json_encode; |
22 | 23 | use function sha1; |
23 | 24 | use function sprintf; |
24 | 25 | use function strval; |
25 | 26 | use function time; |
26 | | -use function unserialize; |
27 | 27 | use function urlencode; |
28 | 28 |
|
29 | 29 | /** |
@@ -188,7 +188,7 @@ private function getFromCache(string $set, string $entityId): ?array |
188 | 188 | )); |
189 | 189 | } |
190 | 190 |
|
191 | | - $data = unserialize($rawData); |
| 191 | + $data = json_decode($rawData); |
192 | 192 | if ($data === false) { |
193 | 193 | throw new Exception( |
194 | 194 | sprintf('%s: error unserializing cached data from file "%s".', __CLASS__, strval($file)) |
@@ -223,7 +223,7 @@ private function writeToCache(string $set, string $entityId, array $data): void |
223 | 223 | Logger::debug(sprintf('%s: Writing cache [%s] => [%s]', __CLASS__, $entityId, $cacheFileName)); |
224 | 224 |
|
225 | 225 | /** @psalm-suppress TooManyArguments */ |
226 | | - $this->fileSystem->appendToFile($cacheFileName, serialize($data), true); |
| 226 | + $this->fileSystem->appendToFile($cacheFileName, json_encode($data), true); |
227 | 227 | } |
228 | 228 |
|
229 | 229 |
|
@@ -285,7 +285,7 @@ public function getMetaData(string $entityId, string $set): ?array |
285 | 285 | } |
286 | 286 |
|
287 | 287 | if (isset($data)) { |
288 | | - if (array_key_exists('expires', $data) && $data['expires'] < time()) { |
| 288 | + if (array_key_exists('expire', $data) && $data['expire'] < time()) { |
289 | 289 | // metadata has expired |
290 | 290 | $data = null; |
291 | 291 | } else { |
|
0 commit comments