From ea1e0ef624790b162935fa93ac2ff315e19653eb Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 8 Mar 2025 15:09:00 +0900 Subject: [PATCH] Enforce types of commonly used variables in board --- modules/board/board.view.php | 15 +++++++-------- modules/document/document.model.php | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/board/board.view.php b/modules/board/board.view.php index 5447fb4f8..3211a8c08 100644 --- a/modules/board/board.view.php +++ b/modules/board/board.view.php @@ -281,8 +281,7 @@ class BoardView extends Board public function dispBoardContentView() { // get the variable value - $document_srl = Context::get('document_srl'); - $page = Context::get('page'); + $document_srl = (int)Context::get('document_srl'); /** * if the document exists, then get the document information @@ -555,8 +554,8 @@ class BoardView extends Board // get the search target and keyword if ($this->grant->view) { - $args->search_target = Context::get('search_target'); - $args->search_keyword = Context::get('search_keyword'); + $args->search_target = (string)Context::get('search_target'); + $args->search_keyword = (string)Context::get('search_keyword'); } if(!$search_option = Context::get('search_option')) @@ -577,12 +576,12 @@ class BoardView extends Board // if the category is enabled, then get the category if($this->module_info->use_category=='Y') { - $args->category_srl = Context::get('category'); + $args->category_srl = (int)Context::get('category'); } // setup the sort index and order index - $args->sort_index = Context::get('sort_index'); - $args->order_type = Context::get('order_type'); + $args->sort_index = (string)Context::get('sort_index'); + $args->order_type = (string)Context::get('order_type'); if(!in_array($args->sort_index, $this->order_target)) { $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order'; @@ -593,7 +592,7 @@ class BoardView extends Board } // set the current page of documents - $document_srl = Context::get('document_srl'); + $document_srl = (int)Context::get('document_srl'); if($document_srl && $this->module_info->skip_bottom_list_for_robot !== 'N' && isCrawler()) { Context::set('page', $args->page = null); diff --git a/modules/document/document.model.php b/modules/document/document.model.php index 917c6ee0f..ea6cd90c3 100644 --- a/modules/document/document.model.php +++ b/modules/document/document.model.php @@ -1449,7 +1449,7 @@ class DocumentModel extends Document $query_id = null; $use_division = false; $search_target = $searchOpt->search_target ?? null; - $search_keyword = trim($searchOpt->search_keyword ?? '') ?: null; + $search_keyword = strval($searchOpt->search_keyword ?? '') ?: null; // search if($search_target && $search_keyword)