Skip to content

TypeError Phpfastcache\Drivers\Files\Driver::driverRead(): Return value must be of type ?array, bool returned #907

Closed
@Jankyz

Description

@Jankyz

What type of issue is this?

Exception/Error/Warning/Notice/Deprecation

Operating system + version

Linux 5.10.198-187.748.amzn2.x86_64

PHP version

8.0.26

Connector/Database version (if applicable)

No response

Phpfastcache version

9.1.3 ✅

Describe the issue you're facing

I'm being swamped with errors of this kind

TypeError Phpfastcache\Drivers\Files\Driver::driverRead(): Return value must be of type ?array, bool returned

I use Files as a driver
I think that this method has a problem with return from this

    return $this->decode($content);

inside we have

return $value ? \unserialize($value, ['allowed_classes' => true]) : null;

and when data cannot be unserialized then the function returns false

example of invalid serialized object

$content = 'a:1:{s:5:"Test";s:15:"serialize here!";}';

Expected behavior

return should be array|null

  • I have searched over the Wiki

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions