From 517abc6e350c1d2fcd1c525f84c0a6b67a572ca4 Mon Sep 17 00:00:00 2001 From: 3Dgoo Date: Tue, 20 Feb 2018 07:51:03 +1030 Subject: [PATCH] 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. --- src/Model/BlogController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/BlogController.php b/src/Model/BlogController.php index 6af2e62..7972346 100644 --- a/src/Model/BlogController.php +++ b/src/Model/BlogController.php @@ -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;