From ee42b4a28951a2630f0b6bc04ccdd2ffb8f73a40 Mon Sep 17 00:00:00 2001 From: Alexander Opitz <opitz.alexander@googlemail.com> Date: Thu, 7 Sep 2017 09:04:47 +0200 Subject: [PATCH] [BUGFIX] PHP7.2: Check value for NULL before count Resolves: #82275 Releases: master, 8.7, 7.6 Change-Id: I77dc811456f4bbd759e28c27284c4652ad09dd23 Reviewed-on: https://review.typo3.org/53938 Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../sysext/backend/Classes/Form/InlineStackProcessor.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/backend/Classes/Form/InlineStackProcessor.php b/typo3/sysext/backend/Classes/Form/InlineStackProcessor.php index 790f93e54882..babd40f0e009 100644 --- a/typo3/sysext/backend/Classes/Form/InlineStackProcessor.php +++ b/typo3/sysext/backend/Classes/Form/InlineStackProcessor.php @@ -221,11 +221,11 @@ class InlineStackProcessor protected function calculateStructureLevel($level) { $result = false; - $inlineStructureCount = count($this->inlineStructure['stable']); + $structureCount = $this->getStructureDepth(); if ($level < 0) { - $level = $inlineStructureCount + $level; + $level = $structureCount + $level; } - if ($level >= 0 && $level < $inlineStructureCount) { + if ($level >= 0 && $level < $structureCount) { $result = $level; } return $result; @@ -259,6 +259,9 @@ class InlineStackProcessor */ public function getStructureDepth() { + if (!isset($this->inlineStructure['stable']) || !is_array($this->inlineStructure['stable'])) { + return 0; + } return count($this->inlineStructure['stable']); } -- GitLab