Deprecated function: Using ${var} in strings is deprecated, use {$var} instead in require_once()

Created on 11 October 2023, about 1 year ago
Updated 20 May 2024, 6 months ago

Deprecated function: Using ${var} in strings is deprecated, use {$var}

Hello everyone,

in drupal 10.1.5, after installing Adsense, when I go to the Adsense settings, I get the following error message:
Deprecated function: Using ${var} in strings is deprecated, use {$var} instead in require_once() (line 53 of core/includes/module.inc).
require_once('/Applications/MAMP/htdocs/traincorse_nikadev/web/core/includes/bootstrap.inc') (Line: 53)
module_load_include('inc', 'adsense', 'help/adsense.help') (Line: 36)
Drupal\adsense\Form\AdsenseMainSettings->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('adsense_main_settings', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
This problem only appears with AdSense. do you know a solution?

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇫🇷France pedrocorse

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

Merge Requests

Comments & Activities

  • Issue created by @pedrocorse
  • 🇮🇳India chetan 11

    Hi @pedrocorse
    In which file you're getting this error, I have also followed the same steps as given above.

  • 🇫🇷France pedrocorse

    Hi @chetan-11 in /admin/config/services/adsense, like the picture

  • 🇺🇦Ukraine lobodacyril

    I got the same error but in different place: Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /code/web/modules/contrib/adsense/adsense.module on line 192

    And this patch works for me.

  • Issue was unassigned.
  • Status changed to RTBC about 1 year ago
  • 🇮🇳India roshni27

    The issue exists and has been resolved using the patch mentioned. Please refer to the screenshots for confirmation. +RTBC

  • Assigned to pedrocorse
  • Status changed to Active about 1 year ago
  • Status changed to Needs review about 1 year ago
  • Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • 🇮🇳India roshni27

    Please review the patch.

  • 🇺🇸United States JWinTX

    Patch #9 works for me. Thanks!

  • Assigned to sarathkm
  • Status changed to RTBC 8 months ago
  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 8 months ago
    Waiting for branch to pass
  • 🇮🇳India sarathkm kerala

    Patch works fine with 8.x-1.4 release.

    Before:

    ddev php -v
    PHP 8.3.2-1+0~20240120.16+debian11~1.gbpb43448 (cli) (built: Jan 20 2024 14:17:59) (NTS)
    Copyright (c) The PHP Group
    Zend Engine v4.3.2, Copyright (c) Zend Technologies
        with Zend OPcache v8.3.2-1+0~20240120.16+debian11~1.gbpb43448, Copyright (c), by Zend Technologies
    
    ddev drush cr
    PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/web/modules/contrib/adsense/adsense.module on line 192
    
    Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/web/modules/contrib/adsense/adsense.module on line 192
    PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/web/modules/contrib/adsense/adsense.module on line 192
    
    Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/web/modules/contrib/adsense/adsense.module on line 192
     [success] Cache rebuild complete.
    

    After:

    ddev composer install
    Gathering patches for root package.
    Removing package drupal/adsense so that it can be re-installed and re-patched.
      - Removing drupal/adsense (1.4.0)
    Deleting /var/www/html/web/modules/contrib/adsense - deleted
    Installing dependencies from lock file (including require-dev)
    Verifying lock file contents can be installed on current platform.
    Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
    Package operations: 1 install, 0 updates, 0 removals
    Gathering patches for root package.
    Gathering patches for dependencies. This might take a minute.
      - Installing drupal/adsense (1.4.0): Extracting archive
      - Applying patches for drupal/adsense
        patches/modules/adsense/3393149-9.patch (Deprecated function: Using ${var} in strings is deprecated, use {$var} instead in require_once())
    
    Package clue/buzz-react is abandoned, you should avoid using it. Use react/http instead.
    Package react/http-client is abandoned, you should avoid using it. Use react/http instead.
    Generating autoload files
    73 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
      * Homepage: https://www.drupal.org/project/drupal
      * Support:
        * docs: https://www.drupal.org/docs/user_guide/en/index.html
        * chat: https://www.drupal.org/node/314178
    
    ddev drush cr
     [success] Cache rebuild complete.
    
  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 8 months ago
    Waiting for branch to pass
  • 🇮🇳India sarathkm kerala

    Raised merge request

  • Issue was unassigned.
    • jcnventura committed 5034d132 on 8.x-1.x
      Issue #3393149 by roshni27, sarathkm, lobodakyrylo, jcnventura:...
  • Status changed to Fixed 7 months ago
  • 🇵🇹Portugal jcnventura

    Thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024