Make WordPress Core


Ignore:
Timestamp:
09/12/2022 05:50:36 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Replace deprecated string interpolation patterns.

PHP 8.2 deprecates string interpolation patterns that place the dollar sign outside the curly braces:

echo "Hello ${name}";

This commit fixes such patterns by replacing them with proper curly braced patterns:

echo "Hello {$name}";

This addresses Deprecated: Using ${var} in strings is deprecated, use {$var} instead notices when running tests on PHP 8.2.

References:

Follow-up to [10584], [31733], [42360], [53922].

Props ayeshrajans, jrf.
Fixes #55787.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pomo/po.php

    r52640 r54134  
    127127            $string = str_replace( array_keys( $replaces ), array_values( $replaces ), $string );
    128128
    129             $po = $quote . implode( "${slash}n$quote$newline$quote", explode( $newline, $string ) ) . $quote;
     129            $po = $quote . implode( "{$slash}n{$quote}{$newline}{$quote}", explode( $newline, $string ) ) . $quote;
    130130            // Add empty string on first line for readbility.
    131131            if ( false !== strpos( $string, $newline ) &&
Note: See TracChangeset for help on using the changeset viewer.