Bug: PHP Notice: Undefined index: itunes_type
-
Hey team, updated and got this error in the metabox on a post:
( ! ) Notice: Undefined index: itunes_type in /Users/jer/Sites/dev.gv/wp-content/plugins/powerpress/views/episode-box.php on line 59
Here’s the offending code, which makes it clear how this error arises:
function powerpress_meta_box($object, $box) { [...] $FeedSettings = get_option('powerpress_feed'); $canSetSeason = $FeedSettings['itunes_type'] == 'serial' ? true : false;
I hadn’t upgraded in awhile, so probably my settings are out of date, but clearly a PHP notice isn’t what you want.
Something to ensure the
['itunes_type']
array item is always there, or else just something to account for it’s absence would fix this.This is the code that I’m using to solve this while I wait for the next update:
$canSetSeason = false; if (isset($FeedSettings['itunes_type']) AND ($FeedSettings['itunes_type'] == 'serial')) { $canSetSeason = true; }
I was able to silence the error by updating the setting in: POWERPRESS > FEEDS > APPLE SETTINGS FEED TYPE.
Clearly, that’s not a mandatory setting, so fixing this for people “running on default” will be an easy improvement to the plugin.
Thanks for fixing it in the next version, really appreciate this plugin and all the little bugs like this that you’ve fixed for me in the past.
- The topic ‘Bug: PHP Notice: Undefined index: itunes_type’ is closed to new replies.