#11222 closed defect (bug) (fixed)
PHP Notice while untrashing comment
Reported by: | sirzooro | Owned by: | |
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | normal | Version: | 2.9 |
Component: | Trash | Keywords: | needs-patch |
Focuses: | Cc: |
Description
Steps to reproduce:
- create a new comment (if you do not have one);
- go to the comments list;
- click "Edit";
- click "Move to Trash" (you should return to comment list);
- click "Undo" to untrash comment.
When you do this, following notice will appear:
Notice: Undefined index: user_ID in C:\wordpress29.local\wp-includes\comment.php on line 1079
Function wp_filter_comment()
is called by wp_new_comment()
and wp_update_comment()
. First function uses user_ID
, second user_id
. First function calls preprocess_comment
filter; second one takes data from DB, where field name is in lowercase.
Attachments (2)
Change History (12)
#2
@
15 years ago
IMO, the correct fix here is to kill what ever is setting it to uppercase in the first place if lowercase is expected..
#4
@
15 years ago
I have confirmed that this warning appears with default theme and no active plugins.
#5
@
15 years ago
The confusion stems from the $user_ID global. Attached patch defines a $user_id global as well, uses $user_id in wp-comments-post.php, and makes $user_id the preferred variable in wp_filter_comment() and wp_new_comment() with back compat checks for $user_ID.
#6
@
15 years ago
I think it will be good to also add comment(s) which variable version is preferred.
Hmm, seems that the easiest workaround is to just check if you have
user_ID
oruser_id
- see attached patch.