Deprecated function: Creation of dynamic property

Created on 29 January 2024, 11 months ago

Problem/Motivation

Getting following deprecation error with php 8.2
Deprecated function: Creation of dynamic property Drupal\amp\Asset\AmpCssCollectionRenderer::$state is deprecated in Drupal\amp\Asset\AmpCssCollectionRenderer->__construct() (line 95 of modules/contrib/amp/src/Asset/AmpCssCollectionRenderer.php).

🐛 Bug report
Status

Active

Version

3.8

Component

Code

Created by

🇮🇳India sonvir249 Pune

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

Merge Requests

Comments & Activities

  • Issue created by @sonvir249
  • Merge request !19issue-3417787: Fixed the deprecation error. → (Merged) created by sonvir249
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update 11 months ago
    Waiting for branch to pass
  • Status changed to Needs review 11 months ago
  • Issue was unassigned.
  • Status changed to RTBC 10 months ago
  • 🇫🇷France S3b0uN3t Nantes

    Tested with version 3.8 of the AMP module in PHP 8.3.
    The Merge Request resolves the deprecated issue and does not result in a new issue.

    I update the issue in RTBC.

    Thanks for your fix !

  • 🇺🇸United States kurttrowbridge

    Also confirmed that the supplied MR resolved the issue for my site using PHP 8.2 and the dev version of the module. Thank you!

  • 🇧🇪Belgium flyke

    After this patch, I got the following notices in my console after for example a drush updb command:

    PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/vendor/lullabot/amp/src/AMP.php on line 356
    
    Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/vendor/lullabot/amp/src/AMP.php on line 356
    PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/vendor/lullabot/amp/src/AMP.php on line 357
    
    Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/vendor/lullabot/amp/src/AMP.php on line 357

    I fixed this by adding this patch in my projects composer.json file:

    			"lullabot/amp": {
    				"#317": "https://patch-diff.githubusercontent.com/raw/Lullabot/amp-library/pull/317.patch"
    			}
  • 🇪🇸Spain nicobot Granada

    I also confirm the patch fixes the issue as described. Also comment #6 makes sense as well. Thank you all!

  • Pipeline finished with Skipped
    3 days ago
    #377053
  • First commit to issue fork.
Production build 0.71.5 2024