From 84b6c2cea1bfc90917db2bdc506c3b6410c1c4b9 Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <a.fernandez@scripting-base.de>
Date: Mon, 9 Oct 2017 15:36:31 +0200
Subject: [PATCH] [BUGFIX] Record list: Fix condition for unlimited records
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch fixes a condition that fails when a CSV export in the record
list is requested. The maximum limit of records is set, if `$iLimit` is
larger than 0 to avoid a `LIMIT 0` query.

Resolves: #82710
Related: #81651
Releases: master
Change-Id: I49779e4fa4b31e44d5457f90939e6f96a41e497b
Reviewed-on: https://review.typo3.org/54341
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stephan Großberndt <stephan@grossberndt.de>
Reviewed-by: Henning Liebe <h.liebe@neusta.de>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
---
 typo3/sysext/backend/Classes/View/PageLayoutView.php            | 2 +-
 .../Classes/RecordList/AbstractDatabaseRecordList.php           | 2 +-
 .../sysext/recordlist/Classes/RecordList/DatabaseRecordList.php | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php
index c213a82048d7..71890a344cf6 100644
--- a/typo3/sysext/backend/Classes/View/PageLayoutView.php
+++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php
@@ -3370,7 +3370,7 @@ class PageLayoutView implements LoggerAwareInterface
             'maxResults' => $this->iLimit ?: null
         ];
 
-        if ($this->iLimit !== null) {
+        if ($this->iLimit > 0) {
             $queryBuilder->setMaxResults($this->iLimit);
         }
 
diff --git a/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php b/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php
index 3ad9905bf3fe..381b521a8423 100644
--- a/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php
+++ b/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php
@@ -775,7 +775,7 @@ class AbstractDatabaseRecordList extends AbstractRecordList
             'maxResults' => $this->iLimit ?: null
         ];
 
-        if ($this->iLimit !== null) {
+        if ($this->iLimit > 0) {
             $queryBuilder->setMaxResults($this->iLimit);
         }
 
diff --git a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
index a187875a938a..4acf609c4a29 100644
--- a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
+++ b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
@@ -3151,7 +3151,7 @@ class DatabaseRecordList
             'maxResults' => $this->iLimit ?: null
         ];
 
-        if ($this->iLimit !== null) {
+        if ($this->iLimit > 0) {
             $queryBuilder->setMaxResults($this->iLimit);
         }
 
-- 
GitLab