Opened 3 years ago
Closed 3 years ago
#51263 closed defect (bug) (fixed)
PHP warning when editing comments in the administration comment edit screen
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.5.2 | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Comments | Keywords: | has-screenshots commit fixed-major |
Focuses: | administration | Cc: |
Description
When I tried to edit any comment in the administration comment edit screen, I get two php warnings like below in my debug.log file
[07-Sep-2020 18:03:22 UTC] PHP Notice: Undefined index: c in D:\xampp\htdocs\free-plugins\wp-admin\comment.php on line 39
[07-Sep-2020 18:03:22 UTC] PHP Notice: Trying to get property 'comment_post_ID' of non-object in D:\xampp\htdocs\free-plugins\wp-admin\comment.php on line 43
I haven't enabled any plugins and my site is running default Twenty Twenty theme. I had tried with multiple WP installation including a fresh installation and error showed up on all installations. I have also included the links to the screenshot which shall make the issue more clear.
Change History (11)
#2
@
3 years ago
Hi there,
Thank you for the reply. Yes the URl looks like
comment.php?action=editcomment&c=2
The error doesn't show up on the screen itself but shows up on updating the comment when debug mode is set to true in wp-config.php file. Last day I checked in my localhost but today I checked in site hosted in hostgators and the error showed up in different installations in live servers too. So that's a bit strange that error is not being replicated.
#3
@
3 years ago
Hello there,
I just debugged a bit more and it seems there is some issue with $_GET and $_POST. When I inspected in the comment edit form there is a input type hidden field with name as c which shall be addressed as
$_POST['c']
on the receiving end but when I checked in the comment.php file in exact line number then it is being addressed as
$_GET['c']
without checking isset or empty condition.
Please check these screenshot.
https://prntscr.com/udeaqu
http://prntscr.com/udecmn
So probable solution might be using $_REQUEST instead of $_GET or $_POST as since same screen is being used to submit and display the comment edit form.
#4
@
3 years ago
- Keywords reporter-feedback removed
- Milestone changed from Awaiting Review to 5.5.2
Indeed, I was able to reproduce the issue now. Thanks!
It happens when submitting the Edit Comment form, not when opening the page, as I originally thought.
Moving to 5.5.2 for the investigation.
#8
@
3 years ago
- Keywords commit fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backporting to the 5.5 branch.
Hi there, welcome to WordPress Trac! Thanks for the report.
Just noting that I could not reproduce the issue on a clean install.
What does the URL look like when you're editing a comment? It should look like this:
where
123
is the ID of the comment being edited.