Closed as not planned
Description
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:
- Go to a user record
- Change the gidNumber
- Apply the change
- 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);
}