humanmade / humanmade/memcache-object-cache

Make sure $notoptions is an array

Open
#8 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
14
Forks
13
PR merge metrics
No merged PRs in 30d

Description

Important before reading the rest of this issue is this - https://core.trac.wordpress.org/ticket/31147

Basically, in the when calling `get_site_option`, it tries to get it out of cache. For some reason it, is returning from cache as something other than a array, which it should be. As the core doesn't do any type checking [here](https://github.com/WordPress/WordPress/blob/master/wp-includes/option.php#L1027), it tries to push something into an variable that isn't an array, causing PHP type errors all over the place.

I know this issue has nothing to do with this dropin, it is an issue with the core. I was wondering if we could fix this in this dropin, as a work around until this bug is patched and for older sites.

Just an idea but if we did something like this in the get function

``` php
if ( preg_match("\d+:notoptions",$id) && $group === 'site-options' && ! is_array($value) ) {
return array();
}
```

It is a little hacky, but might work. Possibly related is [this](https://github.com/humanmade/memcache-object-cache/commit/20f2ae30980a00b0e6e0c3da8d243756664cd950).

Would love the thoughts of @rmccue @joehoyle on this one :smile:

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.