From b1ee3460b103408ac952144191dc8ac027a8ca9a Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 28 Jun 2023 11:29:55 +0200 Subject: [PATCH] LSldapObject::validateAttrsData(): fix handling attribute generation of empty required attributes even if their new value have been provided --- src/includes/class/class.LSldapObject.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/includes/class/class.LSldapObject.php b/src/includes/class/class.LSldapObject.php index 8ad88246..78995efe 100644 --- a/src/includes/class/class.LSldapObject.php +++ b/src/includes/class/class.LSldapObject.php @@ -507,8 +507,15 @@ class LSldapObject extends LSlog_staticLoggerClass { if (!$this -> validateAttrData($LSform, $attr, $justCheck)) { $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) || (empty($attr_values) && $attr -> isRequired()) ) {