[BUGFIX] Only allow QueryResultInterface in Be.PaginateViewHelper 38/58038/5
authorDaniel Goerz <daniel.goerz@posteo.de>
Sat, 25 Aug 2018 12:55:29 +0000 (14:55 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 27 Aug 2018 12:18:31 +0000 (14:18 +0200)
Resolves: #85979
Related: #81200
Releases: master
Change-Id: Ibab30517c6380d1a7fda59656e12700d4193170a
Reviewed-on: https://review.typo3.org/58038
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/fluid/Classes/ViewHelpers/Be/Widget/PaginateViewHelper.php

index 367c814..a40ee07 100644 (file)
@@ -13,9 +13,7 @@ namespace TYPO3\CMS\Fluid\ViewHelpers\Be\Widget;
  *
  * The TYPO3 project - inspiring people to share!
  */
-use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
 use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
-use TYPO3\CMS\Fluid\Core\ViewHelper\Exception;
 
 /**
  * This ViewHelper renders a Pagination of objects for the TYPO3 Backend.
@@ -69,22 +67,16 @@ class PaginateViewHelper extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetView
     public function initializeArguments()
     {
         parent::initializeArguments();
-        $this->registerArgument('objects', 'mixed', 'Object', true);
+        $this->registerArgument('objects', QueryResultInterface::class, 'The QueryResult containing all objects.', true);
         $this->registerArgument('as', 'string', 'as', true);
         $this->registerArgument('configuration', 'array', 'configuration', false, ['itemsPerPage' => 10, 'insertAbove' => false, 'insertBelow' => true, 'maximumNumberOfLinks' => 99]);
     }
 
     /**
-     * @throws Exception
      * @return string
      */
     public function render()
     {
-        $objects = $this->arguments['objects'];
-
-        if (!($objects instanceof QueryResultInterface || $objects instanceof ObjectStorage || is_array($objects))) {
-            throw new Exception('Supplied file object type ' . get_class($objects) . ' must be QueryResultInterface or ObjectStorage or be an array.', 1454510732);
-        }
         return $this->initiateSubRequest();
     }
 }