[BUGFIX] 500 error in access log 92/44492/2
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 2 Nov 2015 22:46:32 +0000 (17:46 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 3 Nov 2015 14:58:14 +0000 (15:58 +0100)
Issue a Bad Request (400) exception when some argument is missing or invalid.

Resolves: #66194
Change-Id: I2dd9e02f62be5f9cf58816456a52763634eab052
Reviewed-on: https://review.typo3.org/44492
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
ChangeLog
Classes/Utility/EidUtility.php

index aff3e2d..3ed562d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2015-11-02  Stanislas Rolland  <typo(arobas)sjbr.ca>
 
        * Resolves #70917: An end brace is in excess in TS setup.
+       * Resolves #66194: 500 error in access log
 
 2015-10-11  Stanislas Rolland  <typo3@sjbr.ca>
 
index c60ff09..abdf356 100644 (file)
@@ -25,6 +25,7 @@ namespace SJBR\SrFreecap\Utility;
  * This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use TYPO3\CMS\Core\Error\Http\BadRequestException;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\VersionNumberUtility;
 
@@ -126,7 +127,11 @@ class EidUtility {
                $response = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response');
                /* @var $dispatcher \TYPO3\CMS\Extbase\Mvc\Dispatcher */
                $dispatcher = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Dispatcher');
-               $dispatcher->dispatch($request, $response);
+               try {
+                       $dispatcher->dispatch($request, $response);
+               } catch (\Exception $e) {
+                       throw new BadRequestException('An argument is missing or invalid', 1394587024);
+               }
                if ($GLOBALS ['TSFE']->fe_user) {
                        $GLOBALS ['TSFE']->fe_user->storeSessionData();
                }
@@ -240,6 +245,8 @@ class EidUtility {
                        } else if (GeneralUtility::_GP('amp;' . $argument)) {
                                // Something went wrong...
                                $this->requestArguments[$argument] = GeneralUtility::_GP('amp;' . $argument);
+                       } else if ($argument !== 'arguments') {
+                               throw new BadRequestException('An argument is missing', 1394587023);
                        }
                }
        }