Bug #82736
closedNesting level too deep - recursive dependency? in Extbase/SignalSlot/Dispatcher.php
100%
Description
When connecting a signal with a slot, being the slot an object instance with complex structure (many nested elements), \TYPO3\CMS\Extbase\SignalSlot\Dispatcher->connect throws the exception:
Fatal error: Nesting level too deep - recursive dependency?
when checking if signal-slot connection already exists:
if (!is_array($this->slots[$signalClassName][$signalName]) || !in_array($slot, $this->slots[$signalClassName][$signalName])) { $this->slots[$signalClassName][$signalName][] = $slot; }
The exceptions occurs at in_array(...), which happens when connecting the second (and next) slot to the same signal.
This happens because slot is not strictly compared when doing the in_array search as mentioned here: https://stackoverflow.com/questions/3834791/fatal-error-nesting-level-too-deep-recursive-dependency
Setting the strict flag on the in_array solves the problem:
if (!is_array($this->slots[$signalClassName][$signalName]) || !in_array($slot, $this->slots[$signalClassName][$signalName], true)) { $this->slots[$signalClassName][$signalName][] = $slot; }
Updated by Gerrit Code Review over 7 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54372
Updated by Gerrit Code Review over 7 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54372
Updated by Georg Ringer over 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 41913e4034f1e40ce9cd8b5ec5577af97865af78.
Updated by David Lobato over 7 years ago
Georg Ringer wrote:
Applied in changeset 41913e4034f1e40ce9cd8b5ec5577af97865af78.
Any hope to see this change soon on 8.7?
Updated by Gerrit Code Review over 7 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55188
Updated by Gerrit Code Review over 7 years ago
Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55189
Updated by Gerrit Code Review over 7 years ago
Patch set 2 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55189
Updated by Georg Ringer about 7 years ago
- Status changed from Under Review to Resolved
Applied in changeset 842ccb7d53923888675275e008a36dd8cead59f6.