Skip to content

Commit

Permalink
PHP8: Avoid warnings
Browse files Browse the repository at this point in the history
Warning: Trying to access array offset on value of type bool in lib/plugins/discussion/helper.php
  • Loading branch information
atisne committed Feb 13, 2024
1 parent a13deda commit b189aa8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion action.php
Expand Up @@ -953,7 +953,7 @@ protected function showReplyForm($cid, $reply)
protected function showReplies($cid, &$data, $reply, &$isVisible)
{
$comment = $data['comments'][$cid];
if (!count($comment['replies'])) {
if (!empty($comment['replies'])) {
return;
}
ptln('<div class="comment_replies"' . $this->getWidthStyle() . '>', 4);
Expand Down
8 changes: 6 additions & 2 deletions helper.php
Expand Up @@ -81,9 +81,13 @@ public function td($id, $col = null, &$class = null, $num = null)
$cfile = metaFN($id, '.comments');
$comments = unserialize(io_readFile($cfile, false));

$num = $comments['number'];
if (!$comments['status'] || ($comments['status'] == 2 && !$num)) {
if ($comments) {
$num = $comments['number'];
if (!$comments['status'] || ($comments['status'] == 2 && !$num)) {
return '';
}
} else {
$num = 0;
}
}

Expand Down

0 comments on commit b189aa8

Please sign in to comment.