Skip to content

Commit

Permalink
Fix an illegal array access in DC_Table when expanding the tree (see #…
Browse files Browse the repository at this point in the history
…2805)

Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #2797 
| Docs PR or issue | -

I split the PR in two commits:
* one that *only* formats the code so that there is any chance of reviewing this:
a1a16fe
* one that applies the fixes:
9bcedb7

(If you want to, I can collapse the whole thing into a oneline-mega-expression again in a third one…)

Commits
-------

a1a16fe format call
9bcedb7 fix illegal array access
2f22b2f collapse expression
  • Loading branch information
m-vo authored and fritzmg committed Mar 4, 2021
1 parent aaa71e1 commit e1f1e8d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core-bundle/src/Resources/contao/drivers/DC_Table.php
Expand Up @@ -3844,7 +3844,7 @@ public function ajaxTreeView($id, $level)

for ($i=0, $c=\count($arrIds); $i<$c; $i++)
{
$return .= ' ' . trim($this->generateTree($table, $arrIds[$i], array('p'=>$arrIds[($i-1)], 'n'=>$arrIds[($i+1)]), $hasSorting, $margin, ($blnClipboard ? $arrClipboard : false), ($id == $arrClipboard['id'] || (\is_array($arrClipboard['id']) && \in_array($id, $arrClipboard['id'])) || (!$blnPtable && !\is_array($arrClipboard['id']) && \in_array($id, $this->Database->getChildRecords($arrClipboard['id'], $table)))), $blnProtected));
$return .= ' ' . trim($this->generateTree($table, $arrIds[$i], array('p'=>($arrIds[$i-1] ?? null), 'n'=>($arrIds[$i+1] ?? null)), $hasSorting, $margin, ($blnClipboard ? $arrClipboard : false), $arrClipboard !== null && ($id == $arrClipboard['id'] || (\is_array($arrClipboard['id']) && \in_array($id, $arrClipboard['id'])) || (!$blnPtable && !\is_array($arrClipboard['id']) && \in_array($id, $this->Database->getChildRecords($arrClipboard['id'], $table)))), $blnProtected));
}

return $return;
Expand Down

0 comments on commit e1f1e8d

Please sign in to comment.