[wp-trac] [WordPress Trac] #56485: PHP Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string

WordPress Trac noreply at wordpress.org
Thu Sep 1 13:08:57 UTC 2022


#56485: PHP Deprecated:  rtrim(): Passing null to parameter #1 ($string) of type
string
-------------------------+-------------------------------
 Reporter:  hiren1094    |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  6.0.2
 Severity:  normal       |  Resolution:
 Keywords:  php81        |     Focuses:  coding-standards
-------------------------+-------------------------------
Changes (by jrf):

 * keywords:  php81 has-patch => php81


Comment:

 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 passed as `null` (and potentially other wrong
 types not handled either).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56485#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list