PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead.

Created on 6 June 2023, about 1 year ago
Updated 12 September 2023, 10 months ago

Problem/Motivation

Since PHP 8.2, PHP emits a deprecation notice on the following pattern that the dollar sign ($) is placed at the outside of the curly braces. It can be seen in several places:

PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/web/modules/contrib/gutenberg/src/BlockProcessor/OEmbedProcessor.php on line 333

PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/web/modules/contrib/gutenberg/src/BlockProcessor/OEmbedProcessor.php on line 342

PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/web/modules/contrib/gutenberg/src/BlockProcessor/OEmbedProcessor.php on line 359

Steps to reproduce

1. Use a Drupal 10 project with PHP 8.2
1. Add drupal/gutenberg module via composer.
3. Observe warnings in the terminal when using drush or via the web interface.

Proposed resolution

Use {$var} syntax instead of ${var} syntax to avoid deprecation notice.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024