Make WordPress Core

Opened 7 months ago

Closed 7 months ago

Last modified 7 months ago

#62298 closed defect (bug) (fixed)

Update default parameter of `retrieve_password()` for PHP8 compatibility

Reported by: peterwilsoncc's profile peterwilsoncc Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.8 Priority: normal
Severity: normal Version:
Component: Users Keywords: php81 has-patch
Focuses: php-compatibility Cc:

Description

The parameter default should be as line 3118 will throw a PHP Deprecation for passing null to trim().

Props @afragen for reporting.

Change History (5)

This ticket was mentioned in PR #7644 on WordPress/wordpress-develop by @afragen.


7 months ago
#1

  • Keywords has-patch added

Quick PR to update retrieve_password() for PHP8 compatibility. The parameter default should be'' as line 3118 will throw a PHP Deprecation for passing null to trim().

Trac ticket: https://core.trac.wordpress.org/ticket/62298

#2 @SergeyBiryukov
7 months ago

  • Keywords php81 added; php-8 removed

#3 @SergeyBiryukov
7 months ago

  • Milestone changed from Awaiting Review to 6.8

#4 @SergeyBiryukov
7 months ago

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

In 59312:

Users: Set correct default value for $user_login in retrieve_password().

This resolves a "passing null to non-nullable" deprecation notice on PHP 8.1+:

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated

Follow-up to [50129], [54477].

Props afragen, peterwilsoncc, SergeyBiryukov.
Fixes #62298.

@SergeyBiryukov commented on PR #7644:


7 months ago
#5

Thanks for the PR! Merged in r59312.

Note: See TracTickets for help on using tickets.