Usage of PHP union type causing syntax error on PHP 7.4

Created on 30 June 2023, over 1 year ago
Updated 26 July 2023, over 1 year ago

Problem/Motivation

In the commit c08473ea which fixed issue [ 🐛 Add a lock around retrieving upstream files Fixed ] this module requires php ^8.0 because of the parameter type union in this method declaration, however this is not declared in the module info.yml nor in the composer.json, which causes auto-updates to apply even when the module is not compatible.

Steps to reproduce

1. Run Drupal 9 on php7.4
2. Update from 2.0.2 to 2.0.3
3. ParseError: syntax error, unexpected '|', expecting variable (T_VARIABLE) in Composer\Autoload\includeFile() (line 90 of ./modules/contrib/stage_file_proxy/src/EventSubscriber/StageFileProxySubscriber.php).

Proposed resolution

Release a new version ASAP with a fix.
IMHO there are only two fixes possible:
- Fix the method declaration to be compatible with php 7.4
- Require php 8 in composer.json and info.yml

Ideally I'd recommend doing both things, because if you only publish a new release which requires php 8 from composer perspective the 2.0.3 release will be the latest compatible with php 7.4, so people will need to add this specific version in a blocklist!

Ideally i believe the correct path for a fix should be:

  1. Release 2.0.4 with PHP 7.4 compatiblity
  2. If PHP 8 would be required, then release a minor release 2.1.0 and add the php8 requirement

Remaining tasks

TBD

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇳🇴Norway esolitos Trondheim

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

Comments & Activities

Production build 0.71.5 2024