From 483a384fb1456e24f5f2871bb314965458db110c Mon Sep 17 00:00:00 2001 From: 3Dgoo Date: Tue, 20 Feb 2018 07:47:49 +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. --- code/model/Blog.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/Blog.php b/code/model/Blog.php index 238ddcd..3475e39 100644 --- a/code/model/Blog.php +++ b/code/model/Blog.php @@ -1043,7 +1043,7 @@ class Blog_Controller extends Page_Controller $posts->setPageLength($pageSize); // Set current page - $start = $this->request->getVar($posts->getPaginationGetVar()); + $start = (int)$this->request->getVar($posts->getPaginationGetVar()); $posts->setPageStart($start); return $posts;