mstilkerich/rcmcarddav

Migration to new Debian release, plugin stacktrace issue

vanaalten opened this issue ยท 4 comments

Hi,

I've migrated from Debian 11 to the upcoming stable release. I had to reinstall my Roundcube plugins again and the RCMCardDAV plugin gives me issues:

Old (working) situation:

  • Debian 11
  • Roundcube 1.4.13
  • RCMCardDAV 4.0.4
  • PHP 7.4
  • Nextcloud 25 as CardDav server
  • mysql / MariaDB 10.5.19

New situation:

  • Debian 12
  • Roundcube 1.6.1
  • RCMCardDAV 5.0.1
  • PHP 8.2
  • Nextcloud 26 as CardDav server
  • mysql / MariaDB 10.11.2

RCMCardDav is manually installed, not using composer. Using the config.inc.php.dist without any modifications (except setting the loglevels to DEBUG) for config.inc.php.

What works:

  • I can add a new CardDAV account
  • URL is correctly expanded to the CardDAV URL
  • When resyncing, I see that the plugin receives vcards from the CardDAV server (lots of "VCF for (...) received via multiget")

Still, I get "Server Error! (Internal Server Error)" when I do a re-sync and my contacts list gives an "Oops... something went wrong!".

In /var/log/roundcube/errors.log, I do get this:

[30-May-2023 12:31:28 UTC] PHP Deprecated: Return type of Sabre\VObject\Node::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Sabre/VObject/Node.php on line 70
[30-May-2023 12:31:28 UTC] PHP Deprecated: Return type of Sabre\VObject\Node::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Sabre/VObject/Node.php on line 122
[30-May-2023 12:31:28 UTC] PHP Deprecated: Return type of Sabre\VObject\Node::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Sabre/VObject/Node.php on line 137
[30-May-2023 12:31:28 UTC] PHP Deprecated: Return type of Sabre\VObject\Node::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Sabre/VObject/Node.php on line 153
[30-May-2023 12:31:28 UTC] PHP Deprecated: Return type of Sabre\VObject\Node::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Sabre/VObject/Node.php on line 173
[30-May-2023 12:31:28 UTC] PHP Deprecated: Return type of Sabre\VObject\Node::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Sabre/VObject/Node.php on line 102
[30-May-2023 12:31:28 UTC] PHP Fatal error: Uncaught Error: Call to undefined method Sabre\VObject\Component\VCard::getDocumentType() in /var/lib/roundcube/plugins/carddav/src/DataConversion.php:323
Stack trace:
#0 /var/lib/roundcube/plugins/carddav/src/SyncHandlerRoundcube.php(345): MStilkerich\RCMCardDAV\DataConversion->toRoundcube()
#1 /var/lib/roundcube/plugins/carddav/src/SyncHandlerRoundcube.php(145): MStilkerich\RCMCardDAV\SyncHandlerRoundcube->updateContactCard()
#2 /var/lib/roundcube/plugins/carddav/vendor/mstilkerich/carddavclient/src/Services/Sync.php(162): MStilkerich\RCMCardDAV\SyncHandlerRoundcube->addressObjectChanged()
#3 /var/lib/roundcube/plugins/carddav/vendor/mstilkerich/carddavclient/src/Services/Sync.php(57): MStilkerich\CardDavClient\Services\Sync->synchronizeOneBatch()
#4 /var/lib/roundcube/plugins/carddav/src/Addressbook.php(1248): MStilkerich\CardDavClient\Services\Sync->synchronize()
#5 /var/lib/roundcube/plugins/carddav/src/Frontend/AddressbookManager.php(676): MStilkerich\RCMCardDAV\Addressbook->resync()
#6 /var/lib/roundcube/plugins/carddav/carddav.php(437): MStilkerich\RCMCardDAV\Frontend\AddressbookManager->resyncAddressbook()
#7 /usr/share/roundcube/program/lib/Roundcube/rcube_plugin_api.php(518): carddav->getAddressbook()
#8 /usr/share/roundcube/program/include/rcmail.php(346): rcube_plugin_api->exec_hook()
#9 /usr/share/roundcube/program/actions/contacts/index.php(560): rcmail->get_address_book()
#10 /usr/share/roundcube/program/actions/contacts/index.php(491): rcmail_action_contacts_index::contact_groups()
#11 /usr/share/roundcube/program/include/rcmail_output_html.php(1484): rcmail_action_contacts_index::directory_list()
#12 [internal function]: rcmail_output_html->xml_command()
#13 /usr/share/roundcube/program/include/rcmail_output_html.php(1322): preg_replace_callback()
#14 /usr/share/roundcube/program/include/rcmail_output_html.php(825): rcmail_output_html->parse_xml()
#15 /usr/share/roundcube/program/include/rcmail_output_html.php(654): rcmail_output_html->parse()
#16 /usr/share/roundcube/program/include/rcmail.php(296): rcmail_output_html->send()
#17 /usr/share/roundcube/index.php(278): rcmail->action_handler()
#18 {main}
thrown in /var/lib/roundcube/plugins/carddav/src/DataConversion.php on line 323

