Skip to content

Occasional deprecation notices under PHP 8.4 #81

Open
@Marian-Kechlibar

Description

@Marian-Kechlibar

Version: 3.3.1

PHP version: 8.4.1

Bug Description

Warning: unserialize(): Error at offset 0 of 26 bytes in /var/www/html/vendor/nette/caching/src/Caching/Storages/FileStorage.php on line 306

Deprecated: Automatic conversion of false to array is deprecated in /var/www/html/vendor/nette/caching/src/Caching/Storages/FileStorage.php on line 307

Warning: unserialize(): Error at offset 0 of 3 bytes in /var/www/html/vendor/nette/caching/src/Caching/Storages/FileStorage.php on line 306

Deprecated: Automatic conversion of false to array is deprecated in /var/www/html/vendor/nette/caching/src/Caching/Storages/FileStorage.php on line 307

Warning: unserialize(): Error at offset 0 of 26 bytes in /var/www/html/vendor/nette/caching/src/Caching/Storages/FileStorage.php on line 306

Deprecated: Automatic conversion of false to array is deprecated in /var/www/html/vendor/nette/caching/src/Caching/Storages/FileStorage.php on line 307

Notice: Possible problem: you are sending a HTTP header while already having some data in output buffer. Try Tracy\OutputDebugger or send cookies/start session earlier. in /var/www/html/vendor/nette/http/src/Http/Response.php on line 279

Steps To Reproduce

Happens occasionally on my production server, but the problem seems to be syntax-centered. The code around the problem is as follows:


		$size = (int) stream_get_contents($handle, self::MetaHeaderLen);
		if ($size) {
			$meta = stream_get_contents($handle, $size, self::MetaHeaderLen);
			$meta = unserialize($meta);
			$meta[self::File] = $file;
			$meta[self::Handle] = $handle;
			return $meta;
		}

unserialize may return false, in which case the $meta variable shouldn't be be treated as an array. PHP's unserialize is a bit of a cursed function, though. Not very reliable.

Expected Behavior

No warnings.

Possible Solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions