Skip to content

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Sep 29, 2025

Adds a check to break the loop if get_comment returns null.

Fixes "Attempt to read property "comment_parent" on null" PHP Warnings

Proposed changes:

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Go to '..'

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Adds a check to break the loop if get_comment returns null, preventing potential infinite loops when a comment ancestor is missing.
@pfefferle pfefferle self-assigned this Sep 29, 2025
@Copilot Copilot AI review requested due to automatic review settings September 29, 2025 06:37
@pfefferle pfefferle added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Sep 29, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Prevents infinite loops in the get_comment_ancestors function by adding a null check for the get_comment result. This addresses PHP warnings that occur when attempting to read the comment_parent property on a null object.

  • Adds null validation to break the loop when get_comment returns null
  • Prevents "Attempt to read property 'comment_parent' on null" PHP warnings
  • Improves robustness of ancestor traversal logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pfefferle pfefferle requested a review from obenland September 29, 2025 06:37
@pfefferle pfefferle changed the title Prevent infinite loop in get_comment_ancestors Prevent PHP Warning Sep 29, 2025
@pfefferle pfefferle merged commit 3a2fa90 into trunk Sep 29, 2025
13 checks passed
@pfefferle pfefferle deleted the fix/attempt-to-read-property-comment_parent-on-null branch September 29, 2025 12:56
pfefferle added a commit that referenced this pull request Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants