Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default addressbookserver.php not working in sabre 4 #1178

Closed
drencrom opened this issue Aug 9, 2019 · 14 comments · Fixed by #1191
Closed

Default addressbookserver.php not working in sabre 4 #1178

drencrom opened this issue Aug 9, 2019 · 14 comments · Fixed by #1191

Comments

@drencrom
Copy link

drencrom commented Aug 9, 2019

I am testing the default addressbookserver.php with sabre 4.0.0. I can login and access the addressbook using a web browser with no errors. When I try using a cardDAV client (thunderbird CardBook plugin) I get this error:

Request:

<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav">
  <D:prop>
    <D:resourcetype/>
    <D:displayname/>
  </D:prop>
</D:propfind>

Response:

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:sabredav-version>4.0.0</s:sabredav-version>
  <s:exception>TypeError</s:exception>
  <s:message>explode() expects parameter 2 to be string, null given</s:message>
</d:error>

Is it a bug with the client because it is sending empty parameters? The client works fine with an owncloud server (which I think also uses sabre)

@DeepDiver1975
Copy link
Member

The client works fine with an owncloud server (which I think also uses sabre)

but an older version of sabre dav is used ;-)


Is it a bug with the client because it is sending empty parameters?

Looks like an error in the sabre dav code. I assume you are running this in Apache? Can you please have a look in the error log for more details on the error. I'd expect to see some source code file and a line number.

THX

@drencrom
Copy link
Author

drencrom commented Aug 9, 2019

Sadly I there is no information in the apache log file. I had some problems with the sqlite database earlier that generated errors in the log file but I get nothing new in this case. Is there some setting in sabre to enable additional logging?

@DeepDiver1975
Copy link
Member

<s:exception>TypeError</s:exception>
<s:message>explode() expects parameter 2 to be string, null given</s:message>

this is a fatal php error - this results in a http status code 500 and apache is always logging this in the error log.

@ByteHamster
Copy link
Member

this is a fatal php error - this results in a http status code 500 and apache is always logging this in the error log.

sabre/dav does not log exceptions by default, even not fatal ones. That made debugging the error in #1169 hard. We added logging to Baikal a few days ago by using $this->server->on('exception', [$this, 'exception']);

@drencrom
Copy link
Author

So, is there anything I can change to add log to the v4.0.0 I have installed or should i try with the trunk?

@ByteHamster
Copy link
Member

You can add something like this where the server is set up:
https://github.com/sabre-io/Baikal/pull/788/files

@drencrom
Copy link
Author

Ok, now i have the error log:

TypeError: explode() expects parameter 2 to be string, null given in /var/www/html/sabre/vendor/sabre/dav/lib/CardDAV/Plugin.php:689\nStack trace:\n#0 /var/www/html/sabre/vendor/sabre/dav/lib/CardDAV/Plugin.php(689): explode(';', NULL)\n#1 /var/www/html/sabre/vendor/sabre/event/lib/WildcardEmitterTrait.php(96): Sabre\\CardDAV\\Plugin->propFindLate(Object(Sabre\\DAV\\PropFind), Object(Sabre\\CardDAV\\AddressBook))\n#2 /var/www/html/sabre/vendor/sabre/dav/lib/DAV/Server.php(1053): Sabre\\DAV\\Server->emit('propFind', Array)\n#3 /var/www/html/sabre/vendor/sabre/dav/lib/DAV/Server.php(979): Sabre\\DAV\\Server->getPropertiesByNode(Object(Sabre\\DAV\\PropFind), Object(Sabre\\CardDAV\\AddressBook))\n#4 /var/www/html/sabre/vendor/sabre/dav/lib/DAV/Server.php(1649): Sabre\\DAV\\Server->getPropertiesIteratorForPath('addressbooks/ad...', Array, 1)\n#5 /var/www/html/sabre/vendor/sabre/dav/lib/DAV/CorePlugin.php(363): Sabre\\DAV\\Server->generateMultiStatus(Object(Generator), false)\n#6 /var/www/html/sabre/vendor/sabre/event/lib/WildcardEmitterTrait.php(96): Sabre\\DAV\\CorePlugin->httpPropFind(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#7 /var/www/html/sabre/vendor/sabre/dav/lib/DAV/Server.php(464): Sabre\\DAV\\Server->emit('method:PROPFIND', Array)\n#8 /var/www/html/sabre/vendor/sabre/dav/lib/DAV/Server.php(241): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#9 /var/www/html/sabre/addressbookserver.php(53): Sabre\\DAV\\Server->start()\n#10 {main}

It seems it is a special case for thunderbird that assumes the SOGO connector plugin is being used. As I said before I am using CardBook.

@drencrom
Copy link
Author

drencrom commented Aug 15, 2019

I changed the string "Thunderbird" for "SOGO" in the line 685 of Plugin.php and now it is working. Maybe the User-Agent check should check for SOGO explicitly. For example in my case the User-Agent says:

User-Agent: Thunderbird CardBook/37.5 Lightning/6.2.8

Maybe SOGO adds something unique that can be checked.

@evert
Copy link
Member

evert commented Aug 15, 2019

I find this a little strange. Sogo and Cardbook are alternatives, and cardbook never had an issue before. Before this gets a fix here, also please try to report a bug at the source. Only if a client is unwilling to fix a bug we should consider adding workarounds on this side.

@drencrom
Copy link
Author

Ok, reported here: https://gitlab.com/CardBook/CardBook/issues/661

@ByteHamster
Copy link
Member

The problem also occurs with other plugins that do not send a content type header. I think this is not a client side issue. Using strict_types in sabre/dav 4.0.0 has raised quite a few issues already and I guess this is one of them. There is a fix proposed in #1183

@drencrom
Copy link
Author

Are we talking about the content-type http header or something inside the carddav payload? CardBook sends content-type: application/xml in the http header.

@ByteHamster
Copy link
Member

Something inside the carddav payload.

@CardBook
Copy link

CardBook commented Sep 6, 2019

Hi

I'me the CardBook developper, and I'm facing a lot of users having this 503 issue, when will the fix be pushed ? or what should I add to CardBook to remove this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants