REST API not working with php 8.1+

Hello DuncanC,

I am new and see your name quite a bit as I read through the issues. I am wondering on this issue, if you know how long it will be before they update this?

The specific portion of code is referred to as the JMS Serializer and it is a separate open source project. They have an update of this project which works. I have updated the serializer on my own install and am happily coding away for some Wordpress plugins to use that API. Since updating that code, the API behaves exactly as it should and I am on php 8.2.

For anyone brave or curious, if you search for the root of the JMS Serializer in your install and then search for the project, the project owner gives reasonably clear instructions on how to write a composer file to upgrade that code. Afterwards, do a deep grep for any instance of ReadOnly and replace with ReadOnlyProperty (there are only two instances and they are on the same file).

I may write a blog post with phplist specific instructions for this later this week, if anyone is interested. I have been an on and off user of phplist for a long time, I appreciate all the effort people put into it.


Karl Tatgenhorst

@ktatgenhorst I have moved your post to a new topic as it is not directly related to the original problem.

I don’t quite understand your comments on how to resolve the problem with the JMS Serializer package, but the simplest way is to replace the two occurrences of the ReadOnly class alias with the full class name \JMS\Serializer\Annotation\ReadOnly. This avoids using the php 8.1 keyword directly.

For anyone who needs to use the REST API with php 8.1+, to fix the problem, replace this file with the one attached here which is zipped to allow uploading


I don’t know when the phplist REST API package will be updated. Looking at the GitHub repositories, they have not had any changes for two years. (2.0 KB)


Thank you - that is a much easier solution. The solution I gave actually uses the rewritten JMS serializer.