From 35f293e8714bffa8c54dd841e3defddab9f32d9a Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 9 Mar 2010 17:40:22 +0100 Subject: [PATCH] LSattribute :: generateValue() : Fixed bug when generated value is empty. --- public_html/includes/class/class.LSattribute.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public_html/includes/class/class.LSattribute.php b/public_html/includes/class/class.LSattribute.php index 3fd10983..153903b7 100644 --- a/public_html/includes/class/class.LSattribute.php +++ b/public_html/includes/class/class.LSattribute.php @@ -472,6 +472,7 @@ class LSattribute { * @retval boolean true si la valeur à put être générée, false sinon */ function generateValue() { + $value=false; if (function_exists($this -> config['generate_function'])) { $value=call_user_func($this -> config['generate_function'],$this -> ldapObject); } @@ -481,11 +482,16 @@ class LSattribute { else if (is_string($this -> config['default_value']) && strlen($this -> config['default_value'])>0) { $value = $this -> config['default_value']; } - if (!empty($value)) { - if (!is_array($value)) { - $value=array($value); + if ($value!==false) { + if (!empty($value)) { + if (!is_array($value)) { + $value=array($value); + } + $this -> updateData=$value; + } + else { + $this -> updateData=array(); } - $this -> updateData=$value; return true; } return;