WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#33117 closed defect (bug) (fixed)

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

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

Description

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 6 years ago.
33117.2.diff (1.1 KB) - added by morganestes 6 years ago.
Updated with @since documeted.

Download all attachments as: .zip

Change History (7)

@morganestes
6 years ago

#1 @morganestes
6 years ago

  • Keywords has-patch added

#2 @DrewAPicture
6 years ago

  • Keywords needs-docs added

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

@morganestes
6 years ago

Updated with @since documeted.

#3 @morganestes
6 years ago

  • Keywords needs-docs removed

#4 @wonderboymusic
6 years ago

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

#5 @wonderboymusic
6 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.