Fix #2186 type error when unexpected values are passed to columnList

This commit is contained in:
Kijin Sung 2023-09-26 20:08:08 +09:00
parent a4b49048f3
commit 9ca2c94fe4
3 changed files with 4 additions and 2 deletions

View file

@ -269,7 +269,7 @@ class DB
}
// Force the column list to a numerical array.
$column_list = is_array($column_list) ? array_values($column_list) : array();
$column_list = array_values($column_list);
// Start measuring elapsed time.
$start_time = microtime(true);

View file

@ -144,6 +144,7 @@ function getClass($module_name): ?ModuleObject
function executeQuery($query_id, $args = [], $column_list = [], string $result_type = 'auto', string $result_class = 'stdClass'): Rhymix\Framework\Helpers\DBResultHelper
{
$oDB = Rhymix\Framework\DB::getInstance();
$column_list = is_array($column_list) ? $column_list : [];
return $oDB->executeQuery($query_id, $args, $column_list, $result_type, $result_class);
}
@ -160,6 +161,7 @@ function executeQuery($query_id, $args = [], $column_list = [], string $result_t
function executeQueryArray($query_id, $args = [], $column_list = [], string $result_class = 'stdClass'): Rhymix\Framework\Helpers\DBResultHelper
{
$oDB = Rhymix\Framework\DB::getInstance();
$column_list = is_array($column_list) ? $column_list : [];
return $oDB->executeQuery($query_id, $args, $column_list, 'array', $result_class);
}

View file

@ -291,7 +291,7 @@ class CommentModel extends Comment
$args->statusList = $statusList;
}
$output = executeQuery('comment.getCommentCount', $args, NULL);
$output = executeQuery('comment.getCommentCount', $args);
$total_count = $output->data->count;
return (int) $total_count;