PHP 'Undefined Offset' Error

Running latest Sage commit (Aug 3, 2015) with WP 4.2.4. I should’ve been checking errors more frequently, so I can’t say how long this error has existed, or if it’s my own fault – a mistype, wrong conditional implementation, etc.

With WP debug enabled, I’m receiving this error:

Notice: Undefined offset: 1 in /Users/me/Sites/mysite/wp-content/themes/sage-master/lib/conditional-tag-check.php on line 31

Any ideas of the cause for error?

Did you try and follow that error and see where it leads you? It’s a pretty direct error message.

We always appreciate when people do some debugging of their own first to help us out and post any potential configuration or modifications they may have made which led to this.

@swalkinshaw If the message is being direct, it still sounds pretty vague to me. Line 31 states list($tag, $args) = $conditional;
It doesn’t specify the line in my template where the problem occurs. I assume it resides in a global part like the head, footer, base.php or functions.php because the error persists on every site post and page. I tried isolating the issue by eliminating or limiting markup on these templates. No success. I’m not asking for someone to solve my problem for me. I’m just wondering what the error exactly means. I’m guessing I wrote an invalid conditional statement somewhere? At this stage I’ve modified the base Sage theme so much it’s difficult to troubleshoot.

@djmtype yes that’s exactly what it means: an invalid conditional statement. Each conditional takes either a single string argument, or an array of two elements. See the docs for examples: https://roots.io/sage/docs/theme-sidebar/

The error you had says that $args doesn’t exist basically. That code only runs if the conditional check you defined is an array so I’d look for any of those that don’t have two elements.

Thanks @swalkinshaw for clarifying. That does help me look for the culprit (I created).