Problem/Motivation

We are running Drupal 10.5.8 on PHP 8.2. After installing altcha 1.1.0-rc1, I get a syntax error on, for instance, running 'drush updatedb':

PHP Parse error:  syntax error, unexpected identifier "SAAS_API_CHALLENGE_PATH", expecting "=" in /Users/bbulger/espo/local/espodocker/www/drupal9/web/modules/contrib/altcha/src/Form/AltchaSettingsForm.php on line 23

The problem seems to be the type on the constant in the AltchaSettingsForm class:

  const string SAAS_API_CHALLENGE_PATH = '/api/v1/challenge';

Typing the constant is not valid prior to PHP 8.3.

The real question is, are there other dependencies that require PHP 8.3, or can I just patch these declarations until we upgrade?

Issue fork altcha-3563474

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

brad.bulger created an issue. See original summary.

robindh’s picture

Status: Active » Needs work

There shouldn't be any other dependencies that require php 8.3. These type declarations are something that unfortunately slipped in with features for the latest release candidate.

According to phpstorm, there are 8 incompatibilities in 4 files:

  • AltchaSettingsForm.php
  • ObfuscateEmailFormatterTest.php
  • ObfuscateStringFormatterTest.php
  • ObfuscateTelephoneFormatterTest.php



When these are patched, there shouldn't be any more php 8.2 incompatibility problems. Feel free to create a merge request!

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

elfakhar’s picture

Removed PHP 8.3 typed constants to ensure PHP 8.2 compatibility. Would appreciate a review when someone has time
Thank you

elfakhar’s picture

Status: Needs work » Needs review

  • robindh committed 121afe1d on 1.0.x authored by elfakhar
    fix: #3563474 syntax error on PHP 8.2 on class const string
    
    By: brad....
robindh’s picture

Status: Needs review » Fixed

Merged in 1.0.x, thanks! Will be included in the 1.1.0 release

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.