Closed (fixed)
Project:
Google Tag
Version:
2.0.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Apr 2023 at 16:30 UTC
Updated:
7 Jun 2023 at 13:09 UTC
Jump to comment: Most recent
after updating Drupal from 9.5.5 to 9.5.8 I received WSOD and after enabling error verbose I see this critical error:
syntax error, unexpected 'private' (T_PRIVATE), expecting variable (T_VARIABLE) web/modules/contrib/google_tag/src/EventSubscriber/ResponseSubscriber.php:29
install and enable the module, update Drupal to 9.5.8
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
Comment #2
almador commentedMaybe this is related to php version?
I'm on Pantheon and it is set to 7.4
Comment #3
abarrioHi all.
the problem here is that on class ResponseSubscriber the code is using a functionality wich has been introduced on php 8.0.
You can see it here: https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion
So I think a restriction should be added on composer to be installed on php 8.0+ platforms.
Comment #4
abarrioComment #5
unqunqI'm getting the same error and I am on PHP 7.4. I tried upgrading but my site still uses some dependencies which are not ready for PHP 8+ making this impossible to use.
If anyone wants to get this working on PHP 7.4 then here is an article about the property promotion in PHP 8. https://stitcher.io/blog/constructor-promotion-in-php-8
I haven't tested the actual functionality of the module past fixing this file so there could be a lot more PHP 8 related parts that need downgraded in order to make this work with PHP 7.4
So I guess we just need to follow @abarrio's suggestion.
Edit:
I installed a lower version of this module and I got no errors:
composer require 'drupal/google_tag:^1.6'Comment #7
japerryCan confirm. Module supports D9 and 7.4 via composer, but has PHP8+ syntax. An upcoming patch is going to remove PHP8+ syntax. In the meantime, I added PHP 7.4 testing, which should fail here.
Comment #10
japerryComment #11
pianomansam commentedCan we get a release with this fix included?
Comment #12
tim corkerton commentedI am on PHP7.4 Obviously I'd like the latest version but I am encountering this issue.
What is the recommended approach given that upgrading to PHP8 is not an option right now?
Comment #13
japerryYup, there should be a release by next tuesday (May 23). It wasn't our intention to drop support for PHP 7.4, so you can get the fix by updating to head or waiting until Tuesday for the full release.
Comment #14
tim corkerton commentedThank you. I can confirm this works well with PHP7.4