This is probably simple to fix. They go something like this:
NOTICE: wp-content/object-cache.php:111 - Undefined index: add
which is caused by this line:
Because you start
++ing the ‘add’ index without initializing it. The @ even implies that you know this generates errors. Unfortunately WP_DEBUG does not abide the @ trick and still shows the notice in Debug Bar at the top of every screen.
At the top of the object you define stats thus:
var $stats = array();
Why not add the stats indices there?
var $stats = array('get' => 0, 'delete' => 0, 'add' => 0);
The only difference I can see when doing it that way is that when the stats method is called (e.g. in the Object Cache section of debug bar) you see the 0 value for Delete rather than having it be missing if there are no deletes, which is more useful IMHO:
Alternately, you could just add some
isset($this->stats['add'])action to the three places where you use the stats property and initialize the keys there if they are missing.
Thanks for considering this, WP_DEBUG is good for everybody.
- The topic ‘APC Object Cache Backend causes WP_DEBUG notices for Undefined index:’ is closed to new replies.