Skip to content

Commit

Permalink
Code Modernization: Pass correct default value to new DateTime() in…
Browse files Browse the repository at this point in the history
… `wp_default_packages_inline_scripts()`.

This fixes a "Deprecated: `DateTime::__construct()`: Passing null to parameter #1 (`$datetime`) of type string is deprecated" warning on PHP 8.1.

Follow-up to [49083].

See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51533 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Aug 3, 2021
1 parent 9f3c2be commit a5de731
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/script-loader.php
Expand Up @@ -330,7 +330,7 @@ function wp_default_packages_inline_scripts( $scripts ) {
$timezone_abbr = '';

if ( ! empty( $timezone_string ) ) {
$timezone_date = new DateTime( null, new DateTimeZone( $timezone_string ) );
$timezone_date = new DateTime( 'now', new DateTimeZone( $timezone_string ) );
$timezone_abbr = $timezone_date->format( 'T' );
}

Expand Down

0 comments on commit a5de731

Please sign in to comment.