Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#27130 closed defect (bug) (fixed)

Credentials parameter default in wp_signon() should be an array

Reported by: tivnet Owned by: SergeyBiryukov
Milestone: 3.9 Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch
Focuses: Cc:


 * @param array $credentials Optional. User info in order to sign on.
 * @param bool $secure_cookie Optional. Whether to use secure cookie.
 * @return object Either WP_Error on failure, or WP_User on success.
function wp_signon( $credentials = '', $secure_cookie = '' ) {

  1. @return WP_User|WP_Error Either WP_Error on failure, or WP_User on success.
  1. $credentials = '', $secure_cookie = '' probably wrong default values. Or wrong @param

Attachments (1)

27130.patch (604 bytes) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (10)

#1 @SergeyBiryukov
7 years ago

  • Component changed from General to Users
  • Focuses docs added
  • Milestone changed from Awaiting Review to 3.9

#2 @SergeyBiryukov
7 years ago

Seems like the default value of $credentials should be an array.

We use strict comparison for $secure_cookie though:

Could probably use null instead, but need to be careful with backwards compatibility, so I guess it's safer to keep it a string. The @param description is correct, it's treated as a boolean value.

#3 follow-up: @DrewAPicture
7 years ago

  • Keywords needs-patch added

@tivnet: Care to make a patch? :)

#4 in reply to: ↑ 3 @tivnet
7 years ago

Replying to DrewAPicture:

@tivnet: Care to make a patch? :)

I usually do. In this case, there were unclear moments (see Sergey's comments)
If what Sergey wrote is final - I'll make a patch...

...or you can just fix that :-), and I'll lose the "props" this time :-)))

#5 @azizur
7 years ago

  • Keywords has-patch added; needs-patch removed

Ticket #26148 has patch addresses this issue.

Last edited 7 years ago by azizur (previous) (diff)

#6 @DrewAPicture
7 years ago

  • Milestone 3.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #26148.

#7 @DrewAPicture
7 years ago

  • Focuses docs removed
  • Milestone set to 3.9
  • Resolution duplicate deleted
  • Status changed from closed to reopened

#26148 is a documentation-specific patch. Re-opening here in favor of handling the $credentials default change from an empty string to an empty array.

#8 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from reopened to closed

In 27350:

Default value for $credentials parameter in wp_signon() should be an array, not a string.

props tivnet.
fixes #27130.

#9 @DrewAPicture
7 years ago

  • Summary changed from wp_signon() wrong PHPDoc to Credentials parameter default in wp_signon() should be an array
Note: See TracTickets for help on using tickets.