Problem/Motivation

After switching to PHP 8.2 the module started throwing the following errors:

Deprecated function: Creation of dynamic property Drupal\drupalauth4ssp\SspHandler::$config is deprecated in Drupal\drupalauth4ssp\SspHandler->__construct() (line 32 of modules/contrib/drupalauth4ssp/src/SspHandler.php).

Deprecated function: Creation of dynamic property Drupal\drupalauth4ssp\SspHandler::$pathMatcher is deprecated in Drupal\drupalauth4ssp\SspHandler->__construct() (line 33 of modules/contrib/drupalauth4ssp/src/SspHandler.php).

Deprecated function: Creation of dynamic property Drupal\drupalauth4ssp\SspHandler::$request is deprecated in Drupal\drupalauth4ssp\SspHandler->__construct() (line 34 of modules/contrib/drupalauth4ssp/src/SspHandler.php).

This is caused by the properties mentioned in the warning not being defined in SspHandler class before they were used. PHP 8.2 deprecated usage of dynamic properties.

Steps to reproduce

Install the module on Drupal 10 with PHP 8.2. The warning will be displayed on every page request.

Proposed resolution

Define mentioned properties in the class.

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

Spleshka created an issue. See original summary.

Spleshka changed the visibility of the branch 3414009-php-8.2-deprecated to hidden.

Spleshka changed the visibility of the branch 3414009-php-8.2-deprecated to active.

spleshka’s picture

Status: Active » Needs review

keshavv’s picture

StatusFileSize
new673 bytes
realityloop’s picture

Status: Needs review » Reviewed & tested by the community

This resolves the issue on my project.

khaldoon_masud’s picture

Could you also include Drupal\drupalauth4ssp\SspHandler::$sspSession property. it is also producing the deprecated warning.

Deprecated function: Creation of dynamic property Drupal\drupalauth4ssp\SspHandler::$sspSession is deprecated in Drupal\drupalauth4ssp\SspHandler->getSspSession() (line 134 of /code/web/modules/contrib/drupalauth4ssp/src/SspHandler.php

rosk0’s picture

Category: Bug report » Task
Status: Reviewed & tested by the community » Needs work

Recategorising as this is not really a bug.

Needs work for #8 and rebase on the latest changes in the 2.x branch which now has GitLab CI configured together with the PHPStan.

PHPStan base line have all the warning that must be resolved, except those two

  1. Access to constant DRUPALAUTH_EXTERNAL on an unknown class
  2. Access to constant DRUPALAUTH_EXTERNAL_USER_ID on an unknown class

samit.310@gmail.com made their first commit to this issue’s fork.

samitk’s picture

Status: Needs work » Needs review

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

rex.barkdoll’s picture

I just installed this and it got the error to go away, happy with it working :)

johan_vm’s picture

StatusFileSize
new4.54 KB

Made a patch of the latest MR.

johan_vm’s picture

StatusFileSize
new1.06 KB

The MR only applies on the dev branch, made another patch for 2.0.0-rc1

fls’s picture

#15 worked for me. the warning message seems gone

  • rosk0 committed 142f534b on 2.x authored by spleshka
    Issue #3414009 by samit.310@gmail.com, spleshka, elaman: PHP 8.2...
rosk0’s picture

Status: Needs review » Fixed

Thanks

  • rosk0 committed 142f534b on php-8.3 authored by spleshka
    Issue #3414009 by samit.310@gmail.com, spleshka, elaman: PHP 8.2...

  • rosk0 committed 142f534b on 3228805 authored by spleshka
    Issue #3414009 by samit.310@gmail.com, spleshka, elaman: PHP 8.2...

Status: Fixed » Closed (fixed)

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