pfefferle / wordpress-webmention

A Webmention plugin for WordPress
https://wordpress.org/plugins/webmention/
MIT License
115 stars 32 forks source link

Null reference to comment_parent #464

Closed edent closed 4 months ago

edent commented 4 months ago

Had a bunch of these pop up recently.

PHP Warning: Attempt to read property "comment_parent" on null in /wp-content/plugins/webmention/includes/class-sender.php on line 60

https://github.com/pfefferle/wordpress-webmention/blob/2d249be2690207761f3724bb8ce9492d43f1b06c/includes/class-sender.php#L60

I assume it just needs !is_null( $comment )?

I'm not sure which comments triggered it.

Possibly related to #342

janboddez commented 4 months ago

Or ( ! empty( $comment->comment_parent ) ). But, yeah, get_comment() can return null. Question is why the comment_post hook is called with a non-existent (?) $id.

pfefferle commented 4 months ago

Yes, that's weird!