Skip to:
Content

bbPress.org

Opened 3 weeks ago

Closed 3 weeks ago

Last modified 3 weeks ago

#3719 closed defect (bug) (fixed)

Request helpers warn when REQUEST_METHOD is unavailable

Reported by: johnjamesjacoby Owned by: johnjamesjacoby
Priority: normal Milestone: 2.6.20
Component: API Version: 2.3
Severity: normal Keywords: has-patch has-unit-tests
Cc:

Description

bbp_is_post_request() and bbp_is_get_request() unconditionally read $_SERVER['REQUEST_METHOD']. In CLI and other non-HTTP contexts where that key is unavailable, both helpers emit an undefined-key warning instead of satisfying their boolean contract.

Guard the server value before normalizing it, returning false when no request method exists. Regression coverage should include missing, case-insensitive, and unrelated request methods.

Change History (2)

#1 @johnjamesjacoby
3 weeks ago

  • Owner set to johnjamesjacoby
  • Resolution → fixed
  • Status new → closed

In 7874:

Core: Guard request method helpers.

Return false when the server request method is unavailable so CLI, cron, and other non-HTTP contexts do not emit warnings.

In trunk, for 2.7.

Fixes #3719.

#2 @johnjamesjacoby
3 weeks ago

In 7875:

Core: Guard request method helpers.

Return false when the server request method is unavailable so CLI, cron, and other non-HTTP contexts do not emit warnings.

In branches/2.6, for 2.6.20.

Fixes #3719.

Note: See TracTickets for help on using tickets.