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.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 3414009-2.0.0-rc1-15.patch | 1.06 KB | johan_vm |
| #14 | 3414009-14.patch | 4.54 KB | johan_vm |
| #6 | 3414009-5.patch | 673 bytes | keshavv |
Issue fork drupalauth4ssp-3414009
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
Comment #4
spleshkaComment #6
keshavv commentedComment #7
realityloop commentedThis resolves the issue on my project.
Comment #8
khaldoon_masud commentedCould 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
Comment #9
rosk0Recategorising as this is not really a bug.
Needs work for #8 and rebase on the latest changes in the
2.xbranch which now has GitLab CI configured together with the PHPStan.PHPStan base line have all the warning that must be resolved, except those two
Access to constant DRUPALAUTH_EXTERNAL on an unknown classAccess to constant DRUPALAUTH_EXTERNAL_USER_ID on an unknown classComment #11
samitk commentedComment #13
rex.barkdoll commentedI just installed this and it got the error to go away, happy with it working :)
Comment #14
johan_vm commentedMade a patch of the latest MR.
Comment #15
johan_vm commentedThe MR only applies on the dev branch, made another patch for 2.0.0-rc1
Comment #16
fls commented#15 worked for me. the warning message seems gone
Comment #18
rosk0Thanks