Skip to content

Commit

Permalink
Fix undefined var in recent change for new comment
Browse files Browse the repository at this point in the history
With the recent changes module, adding a recent change for a new comment
caused the warning "Undefined variable $comment_thread" if the comment
was not a reply. Use `isset()` instead of `!== NULL` to check for reply
depth, avoiding the warning when $comment_thread is not set.
  • Loading branch information
neapsix committed May 22, 2023
1 parent ed4bda5 commit ff43756
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/feature-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"timestamp" => time(),
"page" => $env->page,
"user" => $env->user,
"reply_depth" => $comment_thread !== null ? count($comment_thread) : 0,
"reply_depth" => isset($comment_thread) ? count($comment_thread) : 0,
"comment_id" => $new_comment->id
]);
}
Expand Down

0 comments on commit ff43756

Please sign in to comment.