wp-comments-post.php not reading REQUEST_METHOD correctly
-
An install that has been working just fine for 2 years has developed an intermittent problem. Sometimes comments are lost and the user gets a blank 405 error screen.
I’ve narrowed it down to this line of code in /wp-comments-post.php
if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {Even though var_dump’s show that REQUEST_METHOD is “POST”, this always is true and the code throws an error. I can fix this by changing it to :
if ( ! 'POST' === $_SERVER['REQUEST_METHOD'] ) {…which is probably totally the wrong logic to stop bad requests getting in, but why is this working?
And how can I fix this without changing this file every time I update WP?
The topic ‘wp-comments-post.php not reading REQUEST_METHOD correctly’ is closed to new replies.