WPIntell

Source evidence

Undefined array key

Memcached Redux · support · 2024-08-30T18:19:00+00:00

complaintsentiment
mediumseverity
0.81relevance
0replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 31 rows with source links

16.1% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

26 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
Mikel King unresolved
When working on WPCLI on WP Engine we have been seeing thousands of these notices since we upgraded to PHP8.2. PHP Warning: Undefined array key "get" in /nas/content/live/haymarketwp/wp-content/object-cache.php on line 348 Warning: Undefined array key "get" in /nas/content/live/haymarketwp/wp-content/object-cache.php on line 348 PHP Warning: Undefined array key "miss" in /nas/content/live/haymarketwp/wp-content/object-cache.php on line 351 Warning: Undefined array key "miss" in /nas/content/live/haymarketwp/wp-content/object-cache.php on line 351 PHP Warning: Undefined array key "add" in /nas/content/live/haymarketwp/wp-content/object-cache.php on line 237 Warning: Undefined array key "add" in /nas/content/live/haymarketwp/wp-content/object-cache.php on line 237 The remediation solution is simple and I have patched the file. At line 236: if ( false !== $result ) { $this->stats['add'] = $this->stats['add'] ?? 0; ++$this->stats['add']; $this->group_ops[$group][] = "add $id"; $this->cache[$key] = $data; } At line 348: if ( $found ) { $this->stats['get'] = $this->stats['get'] ?? 0; ++$this->stats['get']; $this->group_ops[$group][] = "get $id"; } else { $this->stats['miss'] = $this->stats['miss'] ?? 0; ++$this->stats['miss']; } I have confirmed that this plugin is working on all versions up to WordPress 6.5.5 with PHP8.2. The null coalescence in the patch has been available since PHP7.0. If older backward compatibility is required then replacing each null coalescence with the following condition check will also work. if ( ! array_key_exists( 'miss', $this->stats ) ) { $this->stats['miss'] = 0; } Obviously it would be good to completely unpack the stats array and understand where it should be properly initialized in the first place to eliminate all of this extra safety checking, but I needed an immediate resolution to the bloat of error notices. Feel free to ping me in wp slack. Cheers, Mikel The page I need help with: [ log in to see the link]

Comments

0 shown

No comments were stored for this source.