[BUGFIX] Fix signal returns for associated signal arguments 58/31058/2
authorNicole Cordes <typo3@cordes.co>
Sun, 22 Jun 2014 10:36:42 +0000 (12:36 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 22 Jun 2014 16:56:03 +0000 (18:56 +0200)
The call of the dispatcher functions doesn't allow associated signal
arguments as all arguments are passed as parameter to the slot function.
This patch removes all associated signal arguments and uses numeric
arrays.

Resolves: #59794
Releases: 6.3, 6.2
Change-Id: Ie265c6c7dbf4c2b0972d3436164480bb741e15fa
Reviewed-on: https://review.typo3.org/31058
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/documentation/Classes/Controller/DocumentController.php
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php
typo3/sysext/extbase/Classes/Mvc/Dispatcher.php
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ProcessAvailableActionsViewHelper.php
typo3/sysext/install/Classes/Service/SqlExpectedSchemaService.php
typo3/sysext/lang/Classes/Service/UpdateTranslationService.php

index e83965c..b70652c 100644 (file)
@@ -103,8 +103,8 @@ class DocumentController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
                        __CLASS__,
                        'afterInitializeDocuments',
                        array(
-                               'language'  => $language,
-                               'documents' => $documents,
+                               $language,
+                               $documents,
                        )
                );
                return $signalArguments[1];
