WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#39028 new enhancement

Comments on private posts or specific edge cases can get a confusting white screen error.

Reported by: imath Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.4
Component: Comments Keywords: needs-patch
Focuses: Cc:
PR Number:

Description

I have a plugin that uses the private status for a custom post type used in private BuddyPress groups.

When a group member tries to comment on one of the post type he's getting a white screen. I've fixed the issue on my side, problem was about caps mapping.

But still, i was pretty confused by this behavior. At first i thought it was a fatal error, but xdebug returned nothing, so i've looked in my error.log again nothing ??

Then i've found some returned WP_Error was missing data like the 403 status in wp_handle_comment_submission(). As this function was introduced in 4.4, i guess it first appeared in 4.4.

I think it could be interesting to have a screen looking like this in this kind of cases :

https://cldup.com/ymyxLMacts.png

I suggest the attached patch.

Attachments (1)

39028.patch (1.9 KB) - added by imath 3 years ago.

Download all attachments as: .zip

Change History (3)

@imath
3 years ago

#1 @imath
3 years ago

  • Keywords has-patch added

#2 @johnbillion
2 years ago

  • Keywords needs-patch added; has-patch removed
  • Type changed from defect (bug) to enhancement

I believe the intention if the current behaviour is to avoid exposing the existence of a private/trash/draft post for users who cannot access it.

The error text displayed for private, trash, and draft posts should be the same as that for posts which do not exist.

Note: See TracTickets for help on using tickets.