Baikal icon indicating copy to clipboard operation
Baikal copied to clipboard

PHP 8.2 dynamic properties deprecation warnings

Open AaronVanGeffen opened this issue 2 years ago • 26 comments
trafficstars

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()

AaronVanGeffen avatar Jan 27 '23 19:01 AaronVanGeffen

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

AllesMeins avatar Feb 12 '23 12:02 AllesMeins

Per the error messages, I added two properties:

  • protected $autoPrefix; to the Href class (baikal/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php)
  • public $addressDataProperties; to the AddressBookMultiGetReport class (baikal/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php)

AaronVanGeffen avatar Feb 12 '23 13:02 AaronVanGeffen

Ah, perfect - thank you!

AllesMeins avatar Feb 12 '23 13:02 AllesMeins

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

N0ury avatar Feb 12 '23 19:02 N0ury

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

rodin-ia avatar Feb 17 '23 07:02 rodin-ia

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

codeandfix avatar Apr 08 '23 10:04 codeandfix

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

jwohlfeil avatar Apr 21 '23 14:04 jwohlfeil

Also works for me in PHP 8.2. thanks!

TCB13 avatar May 08 '23 15:05 TCB13

Works for me too with PHP 8.2.5, thanks!

gizmo15 avatar Jun 09 '23 08:06 gizmo15

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

cscholz avatar Jun 09 '23 21:06 cscholz

@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.

AaronVanGeffen avatar Jun 09 '23 21:06 AaronVanGeffen

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

antiftw avatar Jun 11 '23 17:06 antiftw

Works fine for me on debian 12.

anekinloewe avatar Jul 19 '23 15:07 anekinloewe

@AaronVanGeffen Thanks for the fix. Using PHP 8.2.8.

PatrickJMaloney avatar Aug 09 '23 05:08 PatrickJMaloney

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

gour avatar Sep 27 '23 16:09 gour

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

cl0rm avatar Oct 03 '23 18:10 cl0rm

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.

Fijxu avatar Oct 23 '23 16:10 Fijxu

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

AaronVanGeffen avatar Nov 17 '23 10:11 AaronVanGeffen

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)

AaronVanGeffen avatar Nov 21 '23 18:11 AaronVanGeffen

I guess Baikal needs to update deps....

DeepDiver1975 avatar Nov 21 '23 18:11 DeepDiver1975

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 ?

phil-davis avatar Nov 22 '23 05:11 phil-davis

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

DeepDiver1975 avatar Nov 22 '23 09:11 DeepDiver1975

#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 ....

DeepDiver1975 avatar Nov 22 '23 09:11 DeepDiver1975

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 avatar Nov 22 '23 10:11 phil-davis

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

phil-davis avatar Nov 23 '23 04:11 phil-davis

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)

mxmehl avatar Jan 02 '24 07:01 mxmehl