From ca57157a39ddb2e56fcb6780a5fd29c62963c982 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 12 Sep 2022 17:52:08 +0000 Subject: [PATCH] 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: * [https://php.watch/versions/8.2/$%7Bvar%7D-string-interpolation-deprecated PHP.Watch: PHP 8.2: ${var} string interpolation deprecated] * [https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation PHP RFC: Deprecate ${} string interpolation] Follow-up to [10584], [31733], [42360], [53922]. Props ayeshrajans, jrf. Fixes #55787. Built from https://develop.svn.wordpress.org/trunk@54134 git-svn-id: http://core.svn.wordpress.org/trunk@53693 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 2 +- wp-includes/pomo/po.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index f4cf72c258..6a27a67d92 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -1738,7 +1738,7 @@ function get_comment_reply_link( $args = array(), $comment = null, $post = null $data_attribute_string = ''; foreach ( $data_attributes as $name => $value ) { - $data_attribute_string .= " data-${name}=\"" . esc_attr( $value ) . '"'; + $data_attribute_string .= " data-{$name}=\"" . esc_attr( $value ) . '"'; } $data_attribute_string = trim( $data_attribute_string ); diff --git a/wp-includes/pomo/po.php b/wp-includes/pomo/po.php index cfd8084ac6..13fb16eb12 100644 --- a/wp-includes/pomo/po.php +++ b/wp-includes/pomo/po.php @@ -126,7 +126,7 @@ if ( ! class_exists( 'PO', false ) ) : $string = str_replace( array_keys( $replaces ), array_values( $replaces ), $string ); - $po = $quote . implode( "${slash}n$quote$newline$quote", explode( $newline, $string ) ) . $quote; + $po = $quote . implode( "{$slash}n{$quote}{$newline}{$quote}", explode( $newline, $string ) ) . $quote; // Add empty string on first line for readbility. if ( false !== strpos( $string, $newline ) && ( substr_count( $string, $newline ) > 1 || substr( $string, -strlen( $newline ) ) !== $newline ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index c304864534..ac3f007365 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-54133'; +$wp_version = '6.1-alpha-54134'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.