Opened 9 years ago
Closed 9 years ago
#38314 closed defect (bug) (fixed)
comment_text filter is passed inconsistent arguments
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.8 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Comments | Keywords: | has-patch needs-refresh |
| Focuses: | docs | Cc: |
Description
Only one argument is supplied in check_comment():
/** This filter is documented in wp-includes/comment-template.php */ $comment = apply_filters( 'comment_text', $comment );
However, three arguments are supplied in comment_text():
echo apply_filters( 'comment_text', $comment_text, $comment, $args );
The former should probably have two null values passed so error notices aren't triggered in callbacks hooking into the latter.
Attachments (2)
Change History (10)
#2
@
9 years ago
@boonebgorges I think we'd be fine adding the null type for parameter notations, sure.
#3
@
9 years ago
- Keywords good-first-bug added
- Owner drewapicture deleted
Thanks, @DrewAPicture !
Patch will need to include documentation to this effect.
@
9 years ago
Changed Documentation of 'comment_text' filter and passed null values in check_comment()
#5
@
9 years ago
- Focuses docs added
- Keywords good-first-bug removed
- Milestone changed from Future Release to 4.8
- Owner set to johnbillion
#7
@
9 years ago
- Keywords needs-refresh added
Let's pass an empty array instead of null for $args, see comment:6:ticket:24913.
Note: See
TracTickets for help on using
tickets.
Timeline, for reference:
$commentarg added to filter incomment_text()check_comment(). At this point, the two uses of the filter have already diverged$argsparam to the filter incomment_text()Passing null values in
check_comment()would prevent against certain kinds of errors, but it also makes the filter documentation incorrect. @DrewAPicture do you have a suggestion for how to document this kind of problem? Can we say, eg,