Skip to content

Warning: array_key_exists() expects parameter 2 to be array, null given #73

@tobiasmuehl

Description

@tobiasmuehl

PHP version: 7.3

Description

Getting these warnings reported in Sentry on some requests. The chance of this error happening is roughly 1%.

image

https://github.com/php-http/cache-plugin/blob/master/src/CachePlugin.php#L150

How to reproduce
Not entirely sure to be honest. Using the PSR16 adapter of https://www.phpfastcache.com/ with the Redis driver, and the Symfony cache adapter to convert PSR16 to PSR6. It only happens on a small subset of requests. I'm wondering if this is a race condition, when the cache item expires in between cache lookups. First call sees if item is in cache, by the time the second call tries to get the data, the item has expired.

Possible Solution

Check $data for null before processing further.

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