[wp-trac] [WordPress Trac] #61544: PHP Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /app/public/wp-includes/formatting.php on line 4494

WordPress Trac noreply at wordpress.org
Mon Jul 1 21:50:39 UTC 2024


#61544: PHP Deprecated:  ltrim(): Passing null to parameter #1 ($string) of type
string is deprecated in /app/public/wp-includes/formatting.php on line 4494
-----------------------------+--------------------------------
 Reporter:  mikedjo          |       Owner:  (none)
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Formatting       |     Version:
 Severity:  normal           |  Resolution:  duplicate
 Keywords:  has-patch close  |     Focuses:  php-compatibility
-----------------------------+--------------------------------
Changes (by sabernhardt):

 * status:  new => closed
 * resolution:   => duplicate
 * component:  General => Formatting
 * milestone:  Awaiting Review =>


Comment:

 Hi and thanks for the patch.

 This was already reported on #61268, and the discussion should continue on
 that ticket.

 Please find what code uses `esc_url` incorrectly before trying to edit the
 Core function. Editing the `esc_url` function's condition could result in
 more links with empty `href` values that do not give any notice of a
 failure.

 In the proposed patch, if the value of `$url` evaluates as empty but is
 not a string, the function would still need to return a string (not the
 `$url` value).
 {{{
         if ( empty( $url ) ) {
                 return '';
         }
 }}}

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


More information about the wp-trac mailing list