humanmade / humanmade/memcache-object-cache

Make sure $notoptions is an array

Aperta
#8 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
PHP
Stelle
14
Fork
13
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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:

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia leggendo la funzione get del drop-in insieme alla gestione di get_site_option in wp-includes/option.php di WordPress, quindi esamina il ticket del core collegato e il commit correlato. Determina se il valore di cache notoptions delle opzioni del sito può essere normalizzato in sicurezza e conferma che la soluzione alternativa previene gli errori di tipo PHP segnalati senza modificare altri valori memorizzati nella cache.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
php
Ambito
backend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.