Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mvvvmd opened this issue Sep 26, 2023 · 4 comments
Labels
old Old version of PLA, may not be fixed.

Comments

@mvvvmd
Copy link

mvvvmd commented Sep 26, 2023

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);
}
@williamdes
Copy link

What version of phpLDAPadmin are you using ?

@mvvvmd
Copy link
Author

mvvvmd commented Sep 27, 2023

The latest from this repo, v1.2.6.6

@williamdes
Copy link

Thank you!
By the way the phpldapadmin package is available in newer Debian/Ubuntu versions.

@leenooks leenooks added the old Old version of PLA, may not be fixed. label Jan 8, 2024
@Farhanbruh
Copy link

hello, i am new to linux. I was facing the same problem but instead of "parameter #2", my error shows "parameter #1". Should i follow the same solution given here or does anything have to be different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
old Old version of PLA, may not be fixed.
Projects
None yet
Development

No branches or pull requests

4 participants