[BUGFIX] Fix thrown \InvalidArgumentException in access module 13/54713/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 21 Nov 2017 07:10:55 +0000 (08:10 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 21 Nov 2017 21:39:05 +0000 (22:39 +0100)
The returnUrl is not available if the access module is accessed via
context menu of the page tree. The module now checks whether the
returnUrl is available and renders the close button only in such case.

Resolves: #83053
Releases: master, 8.7
Change-Id: I37c5c65c1505b42acf7ac734fbc7a9f53629a6a1
Reviewed-on: https://review.typo3.org/54713
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/beuser/Classes/Controller/PermissionController.php

index 101c9be..c9c0ee9 100644 (file)
@@ -163,14 +163,16 @@ class PermissionController extends ActionController
 
         if ($currentRequest->getControllerActionName() === 'edit') {
             // CLOSE button:
-            $closeButton = $buttonBar->makeLinkButton()
-                ->setHref($this->returnUrl)
-                ->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:rm.closeDoc'))
-                ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon(
-                    'actions-close',
-                    Icon::SIZE_SMALL
-                ));
-            $buttonBar->addButton($closeButton);
+            if (!empty($this->returnUrl)) {
+                $closeButton = $buttonBar->makeLinkButton()
+                    ->setHref($this->returnUrl)
+                    ->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:rm.closeDoc'))
+                    ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon(
+                        'actions-close',
+                        Icon::SIZE_SMALL
+                    ));
+                $buttonBar->addButton($closeButton);
+            }
 
             // SAVE button:
             $saveButton = $buttonBar->makeInputButton()