Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

CASAuthentication CASUser constructor getting attributes from phpCAS #69

@achantrill

Description

@achantrill

I have found what appears to be a typo in the CASAuthentication code, in the constructor for the CASUser class. The following block (lines 301-306):

    foreach (self::$attributeMap as $property => $attribute) {
        if (phpCAS::hasAttribute($attribute)) {
            $method = 'set'.$property;
            $this->$method(phpCAS::getAttribute($property));
        }
    }

is checking to see if phpCAS has an attribute of $attribute, but then when it tries to retrieve the attribute, it uses getAttribute($property). It should instead look like this:

    foreach (self::$attributeMap as $property => $attribute) {
        if (phpCAS::hasAttribute($attribute)) {
            $method = 'set'.$property;
            $this->$method(phpCAS::getAttribute($attribute));
        }
    }

using the $attribute when using the phpCAS::getAttribute method. Otherwise, unless you have your properties exactly matching your attributes in your configuration file, you will get empty strings for all of your user properties.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions