[Owncloud] vcard::addFromDAVData() fix [patch]

oc.guillaume at zitta.fr oc.guillaume at zitta.fr
Sun Mar 25 15:05:34 UTC 2012


Hi,

$data is a vcard string
which is converted to an object => $card
and self::add is called with $data

This patch correct that and add a check at function argument level (like 
in edit function).

I don't know if ML is the correct media to purpose patches...

Regards,

Guillaume ZITTA

diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index 3736f18..15a6176 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -228,7 +228,7 @@ class OC_Contacts_VCard{
          * @param string $uri the uri of the card, default based on the UID
          * @return insertid on success or null if no card.
          */
-       public static function add($aid, $card, $uri=null){
+       public static function add($aid, OC_VObject $card, $uri=null){
                 if(is_null($card)){
                         
OC_Log::write('contacts','OC_Contacts_VCard::add. No vCard supplied', 
OC_Log::ERROR);
                         return null;
@@ -267,7 +267,7 @@ class OC_Contacts_VCard{
          */
         public static function addFromDAVData($id,$uri,$data){
                 $card = OC_VObject::parse($data);
-               return self::add($id, $data, $uri);
+               return self::add($id, $card, $uri);
         }

         /**




More information about the Owncloud mailing list