Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#33117 closed defect (bug) (fixed)

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

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

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

Download all attachments as: .zip

Change History (7)

@morganestes
11 years ago

#1 @morganestes
11 years ago

  • Keywords has-patch added

#2 @DrewAPicture
11 years ago

  • Keywords needs-docs added

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

@morganestes
11 years ago

Updated with @since documeted.

#3 @morganestes
11 years ago

  • Keywords needs-docs removed

#4 @wonderboymusic
11 years ago

  • Milestone Awaiting Review4.4
  • Owner set to wonderboymusic
  • Status newassigned

#5 @wonderboymusic
11 years ago

  • Resolutionfixed
  • Status assignedclosed

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.