-
Notifications
You must be signed in to change notification settings - Fork 824
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 compatibility fixes #10921
PHP 8.2 compatibility fixes #10921
Conversation
How did you come to this set of specific properties? I'd recommend using php8.1 in your CMS 4 projects, then upgrade to CMS 5, then upgrade to PHP 8.2. |
These specific properties are the ones that cause deprecation notices on /dev/build, template parsing and basically all requests handled by framework. As I mentioned, the point of this PR is not official support for PHP 8.2, just to make it possible to fix deprecation notices in other modules with CMS 4. |
I won't have time to look at this until Monday, but here's a couple of things that need to be confirmed before this can be merged:
|
To answer you questions:
I tested these changes both with php 8.2 and with older versions, and have seen no impact except for getting rid of the deprecation notices on php 8.2. I see these changes as very low risk, declaring these properties on the classes is good practise anyway. |
That may be the case, but these are the sort of changes we would usually not make until a major release. To introduce them in a patch release requires a much higher degree of scrutiny, which is why I'm taking this through the paces. I appreciate your patience during the process.
Agreed, but there are many best practices we can't introduce in CMS 4 patch releases, due to semver concerns. As stated above, we need to make sure we're being very careful with anything like this as it's a wide departure from our normal release practice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please swap all public
being introduced in this PR with var
- this will ensure there are no breaking changes for anyone who has declared these properties on their subclasses with different visibilities and should therefore remove the last BC concern I have.
@GuySartorelli are you saying that |
A property declared with |
Unfortunately it still seems to error when setting non-public visibility: https://3v4l.org/SJorQ |
Can we not use the
|
Oh weird. Didn't do that when I tried it locally but I probably just did something wrong. Thanks for double checking that.
I totally forgot that's a thing. Yes absolutely let's do that instead. |
Good idea, totally forgot about |
As in https://3v4l.org/PVrJu, it just ignores it for PHP 7.4 as it's technically a comment. |
We probably should also create (if we don't have one already) a ticket to revisit all these places for CMS 6 and do it properly. |
This is for CMS 4, I’m pretty sure it’s already been fixed in 5,. Though we might need a follow up task to remove the annotation (if it’ll get merged up automatically or might be missed if manually merging up?) |
The automatic merge up is on a Cron so it'll be easy to deal with this before that happens. . I've already made a mental note that once this gets merged it needs to be manually merged up (and reverted during the merge up) |
annotation on classes that set dynamic properties
019d475
to
88c70b3
Compare
Changed this pull request to use the AllowDynamicProperties annotation instead of declaring these properties as public |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. @kinglozzer @michalkleiner do either of you have any remaining concerns?
This will be automatically tagged when GitHub Actions has finished running on the branch. |
Currently framework code in version 4 triggers a lot of deprecation errors, because of setting dynamic properties on some classes. This can be easily fixed by declaring these properties on the classes, and should have no impact on the code otherwise.
The reason for fixing this is to be able to fix deprecation errors with PHP 8.2 in Silverstripe modules without these errors getting buried in all the deprecation errors from framework, not to have version 4 of Silverstripe officially support PHP 8.2.