#56485 closed enhancement (duplicate)
PHP Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string
Reported by: | 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)
Change History (6)
#3
@
2 years 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).
#4
@
2 years 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.
Patch Added