[BUGFIX] Use strict flag in signalslot dispatcher 72/54372/3
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 12 Oct 2017 07:03:30 +0000 (09:03 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Thu, 12 Oct 2017 13:26:30 +0000 (15:26 +0200)
To avoid exceptions with complex structures, the strict flag
must be used in the in_array check.

Resolves: #82736
Releases: master, 8.7, 7.6
Change-Id: I3ecf859e3e3cc70ab40b10ef9052d46e8b486957
Reviewed-on: https://review.typo3.org/54372
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php

index bfe3d9b..d1cdcbb 100644 (file)
@@ -90,7 +90,9 @@ class Dispatcher implements \TYPO3\CMS\Core\SingletonInterface
             'object' => $object,
             'passSignalInformation' => $passSignalInformation === true
         ];
-        if (!is_array($this->slots[$signalClassName][$signalName]) || !in_array($slot, $this->slots[$signalClassName][$signalName])) {
+        // The in_array() comparision needs to be strict to avoid potential issues
+        // with complex objects being registered as slot.
+        if (!is_array($this->slots[$signalClassName][$signalName]) || !in_array($slot, $this->slots[$signalClassName][$signalName], true)) {
             $this->slots[$signalClassName][$signalName][] = $slot;
         }
     }