LSldapObject::validateAttrsData(): fix handling attribute generation of empty required attributes even if their new value have been provided

This commit is contained in:
Benjamin Renard 2023-06-28 11:29:55 +02:00
parent 0eb0143921
commit b1ee3460b1
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -507,8 +507,15 @@ class LSldapObject extends LSlog_staticLoggerClass {
if (!$this -> validateAttrData($LSform, $attr, $justCheck)) { if (!$this -> validateAttrData($LSform, $attr, $justCheck)) {
$retval = false; $retval = false;
} }
// Attribute not empty, remove it from force generated attributes list (if present)
if (
!empty($attr_values
&& ($key = array_search($attr_name, $forceGeneration)) !== false)
) {
unset($forceGeneration[$key]);
}
} }
else if( if(
in_array($attr_name, $forceGeneration) in_array($attr_name, $forceGeneration)
|| (empty($attr_values) && $attr -> isRequired()) || (empty($attr_values) && $attr -> isRequired())
) { ) {