#63810 closed defect (bug) (duplicate)
Bug in comment function
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 6.8.2 |
| Component: | Formatting | Keywords: | has-test-info has-patch |
| Focuses: | Cc: |
Description
If I write a comment with following content:
The statement 3<4 ist right! And the statement 10-2-1=7 ist also true. What about 4>3?
will lead to following comment:
The statement 33?
Somehow the comment function takes a part as a HTML comment (<!-- ... >) and hide it!
Attachments (1)
Change History (12)
#3
in reply to:
↑ 1
@
5 months ago
Replying to devasheeshkaul:
Additional Notes
- I tested submitting a comment with the special characters as described in the issue report, and the comment rendered correctly on the frontend without any issues.
- Additionally, I tested editing the comment via the admin area, and it continued to display as expected on the frontend with no issues.
I can reproduce this issue on the wp-admin/edit-comments.php page. (See attached screenshot above.) Did you check that page?
#4
@
5 months ago
Oh yeah, you're right @siliconforks. I didn't check the preview. It is getting cut off in that column.
#5
@
5 months ago
Upon further check, it seems like the issue is originating from the default filter applied for textarea admin display
add_filter( 'comment_text', 'wp_kses_post' );
I wonder if adding a custom filter to bypass this in the admin listing would be a suitable approach or not.
#6
@
5 months ago
- Keywords has-test-info needs-patch added; reporter-feedback close removed
Nice spotting @siliconforks
This ticket was mentioned in PR #9468 on WordPress/wordpress-develop by @devasheeshkaul.
5 months ago
#7
- Keywords has-patch added; needs-patch removed
This PR fixes the issue where mathematical comparison expressions in comments were causing comment content between < and > to incorrectly strip when displayed in the WordPress admin comments list view.
Testing Instructions:
- Add a test comment with mathematical comparisons. A few examples below:
The statement 3 < 4 is right! And the statement 10-2-1=7 is also true. What about 4 > 3? Check if 15.5 < 20.7 and verify 100 > 99.9 Simple case 1 < 2 > 0 should match In some cases the value should be < 5 but in some instances it can be > 10 too
- Navigate to Comments (admin menu) and view the 'Comment' column in the comments list
- Verify the comment display correctly without any content being stripped
Trac ticket: https://core.trac.wordpress.org/ticket/63810
This ticket was mentioned in Slack in #core-test by q0rban. View the logs.
5 months ago
4 months ago
#9
@BugReportOnWeb welcome! thanks for submitting this proposed fix.
Indeed, it looks like comments are being affected by this, but the problem does seem to stem from HTML parsing issues in wp_kses_post(), for which #9270 exists.
I’m going to mark this as a duplicate because I think we want to be careful not to patch over a bug deeper in the system on the rendering path. That will add overhead and then leave some quirks around once the underlying issue is resolved.
In #9270 we’re looking at relying on the HTML API to provide actual HTML parsing too, freeing us from having to discuss which specific instances of a parse failure we want to attempt to restore (without accidentally breaking other ones).
#10
@
4 months ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
This is ultimately a problem stemming from HTML parsing failures inside of wp_html_split(). I think it’s best to resolve it there so we don’t multiple ad-hoc fixes (which will probably end up breaking other things).
The good news is that fixing this where the problem originates should resolve a number of other related issues.
While this function is not a direct duplicate of #63694, it’s reporting a specific manifestation of a problems dealt with generally there, so I’m marking it as a duplicate.
Reproduction Report
Description
❌ This report validates whether the issue can be reproduced.
Environment
Actual Results
Additional Notes
Supplemental Artifacts