Skip to content

Commit

Permalink
[9.x] Cast $perPage to integer on Paginator (#41073)
Browse files Browse the repository at this point in the history
* Cast $perPage to integer

* Apply casting to CursorPaginator as well
  • Loading branch information
gdebrauwer authored Feb 17, 2022
1 parent ffe4d6d commit e4c93c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Pagination/CursorPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct($items, $perPage, $cursor = null, array $options = [
$this->{$key} = $value;
}

$this->perPage = $perPage;
$this->perPage = (int) $perPage;
$this->cursor = $cursor;
$this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path;

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Pagination/LengthAwarePaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct($items, $total, $perPage, $currentPage = null, array
}

$this->total = $total;
$this->perPage = $perPage;
$this->perPage = (int) $perPage;
$this->lastPage = max((int) ceil($total / $perPage), 1);
$this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path;
$this->currentPage = $this->setCurrentPage($currentPage, $this->pageName);
Expand Down

0 comments on commit e4c93c4

Please sign in to comment.