index 2b443e2..47ace0b 100644 (file)
@@ -337,7 +337,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
         * @param array $preparedArguments
         */
        protected function emitBeforeCallActionMethodSignal(array $preparedArguments) {
-               $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCallActionMethod', array('controllerName' => get_class($this), 'actionMethodName' => $this->actionMethodName, 'preparedArguments' => $preparedArguments));
+               $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCallActionMethod', array(get_class($this), $this->actionMethodName, $preparedArguments));
        }
 
        /**
index 497a4ce..b4ff357 100644 (file)
@@ -80,7 +80,7 @@ class Dispatcher implements \TYPO3\CMS\Core\SingletonInterface {
         * @param ResponseInterface $response
         */
        protected function emitAfterRequestDispatchSignal(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) {
-               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRequestDispatch', array('request' => $request, 'response' => $response));
+               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRequestDispatch', array($request, $response));
        }
 
        /**
index 1634394..88c761f 100644 (file)
@@ -664,7 +664,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
         * @param DomainObjectInterface $object
         */
        protected function emitAfterInsertObjectSignal(DomainObjectInterface $object) {
-               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterInsertObject', array('object' => $object));
+               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterInsertObject', array($object));
        }
 
        /**
@@ -872,7 +872,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
         * @param DomainObjectInterface $object
         */
        protected function emitAfterUpdateObjectSignal(DomainObjectInterface $object) {
-               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterUpdateObject', array('object' => $object));
+               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterUpdateObject', array($object));
        }
 
        /**
@@ -963,7 +963,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
         * @param DomainObjectInterface $object
         */
        protected function emitAfterRemoveObjectSignal(DomainObjectInterface $object) {
-               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRemoveObject', array('object' => $object));
+               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRemoveObject', array($object));
        }
 
        /**
index 69c57b2..a1bec71 100644 (file)
@@ -78,7 +78,7 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ($arguments = func_get_args());
                };
                $this->signalSlotDispatcher->connect('Foo', 'bar', $mockSlot, NULL, FALSE);
-               $this->signalSlotDispatcher->dispatch('Foo', 'bar', array('foo' => 'bar', 'baz' => 'quux'));
+               $this->signalSlotDispatcher->dispatch('Foo', 'bar', array('bar', 'quux'));
                $this->assertSame(array('bar', 'quux'), $arguments);
        }
 
@@ -95,7 +95,7 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->signalSlotDispatcher->_set('objectManager', $mockObjectManager);
                $this->signalSlotDispatcher->_set('isInitialized', TRUE);
                $this->signalSlotDispatcher->connect('Foo', 'emitBar', $slotClassName, 'slot', FALSE);
-               $this->signalSlotDispatcher->dispatch('Foo', 'emitBar', array('foo' => 'bar', 'baz' => 'quux'));
+               $this->signalSlotDispatcher->dispatch('Foo', 'emitBar', array('bar', 'quux'));
                $this->assertSame($mockSlot->arguments, array('bar', 'quux'));
        }
 
@@ -197,7 +197,7 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                        ));
 
                $this->signalSlotDispatcher->connect('Foo', 'emitBar', $mockSlot, 'slot', FALSE);
-               $this->signalSlotDispatcher->dispatch('Foo', 'emitBar', array('foo' => 'bar', 'baz' => 'quux'));
+               $this->signalSlotDispatcher->dispatch('Foo', 'emitBar', array('bar', 'quux'));
        }
 
        /**
@@ -246,7 +246,7 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->signalSlotDispatcher->_set('objectManager', $mockObjectManager);
                $this->signalSlotDispatcher->_set('isInitialized', TRUE);
                $this->signalSlotDispatcher->connect('Foo', 'emitBar', $slotClassName, 'unknownMethodName', TRUE);
-               $this->signalSlotDispatcher->dispatch('Foo', 'emitBar', array('foo' => 'bar', 'baz' => 'quux'));
+               $this->signalSlotDispatcher->dispatch('Foo', 'emitBar', array('bar', 'quux'));
                $this->assertSame($mockSlot->arguments, array('bar', 'quux'));
        }
 
@@ -262,7 +262,7 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->signalSlotDispatcher->connect('SignalClassName', 'methodName', $mockSlot, NULL, TRUE);
                $this->signalSlotDispatcher->_set('objectManager', $mockObjectManager);
                $this->signalSlotDispatcher->_set('isInitialized', TRUE);
-               $this->signalSlotDispatcher->dispatch('SignalClassName', 'methodName', array('foo' => 'bar', 'baz' => 'quux'));
+               $this->signalSlotDispatcher->dispatch('SignalClassName', 'methodName', array('bar', 'quux'));
                $this->assertSame(array('bar', 'quux', 'SignalClassName::methodName'), $arguments);
        }
 
@@ -295,9 +295,9 @@ class DispatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function dispatchReturnsArgumentsArrayAsIsIfSignalIsNotRegistered() {
                $arguments = array(
-                       'argument1' => 42,
-                       'argument2' => 'a string',
-                       'argument3' => new \stdClass()
+                       42,
+                       'a string',
+                       new \stdClass()
                );
                $this->assertSame($arguments, $this->signalSlotDispatcher->dispatch('ClassA', 'emitSomeSignal', $arguments));
        }
index 2d509d5..8bec745 100644 (file)
@@ -254,8 +254,8 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
         * @throws \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
         */
        protected function emitTablesDefinitionIsBeingBuiltSignal($extensionKey) {
-               $signalReturn = $this->signalSlotDispatcher->dispatch(__CLASS__, 'tablesDefinitionIsBeingBuilt', array('sqlString' => array(), 'extensionKey' => $extensionKey));
-               $sqlString = $signalReturn['sqlString'];
+               $signalReturn = $this->signalSlotDispatcher->dispatch(__CLASS__, 'tablesDefinitionIsBeingBuilt', array(array(), $extensionKey));
+               $sqlString = $signalReturn[0];
                if (!is_array($sqlString)) {
                        throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(
                                sprintf(
index fa6e1f6..170ce2f 100644 (file)
@@ -57,8 +57,8 @@ class ProcessAvailableActionsViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Lin
                        __CLASS__,
                        static::SIGNAL_ProcessActions,
                        array(
-                               'extension' => $extension,
-                               'actions' => $actions,
+                               $extension,
+                               $actions,
                        )
                );
                return $signalArguments[1];
index 5bfd1af..d4ba68b 100644 (file)
@@ -86,8 +86,8 @@ class SqlExpectedSchemaService {
         * @return mixed
         */
        protected function emitTablesDefinitionIsBeingBuiltSignal(array $sqlString) {
-               $signalReturn = $this->signalSlotDispatcher->dispatch(__CLASS__, 'tablesDefinitionIsBeingBuilt', array('sqlString' => $sqlString));
-               $sqlString = $signalReturn['sqlString'];
+               $signalReturn = $this->signalSlotDispatcher->dispatch(__CLASS__, 'tablesDefinitionIsBeingBuilt', array($sqlString));
+               $sqlString = $signalReturn[0];
                if (!is_array($sqlString)) {
                        throw new Exception\UnexpectedSignalReturnValueTypeException(
                                sprintf(
index 73b0f77..671b96a 100644 (file)
@@ -202,8 +202,8 @@ class UpdateTranslationService {
                        __CLASS__,
                        'postProcessMirrorUrl',
                        array(
-                               'extensionKey' => $extensionKey,
-                               'mirrorUrl' => $mirrorUrl,
+                               $extensionKey,
+                               $mirrorUrl,
                        )
                );
                return $signalArguments[1];