mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Fixing non int pagination variable server error
If a user tries to paginate the blog using a value that is not an integer SilverStripe will throw a server error. Example. Visiting `blog/?start=10.1` will cause the following server error: ```You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10.1' at line 8``` This change casts the pagination variable to an int before using it. Note, this fix is for the master branch of the blog for SilverStripe 4.
This commit is contained in:
parent
b79f3db883
commit
517abc6e35
@ -443,7 +443,7 @@ class BlogController extends PageController
|
||||
$posts->setPageLength($pageSize);
|
||||
|
||||
// Set current page
|
||||
$start = $this->request->getVar($posts->getPaginationGetVar());
|
||||
$start = (int)$this->request->getVar($posts->getPaginationGetVar());
|
||||
$posts->setPageStart($start);
|
||||
|
||||
return $posts;
|
||||
|
Loading…
Reference in New Issue
Block a user