[wp-trac] [WordPress Trac] #55656: PHP 8.x: various compatibility fixes for WordPress 6.1

WordPress Trac noreply at wordpress.org
Mon Sep 12 21:49:15 UTC 2022


#55656: PHP 8.x: various compatibility fixes for WordPress 6.1
-------------------------------------------------+-------------------------
 Reporter:  hellofromTonya                       |       Owner:  (none)
     Type:  task (blessed)                       |      Status:  new
 Priority:  normal                               |   Milestone:  6.1
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  php8 php81 has-patch has-unit-tests  |     Focuses:  coding-
                                                 |  standards
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 In [changeset:"54135" 54135]:
 {{{
 #!CommitTicketReference repository="" revision="54135"
 Code Modernization: Pass correct value to `parse_url()` in
 `WP_Customize_Manager::get_return_url()`.

 This particular code block only makes sense to run when
 `$this->return_url` is not null. Previously, it caused a "passing null to
 non-nullable" deprecation notice on PHP 8.1.

 By moving the code into the `if ( $this->return_url )` condition block,
 the code will only be run when `$this->return_url` contains a non-falsey
 /non-null value.

 No additional tests added as this issue was found via the existing tests
 for the function containing the bug.

 This solves the following two PHP 8.1 test errors:
 {{{
 1) Tests_WP_Customize_Manager::test_return_url
 parse_url(): Passing null to parameter #1 ($url) of type string is
 deprecated

 /var/www/src/wp-includes/class-wp-customize-manager.php:4696
 /var/www/tests/phpunit/tests/customize/manager.php:2975
 /var/www/vendor/bin/phpunit:123

 2) Tests_WP_Customize_Manager::test_customize_pane_settings
 parse_url(): Passing null to parameter #1 ($url) of type string is
 deprecated

 /var/www/src/wp-includes/class-wp-customize-manager.php:4696
 /var/www/src/wp-includes/class-wp-customize-manager.php:4898
 /var/www/tests/phpunit/tests/customize/manager.php:3085
 /var/www/vendor/bin/phpunit:123
 }}}

 Follow-up to [46754].

 Props jrf, costdev.
 See #55656.
 }}}

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


More information about the wp-trac mailing list