diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index a26546a..0a3eb60 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -8,6 +8,7 @@ Yii Framework 2 Change Log - Bug #6940: `yii\web\Response::sendContentAsFile()` may not send correct `content-length` header (sadgnome) - Bug #6969: `yii\helpers\ArrayHelper::htmlEncode()` and `htmlDecode()` should not remove non-string data (qiangxue) - Bug #7037: `yii\console\controllers\AssetController` now correctly handles relative image URLs if source and target CSS are under same directory (klimov-paul) +- Bug #7074: `yii\data\ArrayDataProvider` did not correctly handle the case `Pagination::pageSize = 0` (kirsenn, qiangxue) - Enh #5663: Added support for using `data-params` to specify additional form data to be submitted via the `data-method` approach (usualdesigner, qiangxue) - Enh #6106: Added ability to specify `encode` for each item of `yii\widgets\Breadcrumbs` (samdark, aleksanderd) - Enh #6493: Added support for the `Access-Control-Expose-Headers` header by `yii\filters\Cors` (usualdesigner) diff --git a/framework/data/ArrayDataProvider.php b/framework/data/ArrayDataProvider.php index b951753..7365dd4 100644 --- a/framework/data/ArrayDataProvider.php +++ b/framework/data/ArrayDataProvider.php @@ -80,7 +80,10 @@ class ArrayDataProvider extends BaseDataProvider if (($pagination = $this->getPagination()) !== false) { $pagination->totalCount = $this->getTotalCount(); - $models = array_slice($models, $pagination->getOffset(), $pagination->getLimit()); + + if ($pagination->getPageSize() > 0) { + $models = array_slice($models, $pagination->getOffset(), $pagination->getLimit()); + } } return $models; diff --git a/framework/data/Pagination.php b/framework/data/Pagination.php index 940752e..4f519f0 100644 --- a/framework/data/Pagination.php +++ b/framework/data/Pagination.php @@ -203,7 +203,8 @@ class Pagination extends Object implements Linkable * Returns the number of items per page. * By default, this method will try to determine the page size by [[pageSizeParam]] in [[params]]. * If the page size cannot be determined this way, [[defaultPageSize]] will be returned. - * @return integer the number of items per page. + * @return integer the number of items per page. If it is less than 1, it means the page size is infinite, + * and thus a single page contains all items. * @see pageSizeLimit */ public function getPageSize()