[wp-trac] [WordPress Trac] #34654: Global comment object no longer exists on Admin Comments page
WordPress Trac
noreply at wordpress.org
Wed Nov 11 00:29:15 UTC 2015
#34654: Global comment object no longer exists on Admin Comments page
---------------------------+-----------------------------
Reporter: StephenCronin | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: trunk
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
In testing one of my plugins with 4.4-beta3, I found it broke because the
global comment object no longer exists on the Admin Comments page.
Presumably this was removed in 4.4?
The plugin filters the comment text using the `get_comment_text` filter
and uses `global $comment;` in the resulting function. However $comment is
now null rather than an object.
I can fix my plugin easily enough, as get_comment_text passes the comment
object as the second parameter (thanks @dd32!), but there may be other
plugins out there doing something similar, so I thought I'd report it so
you're aware of this.
More details:
The plugin in question is https://wordpress.org/plugins/show-parent-
comment/
The affected code is here: https://plugins.trac.wordpress.org/browser
/show-parent-comment/tags/0.2/show-parent-comment.php
The `global $comment` in question is on line 41. When $comment is used on
line 44, it throws a "Notice: Trying to get property of non-object"
message.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34654>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list