christian-putzke / Roundcube-CardDAV

Roundcube CardDAV Plugin
http://www.graviox.de
GNU Affero General Public License v3.0
119 stars 28 forks source link

Type error when calling `carddav_addressbook_sync` from `carddav_add` #87

Open bcollet opened 10 years ago

bcollet commented 10 years ago

Hi,

In carddav_addressbook.php when calling the carddav_add function from the carddav_addressbook_sync function, false is passed as the second parameter. However the !== operator is used in carddav_addressbook_sync to check this parameter against null, making the test ending in being always true (false and null are not of the same type).

Proposed fix:

index a7ca7b8..df3df4d 100644
--- a/carddav_addressbook.php
+++ b/carddav_addressbook.php
@@ -653,7 +653,7 @@ class carddav_addressbook extends rcube_addressbook
                if ($carddav_backend->check_connection())
                {
                        $vcard_id = $carddav_backend->add($vcard);
-                       $this->carddav_addressbook_sync($server, false, $vcard_id);
+                       $this->carddav_addressbook_sync($server, null, $vcard_id);

                        return $rcmail->db->insert_id(get_table_name('carddav_contacts'));
                }