Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#33117 closed defect (bug) (fixed)

Optional parameters in sanitize_post_field() aren't declared as optional.

Reported by: morganestes's profile morganestes Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 2.3
Component: Posts, Post Types Keywords: has-patch
Focuses: docs Cc:


The docblock and internals of sanitize_post_field() say the $context parameter has a default, but the function signature has it as a required parameter. Since the other related functions have a default value, adding one here makes it clearer what is happening here.

Attachments (2)

33117.diff (1006 bytes) - added by morganestes 8 years ago.
33117.2.diff (1.1 KB) - added by morganestes 8 years ago.
Updated with @since documeted.

Download all attachments as: .zip

Change History (7)

8 years ago

#1 @morganestes
8 years ago

  • Keywords has-patch added

#2 @DrewAPicture
8 years ago

  • Keywords needs-docs added

@morganestes: We'd also need a changelog entry in the DocBlock for making the parameter optional.

8 years ago

Updated with @since documeted.

#3 @morganestes
8 years ago

  • Keywords needs-docs removed

#4 @wonderboymusic
8 years ago

  • Milestone changed from Awaiting Review to 4.4
  • Owner set to wonderboymusic
  • Status changed from new to assigned

#5 @wonderboymusic
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 34081:

sanitize_post(): the default value for $context is 'display'. The documentation says the default for sanitize_post_field() is 'display', but there is no default for the arg. Make the argument: $context = 'default'.

Props morganestes.
Fixes #33117.

Note: See TracTickets for help on using tickets.