[wp-trac] [WordPress Trac] #55787: [PHP 8.2] Fix deprecated `${var}` string interpolation syntax

WordPress Trac noreply at wordpress.org
Mon Sep 12 17:50:50 UTC 2022


#55787: [PHP 8.2] Fix deprecated `${var}` string interpolation syntax
------------------------------------+-----------------------------
 Reporter:  ayeshrajans             |       Owner:  SergeyBiryukov
     Type:  defect (bug)            |      Status:  closed
 Priority:  normal                  |   Milestone:  6.1
Component:  General                 |     Version:  6.0
 Severity:  minor                   |  Resolution:  fixed
 Keywords:  has-patch php82 commit  |     Focuses:
------------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54134" 54134]:
 {{{
 #!CommitTicketReference repository="" revision="54134"
 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.
 }}}

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


More information about the wp-trac mailing list