Skip to content

Commit

Permalink
Merge pull request #6 from leofeyer/fix/remove-strict-types
Browse files Browse the repository at this point in the history
Make the checks non-strict again
  • Loading branch information
Toflar committed Oct 1, 2021
2 parents 2dccd76 + 77f08b1 commit 1497a59
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
13 changes: 2 additions & 11 deletions core-bundle/src/Resources/contao/drivers/DC_Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -3588,8 +3588,6 @@ protected function treeView()
$topMostRootIds = $this->Database->prepare("SELECT id FROM $table WHERE pid=0 AND id IN (" . implode(',', $this->visibleRootTrails) . ")" . ($this->Database->fieldExists('sorting', $table) ? 'ORDER BY sorting' : ''))
->execute()
->fetchEach('id');

$topMostRootIds = array_map('\intval', $topMostRootIds);
}

// Call a recursive function that builds the tree
Expand Down Expand Up @@ -3838,10 +3836,8 @@ public function ajaxTreeView($id, $level)
*/
protected function generateTree($table, $id, $arrPrevNext, $blnHasSorting, $intMargin=0, $arrClipboard=null, $blnCircularReference=false, $protectedPage=false, $blnNoRecursion=false, $arrFound=array())
{
$id = (int) $id;

// Must be either visible in the root trail or allowed by permissions (or their children)
if (!\in_array($id, $this->visibleRootTrails, true) && !\in_array($id, $this->root, true) && !\in_array($id, $this->rootChildren, true))
if (!\in_array($id, $this->visibleRootTrails) && !\in_array($id, $this->root) && !\in_array($id, $this->rootChildren))
{
return '';
}
Expand Down Expand Up @@ -3982,7 +3978,7 @@ protected function generateTree($table, $id, $arrPrevNext, $blnHasSorting, $intM
}

$label = preg_replace('/\(\) ?|\[] ?|{} ?|<> ?/', '', $label);
$isVisibleRootTrailPage = \in_array($id, $this->visibleRootTrails, true);
$isVisibleRootTrailPage = \in_array($id, $this->visibleRootTrails);

// Call the label_callback ($row, $label, $this)
if (\is_array($GLOBALS['TL_DCA'][$table]['list']['label']['label_callback'] ?? null))
Expand Down Expand Up @@ -6249,11 +6245,6 @@ protected function initRoots()

// Fetch all children of the root
$this->rootChildren = $this->Database->getChildRecords($this->root, $table, $this->Database->fieldExists('sorting', $table));

// Ensure type safety
$this->root = array_map('\intval', $this->root);
$this->visibleRootTrails = array_map('\intval', $this->visibleRootTrails);
$this->rootChildren = array_map('\intval', $this->rootChildren);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ public function getChildRecords($arrParentIds, $strTable, $blnSorting=false, $ar
}
}

return $arrReturn;
return array_map('\intval', $arrReturn);
}

/**
Expand Down

0 comments on commit 1497a59

Please sign in to comment.