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.
This commit is contained in:
3Dgoo 2018-02-20 07:47:49 +10:30 committed by GitHub
parent 4810e73278
commit 483a384fb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1043,7 +1043,7 @@ class Blog_Controller extends Page_Controller
$posts->setPageLength($pageSize); $posts->setPageLength($pageSize);
// Set current page // Set current page
$start = $this->request->getVar($posts->getPaginationGetVar()); $start = (int)$this->request->getVar($posts->getPaginationGetVar());
$posts->setPageStart($start); $posts->setPageStart($start);
return $posts; return $posts;