sabre-io / Baikal

Baïkal is a Calendar+Contacts server
https://sabre.io/baikal/
GNU General Public License v3.0
2.5k stars 289 forks source link

PHP 8.2 dynamic properties deprecation warnings #1154

Closed AaronVanGeffen closed 7 months ago

AaronVanGeffen commented 1 year ago

Baikal version: 0.9.3

In PHP 8.2, dynamic class properties have been deprecated. Apparently, Sabre\DAV still uses some in at least two locations, leading to errors below.

Baikal is working again after quickly patching the two classes. I do not currently have time to upstream my changes, but I thought I'd report these findings either way, in case others run into similar issues. I have also filed an issue upstream: https://github.com/sabre-io/dav/issues/1445

PHP message: ErrorException: Creation of dynamic property Sabre\DAV\Xml\Property\Href::$autoPrefix is deprecated in /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/PropertyStorage/Backend/PDO.php:100
Stack trace:
#0 [internal function]: Baikal\Framework::exception_error_handler()
#1 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/PropertyStorage/Backend/PDO.php(100): unserialize()
#2 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/PropertyStorage/Plugin.php(84): Sabre\DAV\PropertyStorage\Backend\PDO->propFind()
#3 /usr/share/webapps/baikal/vendor/sabre/event/lib/WildcardEmitterTrait.php(89): Sabre\DAV\PropertyStorage\Plugin->propFind()
#4 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/Server.php(1052): Sabre\DAV\Server->emit()
#5 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/Server.php(984): Sabre\DAV\Server->getPropertiesByNode()
#6 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/Server.php(1662): Sabre\DAV\Server->getPropertiesIteratorForPath()
#7 /usr/share/webapps/baikal/v
PHP message: ErrorException: Creation of dynamic property Sabre\CardDAV\Xml\Request\AddressBookMultiGetReport::$addressDataProperties is deprecated in /usr/share/webapps/baikal/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php:104
Stack trace:
#0 /usr/share/webapps/baikal/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php(104): Baikal\Framework::exception_error_handler()
#1 [internal function]: Sabre\CardDAV\Xml\Request\AddressBookMultiGetReport::xmlDeserialize()
#2 /usr/share/webapps/baikal/vendor/sabre/xml/lib/Reader.php(234): call_user_func()
#3 /usr/share/webapps/baikal/vendor/sabre/xml/lib/Reader.php(75): Sabre\Xml\Reader->parseCurrentElement()
#4 /usr/share/webapps/baikal/vendor/sabre/xml/lib/Service.php(129): Sabre\Xml\Reader->parse()
#5 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/CorePlugin.php(679): Sabre\Xml\Service->parse()
#6 /usr/share/webapps/baikal/vendor/sabre/event/lib/WildcardEmitterTrait.php(89): Sabre\DAV\CorePlugin->httpReport()
AllesMeins commented 1 year ago

I've the same problem - could you tell me what exactly you did to fix it?

AaronVanGeffen commented 1 year ago

Per the error messages, I added two properties:

AllesMeins commented 1 year ago

Ah, perfect - thank you!

N0ury commented 1 year ago

same problem for me. @AaronVanGeffen fix worked for me too.

rodin-ia commented 1 year ago

Tnks! It also solved the problem with the display of contacts in InfCLoud.

codeandfix commented 1 year ago

Creation of dynamic property Sabre\CardDAV\Xml\Request\AddressBookMultiGetReport::$addressDataProperties is deprecated also malfunct

jwohlfeil commented 1 year ago

Works for me, too. I'm using PHP 8.2.

TCB13 commented 1 year ago

Also works for me in PHP 8.2. thanks!

gizmo15 commented 1 year ago

Works for me too with PHP 8.2.5, thanks!

cscholz commented 1 year ago

@AaronVanGeffen: Will there be a new Baikal Dav Version containing the fix or is an manuel modification required?

AaronVanGeffen commented 1 year ago

@AaronVanGeffen: Will there be a new Baikal Dav Version containing the fix or is an manuel modification required?

I don't maintain Baikal; I just filed the bug report.

antiftw commented 1 year ago

Hi,

I arrived here because of problems syncing my contacts from a personal Baikal server with DavX5 which suddenly stopped working after a server reinstall which entailed a PHP upgrade from 8.1 to 8.2

@cscholz as you can see here https://github.com/sabre-io/dav/pull/1446 there is an open pullrequest that needs to be merged. I also wrote a comment there asking if this might be done in the near future. Until then you can just modify the file manually, as can be seen here:

