Fix incorrect access to query results

https://xetown.com/questions/1562377
This commit is contained in:
Kijin Sung 2021-04-27 20:52:43 +09:00
parent 583604b845
commit 7af083c6c9

View file

@ -517,7 +517,7 @@ class documentItem extends BaseObject
} }
$args->document_srl = $this->document_srl; $args->document_srl = $this->document_srl;
$output = executeQuery('document.getDocumentVotedLog', $args); $output = executeQuery('document.getDocumentVotedLog', $args);
if($output->data->point) if(isset($output->data) && $output->data->point)
{ {
return $_SESSION['voted_document'][$this->document_srl] = $output->data->point; return $_SESSION['voted_document'][$this->document_srl] = $output->data->point;
} }
@ -557,7 +557,7 @@ class documentItem extends BaseObject
} }
$args->document_srl = $this->document_srl; $args->document_srl = $this->document_srl;
$output = executeQuery('document.getDocumentDeclaredLogInfo', $args); $output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
$declaredCount = intval($output->data->count); $declaredCount = isset($output->data) ? intval($output->data->count) : 0;
if($declaredCount > 0) if($declaredCount > 0)
{ {
return $_SESSION['declared_document'][$this->document_srl] = $declaredCount; return $_SESSION['declared_document'][$this->document_srl] = $declaredCount;
@ -1004,11 +1004,11 @@ class documentItem extends BaseObject
} }
if (count($comment_srls)) if (count($comment_srls))
{ {
$v_output = executeQuery('comment.getCommentVotedLogMulti', (object)array( $v_output = executeQueryArray('comment.getCommentVotedLogMulti', array(
'comment_srls' => $comment_srls, 'comment_srls' => $comment_srls,
'member_srl' => $logged_info->member_srl, 'member_srl' => $logged_info->member_srl,
)); ));
foreach ($v_output->data as $data) foreach ($v_output->data ?: [] as $data)
{ {
$_SESSION['voted_comment'][$data->comment_srl] = $data->point; $_SESSION['voted_comment'][$data->comment_srl] = $data->point;
} }