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).

Issue fork amp-3417787

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sonvir249 created an issue. See original summary.

sonvir249’s picture

Status: Active » Needs review
s3b0un3t’s picture

Assigned: sonvir249 » Unassigned
Status: Needs review » Reviewed & tested by the community

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 !

kurttrowbridge’s picture

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!

flyke’s picture

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"
			}
nicobot’s picture

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

e0ipso made their first commit to this issue’s fork.

  • e0ipso committed daa45181 on 8.x-3.x authored by sonvir249
    Issue #3417787 by sonvir249, s3b0un3t, kurttrowbridge, flyke, nicobot:...