Unquote collapsed field elements when retrieving them.
authorGunnar Wrobel <p@rdus.de>
Sat, 11 Apr 2009 07:23:55 +0000 (09:23 +0200)
committerGunnar Wrobel <p@rdus.de>
Sat, 11 Apr 2009 07:23:55 +0000 (09:23 +0200)
framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php

index 2647a7e..c607da8 100644 (file)
@@ -379,7 +379,7 @@ class Horde_Kolab_Server_Object
         } else {
             $fields = explode($separator, $base);
         }
-        return isset($fields[$this->attributes[$attr]['order']]) ? $fields[$this->attributes[$attr]['order']] : null;
+        return isset($fields[$this->attributes[$attr]['order']]) ? $this->unquote($fields[$this->attributes[$attr]['order']]) : null;
     }
 
     /**
@@ -417,7 +417,6 @@ class Horde_Kolab_Server_Object
             $result = '';
             for ($i = 0; $i < $empty; $i++) {
                 $akey = array_shift($attributes);
-                //FIXME: We don't handle multiple values correctly here
                 $value = isset($info[$akey]) ? $info[$akey] : '';
                 if (is_array($value)) {
                     $value = $value[0];
@@ -436,7 +435,7 @@ class Horde_Kolab_Server_Object
     }
 
     /**
-     * Quote field separaotrs within a LDAP value.
+     * Quote field separators within a LDAP value.
      *
      * @param string $string The string that should be quoted.
      *
@@ -556,10 +555,6 @@ class Horde_Kolab_Server_Object
             }
         }
 
-        foreach ($collapse as $key => $attributes) {
-            $this->collapse($key, $attributes, $info);
-        }
-
         if (!$this->exists()) {
             foreach ($this->attribute_map['required'] as $key) {
                 if (!in_array($key, array_keys($info)) || $info[$key] === null
@@ -642,6 +637,10 @@ class Horde_Kolab_Server_Object
             }
         }
 
+        foreach ($collapse as $key => $attributes) {
+            $this->collapse($key, $attributes, $info);
+        }
+
         $result = $this->server->save($this->uid, $info, $this->exists());
 
         if (!$this->_exists) {