[wp-trac] [WordPress Trac] #62070: PHP Deprecated warnings with null values for success and reject URLs (was: PHP 8.1 PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated)

WordPress Trac noreply at wordpress.org
Sat Oct 5 17:48:10 UTC 2024


#62070: PHP Deprecated warnings with null values for success and reject URLs
-----------------------------------+------------------------------
 Reporter:  dhruvang21             |       Owner:  (none)
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Application Passwords  |     Version:  5.6
 Severity:  normal                 |  Resolution:
 Keywords:  php-81 has-patch       |     Focuses:
-----------------------------------+------------------------------
Changes (by sabernhardt):

 * keywords:  php-81 close => php-81 has-patch
 * version:   => 5.6


Old description:

> PHP Deprecated:  ltrim(): Passing null to parameter #1 ($string) of type
> string is deprecated in /var/www/src/wp-includes/formatting.php on line
> 4482

New description:

 If the `$success_url` or `$reject_url` are set to `null`, then running
 `esc_url()` on those for [https://github.com/WordPress/wordpress-
 develop/blob/c4752a11cfc53a49b63d4b786bac9fe62eba1604/src/wp-admin
 /authorize-application.php#L243-L244 hidden inputs] could produce PHP
 warnings.

 `PHP Deprecated:  ltrim(): Passing null to parameter #1 ($string) of type
 string is deprecated in /.../wp-includes/formatting.php on line 4482`

--

Comment:

 Is switching from `null` to an empty string good, or should it not print
 the hidden fields with an empty attribute if the success or reject URL is
 not defined?

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


More information about the wp-trac mailing list