-
Notifications
You must be signed in to change notification settings - Fork 40
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
Make Backdrop core compatible with PHP 8.2 #5927
Comments
...should we have multiple issues/PRs, or a single PR with multiple commits, and then merge once tests pass? |
...for those of us using Lando for our locals, php 8.2 is not supported yet. Follow lando/php#40 for updates. |
I think a meta is always best, then developers can tackle each issue separately and update the meta as they do so |
During this week's dev meeting we have decided to do the following:
(point in time during the dev meeting when this issue was discussed: https://youtu.be/vvzsOmfyIsA?t=2624) |
I have done most of the legwork, which is currently 148 changed files with mostly trivial-to-review changes. Still not ready for review, but there's heaps less tests failing now, and no obvious errors thrown in the frontend. I will start documenting certain things that most likely also apply to us, but unsure how to handle. Starting with this: https://www.drupal.org/project/drupal/issues/3280033
Commit against D9.4: https://git.drupalcode.org/project/drupal/-/commit/6496252 We do have a few such instances of |
...OK, this feels pretty close now, but I'm starting to see red and blue dragons flying around my head ...they are spinning fast, so I'm starting to see some of them as purple 😅 I have resulted in using Can someone else now please review my PR so far and take it from here? The majority of the changes are trivial (like adding Should we merge what we have now, and iterate with other PRs? Pinging our @backdrop/core-committers |
...there is a big amount of the following failures:
|
Lando v3.9.0 was just released, which adds support for PHP 8.2 (just tested it on my local). It's a prerelease, so you can't get it with |
One question, I can't answer, yet: will we need In D7 Node is just a stdClass, and with stdClass dynamic properties are still allowed. However, in B Node (and User, Comment, File, TaxonomyTerm) are fully classed. But... Why we need that? Take a look at the book module (it uses dynamic properties), same with contrib (poll module, for example). Heck it's even officially documented that way. Who knows it? Can core entities have dynamic properties, or not? |
@klonos I've left some questions on your PR. |
From reading https://wiki.php.net/rfc/deprecate_dynamic_properties I'd say yes. Any class that extends stdClass will allow dynamic properties. |
After some basic testing in PHP 8.2 I can confirm there is no deprecation warning when you use dynamic properties in classes that extend |
As for the other questions in @klonos comment above: I believe, in general there are three options:
I think number 1 above may be the simpler way, but I really don't know if there may be any negative repercussions about changing classes like EDIT: There are classes in BAckdrop that AFAIK don't use dynamic properties - e.g. |
I prefer adding |
So, we don't have to do anything with core Entity class and all classes that extend it. That's great! 👍 Re Simpletest - I think, it's clean (and safe) to declare all properties. A lot of legwork, but no Re Layout - declaring all properties should be possible and fix the problem. Same for other non-views classes in core, I guess. Re Views: I'd suggest to add @argiepiano I don't think, switching views base classes to extend stdClass provides more than the new attribute on classes, or the magic methods. Or do you see any extra benefit? @klonos as very often, you've been ahead of us with starting this issue. Many thanks for your work so far. 🙏 I hope, you'll be able to further work on this. 😏 |
I am removing myself from the assignee of this issue, since as I also explained in a related thread in Zulip: I want to be helpful, but at the same time I need to be realistic. With the new job, a lot of my energy is being spent on new knowledge and my focus is on that at the moment. Because I am out of my normal routines, I end up being more drained at the end of my work day than before, so I need more time to relax and wind down than usual. I will eventually get back to things, however, if someone else has the energy/capacity, please feel free to either take over from my current PR, or create your own from scratch. |
Friendly reminder that this PR still needs a final review (a lot has already happened a month ago). 🙌 If someone's concerned because of the failing phpcs check: that's just because our GHA can't handle such big changes (82 files). I'm pretty sure, all my changes comply with our coding standards. 😁 |
A couple more tweaks and I think it's ready @indigoxela. Thanks for your work on this. |
@herbdool that's great! Many thanks for reviewing, I've addressed your requests. |
I think it's good to go! |
I code reviewed this and it looks great! Nice job @indigoxela defining all those missing properties! This will really substantially reduce the amount of warnings I get in PHPStorm, and help with type-hinting as well. All around a big set of improvements and clean-up!! This is a big effort and thank you so much for the work. The only thing I found in my read-through was that we're not consistent with |
I added a follow-up issue regarding whether we should use a backslash or not when defining class attributes here: Coding Standards Policy: Unqualified or qualified global class names #6169 |
Right, that's an oversight and fixed now, to be consistent. Many thanks for pointing me to that and for reviewing. 🙏 |
Looks like @herbdool also re-approved this in the PR. Looks good to me! I'll let tests finish running to be safe. |
I merged backdrop/backdrop#4445 into 1.x and 1.25.x (no conflicts!). Thank you so much @indigoxela, @herbdool, @argiepiano, @klonos, and @yorkshire-pudding for the extensive work put into this! I really like where this ended and the updates will have a lot of other peripheral benefits, like better code hinting and IDE support. Very nice! |
Our Drupal brethren have started some work on this in a meta: https://www.drupal.org/project/drupal/issues/3304807
The text was updated successfully, but these errors were encountered: