Make WordPress Core

Opened 7 weeks ago

Last modified 7 weeks ago

#62276 assigned defect (bug)

class-wp-user.php can throw a warning for trim() when $value is null

Reported by: heuptasje's profile heuptasje Owned by: heuptasje's profile heuptasje
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.7
Component: General Keywords: has-patch
Focuses: coding-standards, php-compatibility Cc:

Description

It seems like the class-wp-user.php class can throw a deprecated warning on the trim() function when $value is null.

Change History (3)

This ticket was mentioned in PR #7612 on WordPress/wordpress-develop by chrisd1997.


7 weeks ago
#1

  • Keywords has-patch added

Moved the null check above the usage of $value, as this could be null. If the $value is null, a deprecation warning will be thrown for the trim() function.

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

#2 follow-up: @knutsp
7 weeks ago

If $value is null when docs day @param string|int then the error is correct. Why silence it?

#3 in reply to: ↑ 2 @heuptasje
7 weeks ago

Replying to knutsp:

If $value is null when docs day @param string|int then the error is correct. Why silence it?

I don't think we should allow it to go through to a function that will throw a deprecation error either. I'd say we'd rather have it return false then.

Note: See TracTickets for help on using tickets.