https://github.com/sabre-io/dav/commit/906bbb8969c8712e108bd6a721114cc199bb684c

anekinloewe commented 1 year ago

Works fine for me on debian 12.

PatrickJMaloney commented 1 year ago

@AaronVanGeffen Thanks for the fix. Using PHP 8.2.8.

gour commented 1 year ago

Thanks a lot! It helps to me as well on the server running Debian & PHP-8.2.10. :smile:

cl0rm commented 1 year ago

Thanks. Updated from Debian 11 to 12, this is needed for the adress book to work correctly

Fijxu commented 1 year ago

I wasn't able to see what contacts I had in my Address Book using Thunderbird 115 but adding those 2 lines fixed the problem.

Previously it was returning error 500 when the REPORT request was made. I hope this gets fixed so people don't need to change the files manually.

AaronVanGeffen commented 11 months ago

Looks like this is all fixed in the latest release. Thanks!

AaronVanGeffen commented 11 months ago

It seems I spoke too soon. Calendar syncing works without issue, but the issue with address books still remains:

2023/11/21 19:05:43 [error] 566#566: *20360 FastCGI sent in stderr:
"PHP message: ErrorException: Creation of dynamic property Sabre\DAV\Xml\Property\Href::$autoPrefix is deprecated in /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/PropertyStorage/Backend/PDO.php:100
Stack trace:
#0 [internal function]: Baikal\Framework::exception_error_handler()
#1 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/PropertyStorage/Backend/PDO.php(100): unserialize()
#2 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/PropertyStorage/Plugin.php(84): Sabre\DAV\PropertyStorage\Backend\PDO->propFind()
#3 /usr/share/webapps/baikal/vendor/sabre/event/lib/WildcardEmitterTrait.php(89): Sabre\DAV\PropertyStorage\Plugin->propFind()
#4 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/Server.php(1052): Sabre\DAV\Server->emit()
#5 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/Server.php(984): Sabre\DAV\Server->getPropertiesByNode()
#6 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/Server.php(1662): Sabre\DAV\Server->getPropertiesIteratorForPath()
#7 /usr/share/webapps/baikal/v" while reading response header from upstream

The fix for this is still what I reported back in February: https://github.com/sabre-io/Baikal/issues/1154#issuecomment-1427028654

Add protected $autoPrefix; to the Href class (baikal/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php)

DeepDiver1975 commented 11 months ago

I guess Baikal needs to update deps....

phil-davis commented 11 months ago

I guess Baikal needs to update deps....

That should have happened in https://github.com/sabre-io/Baikal/releases/tag/0.9.4

But I don't understand the $autoPrefix thing. I can't find $autoPrefix anywhere in the current sabre/dav code or its dependencies. Can someone give me a hint about what sabre/dav code touches $autoPrefix ?

DeepDiver1975 commented 11 months ago

@AaronVanGeffen how did you install/upgrade your bailkal installation? Maybe we get some hints from this ...

DeepDiver1975 commented 11 months ago

1 /usr/share/webapps/baikal/vendor/sabre/dav/lib/DAV/PropertyStorage/Backend/PDO.php(100): unserialize()

Ah - that's it I guess .... the serialized vobject here holds a reference to autoPrefix which does not exist.

The only option I see is to add this property back in Href ....

phil-davis commented 11 months ago

autoPrefix stuff was removed in PR https://github.com/sabre-io/dav/pull/801

I will have a look and see what bits should be put back to keep backward-compatibility of some sort. I suppose that this is only noticed when there are (quite) old VOJBECTs in the database that have/generate calendar dates that still happen in "real life" at run-time for people.

phil-davis commented 11 months ago

Release https://github.com/sabre-io/dav/releases/tag/4.5.1 should have fixed the HRef autoPrefix problem.

Baikal composer.json has:

"sabre/dav"     : "~4.5.0",

and no composer.lock

So sabre/dav 4.5.1 should be picked up automagicall without any code change here.

But I see that the release 0.9.4 comes with a zip file that has the vendor dependenices pre-packages: https://github.com/sabre-io/Baikal/releases/download/0.9.4/baikal-0.9.4.zip

So I suppose that 0.9.5 has to be released to provide updated "bundled" sabre/dav 4.5.1

mxmehl commented 10 months ago

Upgrading to Baikal 0.9.4 solved this issue with PHP 8.2 for me.

It was basically a matter of cp -R baikal-0.9.4/* baikal/ (where baikal/ is the path of my existing installation)