--

Any ideas on what I'm doing wrong? Or what other information I should provide to clarify what is wrong? I'm guessing I've probably got something leftover from the old setup that is somehow making a mess, but no idea what I can do about that.

Thanks,
Matthijs

Hello,

the PHP deprecations in 8.2 are no critical issues. Normally the error reporting level on production system is such that PHP does not report deprecations. You can get rid of these by setting the error reporting setting accordingly in you php.ini file. Or just ignore them. Hopefully there will be a new release of sabre vobject that is fully PHP 8.2 compatible before these deprecations turn into errors.

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

Regarding the actual fatal error about the missing VCard::getDocumentType() method, I don't have a real idea, because this method exists in VCard for 10 years now.

Can you double check that the method actually exists?

In the roundcube root directory, search for VCard.php:

find -name VCard.php

You should only have one candidate that lives in a Component subdirectory. If you have multiple candidates, there could be an issue with incompatible versions of libraries installed, which can happen if you install the plugin from the tarball. Anyway, check the file you found regarding whether it contains the getDocumentType method.

I see you are using roundcube from the debian package, which splits the package into a part in /usr/share/roundcube and a part in /var/lib/roundcube. Therefore please run the find command on both of these directories, maybe there is some leftover version of older libraries. And also check php libs installed via debian packages. I see there is an ancient vobject version packaged in debian.

find /var/lib/roundcube /usr/share/roundcube /usr/share/php -name VCard.php

And the old packaged version of sabre vobject in debian does not yet contain the getDocumentType(), so my guess would be that this directory is in the PHP search path and actually this old version of vobject is used, which is not compatible to rcmcarddav.

Hi,

Thanks for the fast response and excellent remote debugging!

root@vanaalten:/ # find /var/lib/roundcube /usr/share/roundcube /usr/share/php -name VCard.php
/var/lib/roundcube/plugins/carddav/vendor/sabre/vobject/lib/Splitter/VCard.php
/var/lib/roundcube/plugins/carddav/vendor/sabre/vobject/lib/Component/VCard.php
/usr/share/php/Sabre/VObject/Component/VCard.php
/usr/share/php/Sabre/VObject/Splitter/VCard.php

Four results. And the only one with getDocumentType:
root@vanaalten:/ # find /var/lib/roundcube /usr/share/roundcube /usr/share/php -name VCard.php -exec grep -il getdocumenttype {} ;
/var/lib/roundcube/plugins/carddav/vendor/sabre/vobject/lib/Component/VCard.php

...is the version delivered with RCMCardDav.

My guess is that the VCard.php in any 'Splitter' directory is not relevant, so that the /usr/share/php/Sabre/VObject/Component/VCard.php is probably an older version. Cannot be sure because in the RCMCardDav delivered version I don't see a version or date indication... but, it is 6 times as large as the /usr/share/php version.

Uninstalling Debian package php-sabre-vobject (and, I guess for dependency reasons, php-sabre-dav):
sudo apt remove --purge php-sabre-vobject

...restarting Apache, adding a CardDav account and RCMCardDav works again, I can access all my contacts. :-)

And for completeness:
root@vanaalten:/ # find /var/lib/roundcube /usr/share/roundcube /usr/share/php -name VCard.php
/var/lib/roundcube/plugins/carddav/vendor/sabre/vobject/lib/Splitter/VCard.php
/var/lib/roundcube/plugins/carddav/vendor/sabre/vobject/lib/Component/VCard.php

... no VCard.php in /usr/share/php left.

Thanks again!
Matthijs