Skip to content

Unrecognized error number: 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated #237

Closed as not planned
@mvvvmd

Description

@mvvvmd

Describe the bug
When changing a user gidNumber I got the following error, the change was not made. This is on php 8.2, fix included in the report, i am not a developer and created the fix using ChatGPT.

Unrecognized error number: 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated

To Reproduce
Steps to reproduce the behavior:

  1. Go to a user record
  2. Change the gidNumber
  3. Apply the change
  4. See error

Expected behavior
The change should be made.

LDAP Server details (please complete the following information):

  • OS: Ubuntu 20.04
  • Server Name: OpenLDAP
  • Version: 2.4.49

Additional context

This error is on php 8.2, I resolved the issue by changing a function in lib/PageRender.php starting on line 920 to:

protected function getAutoPostPasswordAttribute($attribute, $i) {
                // Extract the string data from the PasswordAttribute object
                $attributeString = $attribute->getValue(0);  // Using index 0 as an example

                // If the attribute is null or already encoded, return early
                if ($attributeString === null || preg_match('/^\{.+\}.+/', $attributeString)) {
                return;
        }

        // Otherwise, proceed with password encryption and post
        $attribute->setPostValue(array('function'=>'PasswordEncrypt','args'=>sprintf('%%enc%%;%%%s%%', $attribute->getName())));
        $this->get('Post', $attribute, $i);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    oldOld version of PLA, may not be fixed.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions