Problem/Motivation
Under PHP 8.2, there are a lot of messages like Creation of dynamic property ... is deprecated. For example, see these test results from Webform.
Proposed resolution
Enabled PHP 8.2 testing in Views. Declare all the properties used.
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | views_error_unique.txt | 60.55 KB | joseph.olstad |
| #11 | 3323955-11.patch | 8.41 KB | joseph.olstad |
Comments
Comment #2
joseph.olstadYes I'm seeing this on the media project automated testing as well hundreds of messages
exception: [Deprecated function] Line 2260 of sites/all/modules/views/includes/view.inc:Creation of dynamic property views_display::$display_plugin is deprecated
Comment #3
joseph.olstadComment #4
joseph.olstadHere's some of what they were doing in Drupal 10 views to fix this.
Comment #5
joseph.olstadTry this
Comment #6
joseph.olstadComment #7
joseph.olstadComment #8
joseph.olstadComment #9
joseph.olstad#3327343: Fully Support PHP 8.2
Comment #10
joseph.olstadNew patch
Comment #11
joseph.olstadComment #12
joseph.olstadRTBC on patch 11
the remaining fix needs to be done in ctools.
I need views to work to be able to fix file_entity and media PHP 8.2 compatibility
Comment #13
damienmckennaThanks for working through this.
Comment #14
liam morlandAdding
#[\AllowDynamicProperties]will fix it. A more robust fix is to declare the properties, for example, as done in #3323960: Remove dynamic properties for PHP 8.2 compatibility.Comment #15
joseph.olstadPlease expedite review and please tag a release with this fix, it's holding back automated test coverage on the file_entity project, the media and many others. Likely many other contrib projects automated tests will fail until a release with this fix is cut.
AllowDynamicProperties still allows performance optimisation as it's only for some classes, not all.
I think we can move forward with this as-is, any future "improvements" can go into subsequent releases/issues.
Comment #16
joseph.olstadI fixed i18n last night and cut a release
entity_translation I just RTBC'd my own patch, it's passing on PHP 8.2
I'll be able to push many more once ctools and views gets patched/tagged/released with fixes.
#3327347: Fully Support PHP 8.2
Comment #17
joseph.olstadOh sorry ya I noticed there's still one failure on PHP 8.2, I have no idea why though, probably unrelated to the changes, it was there previously also.
Comment #18
damienmckennaThat one error suggests there might be another bug somewhere causing the problem. So let's poke it with a stick a little more.
Comment #19
liam morlandThe remaining test failure is a separate issue from the dynamic properties. This issue should be committed to fix the dynamic properties and another issue should be opened for that failure.
Comment #20
joseph.olstadI'm guessing that this bug is probably comming from ctools.
Two months ago ctools automated tests fell apart mysteriously unrelated to code commits made to ctools.
I'm thinking we should commit the views patch as-is, then work on ctools, and then come back to views once ctools is fixed.
#3327350: Support PHP 8.2 with ctools
Comment #21
damienmckennaI'll look into it tomorrow.
Comment #22
joseph.olstadctools possibly related issue, I uploaded a patch, can't get it to pass though but I'm sure it will pass if the framework was working as it was in august.
There's appears to be a ci bot runner /jenkins problem not caused by ctools but affects ctools.
#3327498: D10 deprecations broke D7 ctools testing since sept 8th-14th 2022
Comment #23
joseph.olstadI've completed the entity_translation patch for PHP 8.2
#3327347-33: Fully Support PHP 8.2
@DamienMcKenna
Seeing as (patch #11 above) does not cause testing regressions on versions lower than PHP 8.2, could we just go ahead and push it in right away "as-is" so that I/we can continue working on file_entity and media and other modules that require/utilise views?
then once the ctools fixes land, we can follow up with a new issue to deal with the
tests/styles/views_plugin_style_jump_menu.test.For the sake of expediting progress, my vote is to push in patch #11 as-is, even publish a release with it if necessary, foollow up with the other fix after.
This way we can work on fixes for modules "other than" ctools that depend on views and at least move those forward quickly and come back and resolve all the issues after.
Comment #24
joseph.olstadso, we can push in #11 as a stop-gap improvement, and then more slowly and over more time, work on an improvement to this issue.
I did a sort on the errors from the tests
and then used the uniq command to remove duplicates
see which properties would have to be added, not clear which classes but could be figured out.
#3327347-33: Fully Support PHP 8.2
Comment #26
damienmckennaCommitted. Thanks.
Let's do separate issues if any other problems show up.
Comment #27
damienmckennaComment #29
joseph.olstadah yes, still one fail, looks like it's because of ctools.
https://www.drupal.org/project/ctools/issues/3327350
Someone has to bark up the ctools tree.
I've got media, media_youtube, i18n, entity_translation and smtp to pass on PHP 8.2
Hopefully we can get ctools and whatever else going
I'm going to look into file_entity, it might work now due to the views fixes, going to trigger tests.
Comment #30
damienmckennaFYI I updated the automated tests to use PHP 8.2 instead of 8.1.