1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-20 07:30:16 +01:00

[ticket/14943] Fix template loop access by index

Allows inserting elements in a loop specified as 'outer[3].inner'.
This was coded, but malfunctioning.

PHPBB3-14943
This commit is contained in:
javiexin 2016-12-28 12:37:53 +01:00
parent 3322117c38
commit d9991bdaf1

@ -365,15 +365,15 @@ class context
if ($mode == 'insert')
{
// Make sure we are not exceeding the last iteration
if ($key >= sizeof($this->tpldata[$blockname]))
if ($key >= sizeof($block))
{
$key = sizeof($this->tpldata[$blockname]);
unset($this->tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
$key = sizeof($block);
unset($block[($key - 1)]['S_LAST_ROW']);
$vararray['S_LAST_ROW'] = true;
}
else if ($key === 0)
{
unset($this->tpldata[$blockname][0]['S_FIRST_ROW']);
unset($block[0]['S_FIRST_ROW']);
$vararray['S_FIRST_ROW'] = true;
}