Opened 10 years ago
Closed 9 years ago
#38314 closed defect (bug) (fixed)
comment_text filter is passed inconsistent arguments
| Reported by: | danielbachhuber | Owned by: | johnbillion |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.8 |
| Component: | Comments | Version: | |
| Severity: | normal | Keywords: | has-patch needs-refresh |
| Cc: | Focuses: | docs |
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
@
10 years ago
@boonebgorges I think we'd be fine adding the null type for parameter notations, sure.
#3
@
10 years ago
- Keywords good-first-bug added
- Owner removed
Thanks, @DrewAPicture !
Patch will need to include documentation to this effect.
@
10 years ago
Changed Documentation of 'comment_text' filter and passed null values in check_comment()
#5
@
10 years ago
- Focuses docs added
- Keywords good-first-bug removed
- Milestone Future Release → 4.8
- Owner set to
#7
@
10 years ago
- Keywords needs-refresh added
Let's pass an empty array instead of null for $args, see comment:6:ticket:24913.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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,