Skip to content

Commit e4c93c4

Browse files
authored
[9.x] Cast $perPage to integer on Paginator (#41073)
* Cast $perPage to integer * Apply casting to CursorPaginator as well
1 parent ffe4d6d commit e4c93c4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Illuminate/Pagination/CursorPaginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($items, $perPage, $cursor = null, array $options = [
3737
$this->{$key} = $value;
3838
}
3939

40-
$this->perPage = $perPage;
40+
$this->perPage = (int) $perPage;
4141
$this->cursor = $cursor;
4242
$this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path;
4343

src/Illuminate/Pagination/LengthAwarePaginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct($items, $total, $perPage, $currentPage = null, array
4646
}
4747

4848
$this->total = $total;
49-
$this->perPage = $perPage;
49+
$this->perPage = (int) $perPage;
5050
$this->lastPage = max((int) ceil($total / $perPage), 1);
5151
$this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path;
5252
$this->currentPage = $this->setCurrentPage($currentPage, $this->pageName);

0 commit comments

Comments
 (0)