TypeError: OAuth2Manager::getScopes(): Return value must be a string

Created on 30 December 2024, 4 months ago

Problem/Motivation

When the Scope variable is not set, it can return a NULL, even though the function definition states that it expects a string. A NULL string is not a string, we should then return an empty string.

Steps to reproduce

Install the module without setting any configs, and attempt to log in.

Proposed resolution

Protect against returning a null value.

Remaining tasks

Merge the patch.

User interface changes

Nothing.

API changes

Nothing.

Data model changes

Nothing.

🐛 Bug report
Status

Needs review

Version

4.1

Component

Code

Created by

🇨🇦Canada RobLoach Earth

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

Merge Requests

Comments & Activities

  • Issue created by @RobLoach
  • First commit to issue fork.
  • Merge request !34Return either string or null → (Open) created by valic
  • 🇭🇷Croatia valic Osijek

    I am more in favor of declaring that it can be either NULL or string.

    getScopes as I see is called upon like this

        $extra_scopes = $this->getScopes();
        if ($extra_scopes) {
          $scopes = array_merge($scopes, explode(',', $extra_scopes));
        }
    

    where it's better that we return either NULL or correct string

  • 🇮🇳India rajdip_755 kolkata

    Assigning to myself for review.

  • Pipeline finished with Success
    3 months ago
    Total: 168s
    #397789
  • Pipeline finished with Success
    2 months ago
    Total: 165s
    #419774
  • Pipeline finished with Success
    2 months ago
    Total: 176s
    #419783
  • 🇮🇳India rajdip_755 kolkata

    I reviewed the MR's code, and it looks good to me.
    Moving the issue to RTBC. Thanks!

Production build 0.71.5 2024