Skip to content

Commit 97f24da

Browse files
committed
Convert request params to int and string
1 parent d5ac63a commit 97f24da

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

Block/Search/PostList.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PostList extends \Magefan\Blog\Block\Post\PostList
2121
*/
2222
public function getQuery()
2323
{
24-
return urldecode($this->getRequest()->getParam('q'));
24+
return (string)urldecode($this->getRequest()->getParam('q'));
2525
}
2626

2727
/**

Controller/Author/View.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function execute()
4949
*/
5050
protected function _initAuthor()
5151
{
52-
$id = $this->getRequest()->getParam('id');
52+
$id = (int)$this->getRequest()->getParam('id');
5353

5454
$author = $this->_objectManager->create(\Magefan\Blog\Api\AuthorInterface::class)->load($id);
5555

Controller/Category/View.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function execute()
6262
*/
6363
protected function _initCategory()
6464
{
65-
$id = $this->getRequest()->getParam('id');
65+
$id = (int)$this->getRequest()->getParam('id');
6666
$storeId = $this->_storeManager->getStore()->getId();
6767

6868
$category = $this->_objectManager->create(\Magefan\Blog\Model\Category::class)->load($id);

Controller/Post/View.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public function execute()
6262
*/
6363
protected function _initPost()
6464
{
65-
$id = $this->getRequest()->getParam('id');
66-
$secret = $this->getRequest()->getParam('secret');
65+
$id = (int)$this->getRequest()->getParam('id');
66+
$secret = (string)$this->getRequest()->getParam('secret');
6767
$storeId = $this->_storeManager->getStore()->getId();
6868

6969
$post = $this->_objectManager->create(\Magefan\Blog\Model\Post::class)->load($id);

Controller/Tag/View.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function execute()
4545
*/
4646
protected function _initTag()
4747
{
48-
$id = $this->getRequest()->getParam('id');
48+
$id = (int)$this->getRequest()->getParam('id');
4949

5050
$tag = $this->_objectManager->create(\Magefan\Blog\Model\Tag::class)->load($id);
5151

0 commit comments

Comments
 (0)