splittingred / Gallery

A Gallery add-on for MODx Revolution.
http://svn.modxcms.com/docs/display/ADDON/Gallery
67 stars 62 forks source link

Gallery Snippet undefined offset at line 114 #297

Open danFWD opened 7 years ago

danFWD commented 7 years ago

At line 114 of the Gallery snippet, under certain circumstances, the $keyBits offset of 1 is undefined:

if (isset($keyBits[0]) && $keyBits[0] === 'thumbTpl') {
 if ($i = (int) $keyBits[1]) $nthTpls[$i] = $scriptProperties[$key];
}

The patch is to add one more conditional:

if (isset($keyBits[0]) && $keyBits[0] === 'thumbTpl' && isset($keyBits[1])) {
 if ($i = (int) $keyBits[1]) $nthTpls[$i] = $scriptProperties[$key];
}

I'm not sure what the underlying cause is, however, it didn't seem to adversely affect the output.