wp-comments-post shouldn't return a 500 error for user errors
|Reported by:||solarissmoke||Owned by:|
This has been discussed also in http://core.trac.wordpress.org/ticket/7890, but wasn't addressed, so sorry to dredge it up again, but I think it is a valid point.
When a user submits a duplicate comment, or enters a comment field incorrectly, or comments are closed/restricted, wp-comments-post uses wp_die() to inform them of the error. By default wp_die returns a 500 Internal Sever Error.
However for these cases it isn't a server error, it is a client error. So the response code should be anything but 500. Maybe 403? Or if that isn't liked, then just 200. If there isn't agreement on what the response should be then at least a filter should exist to let the owner choose.
Attached is a proposed change to return a 403 instead of 500.