Make WordPress Core

Opened 21 months ago

Closed 21 months ago

Last modified 20 months ago

#56485 closed enhancement (duplicate)

PHP Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string

Reported by: hiren1094's profile hiren1094 Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.0.2
Component: Formatting Keywords: php81 has-patch
Focuses: coding-standards Cc:

Description

Hello,

Updated "wp-includes\formatting.php" files for fix issue of "PHP Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated" for PHP 8.1.6

Attachments (1)

56485.patch (484 bytes) - added by hiren1094 21 months ago.
Patch Added

Download all attachments as: .zip

Change History (6)

#1 @dingo_d
21 months ago

  • Keywords php81 added

@hiren1094
21 months ago

Patch Added

#2 @hiren1094
21 months ago

  • Keywords has-patch added; needs-patch removed

#3 @jrf
21 months ago

  • Keywords has-patch removed

Deprecations are not errors. A lot of WordPress functions all suffer from similar issues and we should implement a proper, consistent solution for all, which is why these issues have not been addressed yet as a discussion is needed on the solution direction.

The only time it would be possible to get these deprecation notices, is if these functions are being called with a null being passed to a non-nullable parameter, which is doing it wrong. More than anything, the incorrect function call, should be fixed. Not the function where the deprecation is thrown.

For that a full backtrace of the notices is needed to determine where the incorrect function call is being made.

Note: I've also looked at the patch and this is not a correct fix no matter what. The input type is not being checked and the return type will now potentially widen, which is undesirable and could cause new issues with null now being returned as null (and potentially other wrong types not handled either).

Last edited 21 months ago by jrf (previous) (diff)

#4 @SergeyBiryukov
21 months ago

  • Component changed from General to Formatting
  • Keywords has-patch added
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome to WordPress Trac!

Thanks for the report, we're already tracking this issue in #54997.

This ticket was mentioned in Slack in #core-test by martin.krcho. View the logs.


20 months ago

Note: See TracTickets for help on using tickets.