8.x-1.2 not compatible with PHP 7.4

Created on 21 May 2023, over 1 year ago
Updated 5 August 2023, over 1 year ago

Problem/Motivation

For anyone still on PHP 7.4, note that 8.x-1.2 dies with syntax error PHP Parse error: syntax error, unexpected '|', expecting ';' or '{' in /var/www/html/drupal/web/modules/contrib/fixed_block_content/src/Normalizer/BlockContentNormalizer.php on line 22

Steps to reproduce

Run Drupal on PHP 7.4. Try updating to Fixed Block Content 8.x-1.2

Proposed resolution

Offer warning re PHP version required, or patch to use temporarily until sites are updated to PHP 8.1+

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇳🇿New Zealand jonathan_hunt

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

Comments & Activities

  • Issue created by @jonathan_hunt
  • 🇫🇷France aiphes

    Hello,

    Same here after update on D9.5.9:

    Parse error: syntax error, unexpected '|', expecting ';' or '{' in /home/www/sited9/web/modules/contrib/fixed_block_content/src/Normalizer/BlockContentNormalizer.php on line 22
    

    Rollback to previous for the moment.
    Downgrading drupal/fixed_block_content (1.2.0 => 1.1.0)

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇺🇸United States stephenplatz

    This affects both 8.x-1.x-dev and 8.x-1.2, since union return types were made available in php 8. Would using phpdoc annotations be an alternative?

  • 🇺🇸United States stephenplatz

    Looks like the change to src/Normalizer/BlockContentNormalizer.php was just added from the automated patch for Drupal 10 readiness in this commit. Does PHP 8.1 require union types? If not, I think that this part could be left out to support older versions of PHP.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    PHP 8.1 does not require to use union types. They help because PHP detects when the wrong type is used and the type can be either one or another type.
    For backward-compatibility, they should not be used. I would rather use them in a branch that requires PHP 8.1.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    16 pass
  • @stephenplatz opened merge request.
  • 🇫🇷France aiphes

    Hello

    Still there, so which version can we use on D9.5.10 ?
    [error] ParseError: syntax error, unexpected '|', expecting ';' or '{' in Composer\Autoload\includeFile() (line 22 of /home/www/xx/sited9/web/modules/contrib/fixed_block_content/src/Normalizer/BlockContentNormalizer.php) #0 /home/www/xx/sited9/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/home/...')

    Thanks

  • 🇸🇰Slovakia kaszarobert

    I guess until this is committed, on Drupal 9 stick to https://www.drupal.org/project/fixed_block_content/releases/8.x-1.1 . But I don't see a big chance for that since PHP 7.4 is EOL and everyone should migrate to a newer PHP to stay secure, plus Drupal 9 is close to the November 2023 EOL, too.

    Drupal 10 works on PHP 8.1<= only, so there should be no problem there. If the maintainer does not wish to fix this issue, then the required minimum PHP version should be stated in the module's composer.json at least.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    12 fail
  • @stephenplatz opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    16 pass
  • 🇺🇸United States stephenplatz

    Apparently removing the union types makes the module incompatible with HAL 2.x, which is required for Drupal 10. Drupal 9 can use HAL 1.x.

  • 🇫🇷France aiphes

    Hello, this explain why it's impossible to update HAL too.
    drupal/hal 1.0.3 2.0.1 Hypermedia Application Language (HAL)

  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    16 pass
  • 🇪🇸Spain manuel.adan 🌌

    We need a HAL < 2.x compatible normalizer class. Initial approach.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
Production build 0.71.5 2024