[BUGFIX] Fix thrown \InvalidArgumentException in access module 18/54718/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 22:10:50 +0000 (23:10 +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/54718
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/beuser/Classes/Controller/PermissionController.php

index b2e1d97..b014ca6 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()