Cache – FileStorage – Automatic conversion of false to array is deprecated

Robin Martinez
Člen | 89
+
0
-

Ahoj, nedávno se nám u cache na produkci začly objevovat následující chyby u FileStorage cache pro latte:

Automatic conversion of false to array is deprecated

File: .../nette/caching/src/Caching/Storages/FileStorage.php:317

307:            if (!$handle) {
308:                return null;
309:            }
310:
311:            flock($handle, $lock);
312:
313:            $size = (int) stream_get_contents($handle, self::MetaHeaderLen);
314:            if ($size) {
315:                $meta = stream_get_contents($handle, $size, self::MetaHeaderLen);
316:                $meta = unserialize($meta);
317:                $meta[self::File] = $file;
318:                $meta[self::Handle] = $handle;
319:                return $meta;
320:            }

unserialize(): Error at offset 0 of 8281 bytes

File: .../nette/caching/src/Caching/Storages/FileStorage.php:316

306:            $handle = @fopen($file, 'r+b'); // @ - file may not exist
307:            if (!$handle) {
308:                return null;
309:            }
310:
311:            flock($handle, $lock);
312:
313:            $size = (int) stream_get_contents($handle, self::MetaHeaderLen);
314:            if ($size) {
315:                $meta = stream_get_contents($handle, $size, self::MetaHeaderLen);
316:                $meta = unserialize($meta);
317:                $meta[self::File] = $file;
318:                $meta[self::Handle] = $handle;
319:                return $meta;
320:            }

Našel jsem následující témata řešící dosti podobný problém, nicméně jsou 4 roky stará.
https://github.com/…ng/issues/45
https://github.com/…ng/issues/56

Na serveru máme: PHP 8.1.11

composer.json:

	"require": {
		"php-64bit": "^8.1",
		"contributte/console": "0.9.2",
		"contributte/scheduler": "0.7.3",
		"contributte/webpack": "2.2.1",
		"latte/latte": "3.0.4",
		"nette/application": "3.1.8",
		"nette/bootstrap": "3.1.3",
		"nette/caching": "3.1.4",
		"nette/di": "3.0.14",
		"nette/finder": "2.5.4",
		"nette/forms": "3.1.8",
		"nette/http": "3.2.1",
		"nette/security": "3.1.6",
		"nette/utils": "3.2.8",
		"nettrine/cache": "0.3.0",
		"nettrine/dbal": "0.8.0",
		"nettrine/extensions-beberlei": "0.2.0",
		"nettrine/orm": "0.8.3",
		"tracy/tracy": "2.9.5",
	},

Kdyby někdo dokázal poradit čím by to mohlo být, budu rád.

Díky ;)

edit: našel jsem obecně toto: https://wiki.php.net/…cation_false

Editoval Robin Martinez (16. 1. 2023 13:34)

Marek Bartoš
Nette Blogger | 1146
+
+1
-

Automatic conversion of false to array is deprecated

Tahle chyba není relevantní, je to až následek předešlého neúspěchu

unserialize(): Error at offset 0 of 8281 bytes

Tohle znamená, že data v cache jsou chybná. Ideálně si tedy data v cache zkontrolovat a zjistit, co je s nimi špatně.
Může jít o rozdílný encoding, před každou serializovanou hodnotou je zapsána její délka.
Chyba se ti ukazuje na offset 0, mohlo by tedy jít i o nějaký prázdný znak.

Robin Martinez
Člen | 89
+
-1
-
  1. je mi jasný, jen jsem to sem radši dal komplet.
  2. ta cache není ‚naše‘, je přímo od Latte, tedy je něco špatně v Nette/Latte

Editoval Robin Martinez (17. 1. 2023 6:23)