[wp-trac] [WordPress Trac] #62070: PHP 8.1 PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated

WordPress Trac noreply at wordpress.org
Wed Sep 18 12:53:14 UTC 2024


#62070: PHP 8.1 PHP Deprecated: trim(): Passing null to parameter #1 ($string) of
type string is deprecated
--------------------------+------------------------------
 Reporter:  dhruvang21    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  php-81 close  |     Focuses:
--------------------------+------------------------------
Changes (by jrf):

 * keywords:  has-patch => php-81 close
 * focuses:  php-compatibility =>


Comment:

 @dhruvang21 Thanks for reporting this, however the proposed patch is not
 the way to go as you are hiding errors instead of fixing them.

 The `esc_url()` function is clearly documented to only accept a string for
 the `$url` parameter, so passing anything else is ''doing it wrong''.

 These kind of issues need a backtrace and must be fixed at the **source**
 of the problem, i.e. the function call passing the incorrect data type.
 They should **not** be fixed in the ''receiving'' functions.

 It is very likely that this error is caused by a plugin/theme, in which
 case: please report it there.

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


More information about the wp-trac mailing list