Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When I try install this module in Drupal 8.9.16 version, I found the follow error:
ParseError: syntax error, unexpected 'EntityTypeManagerInterface' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in Symfony\Component\ClassLoader\ApcClassLoader->loadClass() (line 21 of modules/contrib/jsonapi_image_styles/src/Form/JsonApiImageStylesAdminForm.php).
Steps to reproduce
Install in Drupal 8.9.16 version
Comment | File | Size | Author |
---|---|---|---|
#4 | after applying the patch.png | 336.82 KB | Takuma Shimabukuro |
#2 | 3229668-2.patch | 528 bytes | larisse |
Comments
Comment #2
larisse CreditAttribution: larisse at CI&T commentedHere's a patch to fix this error.
Is necessary apply the patch in #3229545: TypeError: Argument 1 passed to Drupal\jsonapi_image_styles\EventSubscriber\ConfigSubscriber::onResponse() must be an instance of Symfony\Component\HttpKernel\Event\ResponseEvent, instance of Symfony\Component\HttpKernel\Event\FilterResponseEvent given too to install this module.
Comment #3
Takuma Shimabukuro CreditAttribution: Takuma Shimabukuro at CI&T commentedComment #4
Takuma Shimabukuro CreditAttribution: Takuma Shimabukuro at CI&T commentedI revewed the patch and after the apply this patch i could install correctly in my enviroment
I attached the image that it works
Comment #5
GuyPaddock CreditAttribution: GuyPaddock at Inveniem commentedTechnically, the previous syntax should be valid for PHP 7.4. @larisse and @Takuma Shimabukuro: What version of PHP are you using?
Comment #6
larisse CreditAttribution: larisse at CI&T commentedHi @GuyPaddock! I'm using PHP 7.4.3 version.
Comment #7
GuyPaddock CreditAttribution: GuyPaddock commentedThe reason I ask is because I am running PHP 7.4 as well and did not need to apply the patch because the syntax was valid for 7.4 variable type declarations: https://stitcher.io/blog/typed-properties-in-php-74
Comment #8
hamrant CreditAttribution: hamrant at Five Jars, Drupal Ukraine Community, Open Y for Drupal Ukraine Community commentedI have this issue on PHP 7.3.19. Security Support of the 7.3 version will be until 6 Dec 2021 - https://www.php.net/supported-versions.php, so, in my case will be simpler to use a patch for now and later update PHP. So maybe there is no point in committing this fix.
Anyway, @larisse, thanks for the fix!
Comment #9
wellsTechnically Drupal 9 still supports PHP 7.3 but given that security support for it ends in about two months I think we should continue to target 7.4 as a minimum version. As @hamrant notes folks who need PHP 7.3 support can use this patch.
Comment #10
lamp5So please tell me why you didn't set min php version in composer file? https://git.drupalcode.org/project/jsonapi_image_styles/-/blob/2.0.x/com...
You know that we are using this module on production ? this is not a stable, it is dev.... without any standards of release process.
Comment #11
wellsGood point. Happy to take an MR for that change. I took this module over as abandoned only a few weeks ago I can’t say I’ll intimately familiar with it (:
Comment #12
wellsAnd given the decision is #3229545: TypeError: Argument 1 passed to Drupal\jsonapi_image_styles\EventSubscriber\ConfigSubscriber::onResponse() must be an instance of Symfony\Component\HttpKernel\Event\ResponseEvent, instance of Symfony\Component\HttpKernel\Event\FilterResponseEvent given I’ll open this one back up as well for 2.x. Though let’s update this MR to set the minimum PHP version for the 2.x branch to 7.3.
Comment #14
wellsOn second thought that seems unnecessary since we can't technically enforce PHP 7.4 on the new 3.0.x branch. I'll update the project description to clarify this stuff after I get a 3.x release out. Thanks, all!