From ff437562e3a86bb29daec4387d479a70b1d50644 Mon Sep 17 00:00:00 2001 From: Benjamin Spiegel Date: Sun, 21 May 2023 23:34:00 -0500 Subject: [PATCH] Fix undefined var in recent change for new comment 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. --- modules/feature-comments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/feature-comments.php b/modules/feature-comments.php index 32b68b8..afee724 100644 --- a/modules/feature-comments.php +++ b/modules/feature-comments.php @@ -134,7 +134,7 @@ register_module([ "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 ]); }