Problem/Motivation

I am getting the following error

Uncaught PHP Exception Error: "Typed property Drupal\simple_oauth\Server\ResourceServer::$subject must not be accessed before initialization"

When typed properties were introduced into classes in Php7.4, it became essential to initialise them before they were accessed. This is usually done in the class constructor, but it can be done by specifying a default value in the class where the property is defined.

This gives the potential for an error if the property is accessed before it is set, which is happening in my case.

Steps to reproduce

Proposed resolution

To avoid this problem, it would be useful to assign a default value to the typed property in the class ResourceServer where it is defined. This could be done with a statement like:

protected ?LeagueResourceServer $subject = NULL;

Remaining tasks

User interface changes

API changes

Data model changes

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

gnanagowthaman sankar’s picture

Status: Active » Needs review
StatusFileSize
new452 bytes

Please review and let me know for the changes.

dmgig’s picture

I get this error as well. Thank you.

bojan_dev’s picture

Status: Needs review » Fixed

Looks good to me, TY!

Status: Fixed » Closed (fixed)

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