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

PHP 8.2 dynamic properties deprecation warnings #1154

Closed
AaronVanGeffen opened this issue Jan 27, 2023 · 26 comments · Fixed by sabre-io/dav#1514
Closed

PHP 8.2 dynamic properties deprecation warnings #1154

AaronVanGeffen opened this issue Jan 27, 2023 · 26 comments · Fixed by sabre-io/dav#1514

Comments

@AaronVanGeffen
Copy link

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: sabre-io/dav#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
Copy link

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

@AaronVanGeffen
Copy link
Author

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)

@AllesMeins
Copy link

Ah, perfect - thank you!

@N0ury
Copy link

N0ury commented Feb 12, 2023

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

@rodin-ia
Copy link

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

@codeandfix
Copy link

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

@jwohlfeil
Copy link

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

@TCB13
Copy link

TCB13 commented May 8, 2023

Also works for me in PHP 8.2. thanks!

@gizmo15
Copy link

gizmo15 commented Jun 9, 2023

Works for me too with PHP 8.2.5, thanks!

@cscholz
Copy link

cscholz commented Jun 9, 2023

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

@AaronVanGeffen
Copy link
Author

@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
Copy link

antiftw commented Jun 11, 2023

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 sabre-io/dav#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:

sabre-io/dav@906bbb8

@anekinloewe
Copy link

Works fine for me on debian 12.

@PatrickJMaloney
Copy link

@AaronVanGeffen Thanks for the fix. Using PHP 8.2.8.

@gour
Copy link

gour commented Sep 27, 2023

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

@cl0rm
Copy link

cl0rm commented Oct 3, 2023

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

@Fijxu
Copy link

Fijxu commented Oct 23, 2023

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
Copy link
Author

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

@AaronVanGeffen
Copy link
Author

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: #1154 (comment)

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

@DeepDiver1975
Copy link
Member

I guess Baikal needs to update deps....

@phil-davis
Copy link
Contributor

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
Copy link
Member

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

@DeepDiver1975
Copy link
Member

#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
Copy link
Contributor

autoPrefix stuff was removed in PR sabre-io/dav#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 added a commit to phil-davis/dav that referenced this issue Nov 22, 2023
use of this property in code was removed in PR
sabre-io#801
But the property is left here because old data may still exist
that has this property saved.

See discussion in sabre-io/Baikal#1154
phil-davis added a commit to phil-davis/dav that referenced this issue Nov 22, 2023
use of this property in code was removed in PR
sabre-io#801
But the property is left here because old data may still exist
that has this property saved.

See discussion in sabre-io/Baikal#1154
DeepDiver1975 pushed a commit to sabre-io/dav that referenced this issue Nov 22, 2023
use of this property in code was removed in PR
#801
But the property is left here because old data may still exist
that has this property saved.

See discussion in sabre-io/Baikal#1154
phil-davis added a commit to phil-davis/dav that referenced this issue Nov 23, 2023
use of this property in code was removed in PR
sabre-io#801
But the property is left here because old data may still exist
that has this property saved.

See discussion in sabre-io/Baikal#1154
@phil-davis
Copy link
Contributor

phil-davis commented Nov 23, 2023

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

@ByteHamster ByteHamster reopened this Nov 23, 2023
@mxmehl
Copy link

mxmehl commented Jan 2, 2024

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)

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.