Problem/Motivation
Make sure Drupal 7 becomes compatible with PHP 8.2 (release date 24 November 2022 - https://wiki.php.net/todo/php82). There should be quite a lot of issues related mostly to the deprecation of dynamic properties: https://wiki.php.net/rfc/deprecate_dynamic_properties.
See #3224299: [META] Make Drupal 7 core compatible with PHP 8.1 for how we did it with PHP 8.1.
According to the previous comments and the fact that the D7 EOL was postponed, I think we should support PHP 8.2 in D7. See: #3224299-6: [META] Make Drupal 7 core compatible with PHP 8.1
re. #4, yes D7 End of Life is November 2022, but after that there will be D7 Extended Support:
https://www.drupal.org/project/d7es
I believe that's due to run another 3 years until November 2025, which is beyond when any current version of PHP is due to be supported (directly by the upstream developers at least).
For the reference, here is the D9/10 issue: #3283358: [META] Make Drupal 9/10 compatible with PHP 8.2.
Steps to reproduce
Run tests with PHP 8.2.
Proposed resolution
Make tests pass and fix all child issues.
Remaining tasks
See child issues.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3304807-11_noop.patch | 281 bytes | poker10 |
| #10 | 1292930-28_3322003-4_3322008-2_3322009-4_3322011-2.patch | 40.03 KB | poker10 |
Comments
Comment #2
poker10 commentedAdding a noop patch for the first test.
Comment #3
poker10 commentedI will add first bunch of
Deprecated function: Creation of dynamic propertyhere (as child issues), but maybe we should consider creating a new META for all these issues, like they have done in D9/10: #3275851: [META] Fix PHP 8.2 dynamic property deprecations.D7 PHP 8.2 testbot is not fully enabled yet (still queueing), so we need to wait a little bit to test that noop.
Comment #4
poker10 commentedAccording to my testing, these 5 issues will need to be fixed first, because they affect practically all tests (then we would get way less deprecations in the simpletest results):
#3304882: [D7 PHP 8.2] Deprecated function: Creation of dynamic property in DrupalWebTestCase->prepareEnvironment()
#3304883: [D7 PHP 8.2] Deprecated function: Creation of dynamic property in PDOException class
#3304884: [D7 PHP 8.2] Deprecated function: Creation of dynamic property MergeQuery::$condition
#3304885: [D7 PHP 8.2] Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion
#3304886: [D7 PHP 8.2] Deprecated function: Creation of dynamic property in SelectQuery class
Comment #5
andypostI bet it will need to fix callable syntax as well (which is not yet ported to 9.5.x)
- #3299327: Replace deprecated static::method() calls for PHP 8.2
- #3299890: Refactor views.views_data_helper service usage of self
Comment #6
poker10 commentedNew noop patch, as there was a release in between.
Comment #7
poker10 commentedFour issues are commited.
It seems like that fixing this: #3304883: [D7 PHP 8.2] Deprecated function: Creation of dynamic property in PDOException class should be sufficient to make the PHP 8.2 tests at least run (see https://www.drupal.org/pift-ci-job/2519057).
Then we can move forward with other deprecations which will arise from the full tests run.
Comment #8
poker10 commentedThe last issue is committed so hopefully the PHP 8.2 testing should be unblocked now.
Comment #9
poker10 commentedLinked/created 5 more issues from the testbot results. These should cover most (if not all) failures from the tests.
Comment #10
poker10 commentedTo check the status, I am adding a combined patch including patches from all 5 issues mentioned in the previous comment.
Comment #11
poker10 commentedAdding a new noop patch, as all issues are committed.
Comment #12
mcdruid commentedYay - great work getting tests passing in PHP 8.2 @poker10!
As we've done before with previous versions I'd suggest that we keep this issue open for a while as there may be other issues we need to fix that are not exercised by core's test suite.
It's fantastic to have tests passing a week or so before PHP 8.2 is released though.
Comment #13
joseph.olstadThis patch https://www.drupal.org/files/issues/2019-09-23/php-warning-count-param-3...
resolves the following Error /warning:
exposed by custom module code with this hook_update code in companyname_widgets.install
code here:
Comment #14
joseph.olstad@mcdruid @poker10, could you please add PHP 8.2 tests for sqlite, psql and mysql into here:
https://www.drupal.org/node/3060/qa
BTW, I've pushed forward a release of i18n that is PHP 8.2 compatible
as well as patches that are passing for:
entity_translation php 8.2 patch
and also work in progress (advancing nicely) patch for:
views
and
Needing some assistance with this one:
ctools
The ctools patch is good, but something went haywire with the automated testing framework, ctools head tests were passing in August/september but since have been failing for no apparent reason, no change was made that co-incides with the failures.
Comment #15
poker10 commentedThanks for working on PHP 8.2 support on these contrib modules, @joseph.olstad.
I have proposed some changes to the D7 branch testing here - #3092260: [policy, no patch] Review and update automated testing config for 7.x branch.
Comment #16
joseph.olstad@poker10, we're still missing PHP 8.2 from the automated tests, please add PHP 8.2 test for 7.x here:
https://www.drupal.org/node/3060/qa
Comment #17
joseph.olstad@poker10, I made an important discovery during the PHP 8.2 contrib mission, trying to fix ctools, but noticed composer errors since Sept 8th 2022 that appear to me to be caused by a new D9.4+ contrib module called "color" that conflicts with the D7 core module also called "color". Since this module does not have a core: 8.x entry, there's something in the drupal.org build process that is not building a require in the correct way. I believe this could possibly be fixed by adding a composer.json to the color project both branches that explicitly says requires Drupal 9.4+.
#3332391: The contrib color project is conflicting with the D7 core color project, breaking ctools 7.x tests and possibly others
I'd appreciate some assistance from heavyweights such as yourself and @mcdruid or others like @andypost to fix this
related issues:
#3327350: Support PHP 8.2 with ctools
and
#3327498: D10 deprecations broke D7 ctools testing since sept 8th-14th 2022
Comment #18
joseph.olstadSome positive feedback here, I just upgraded one of my bilingual documentation sites to PHP 8.2.1
PHP 8.2.1 (cli) (built: Jan 6 2023 15:17:58)
It is working so far without any notices, without any warnings showing up in the logs. I've done some pretty quick smoke tests for functionality, so far so good.
PHP 8.2 test results in a real world setup (and it's noticably faster)
with:
The latest tagged releases of the following contrib modules:
Out of all of these modules, only two are using patches:
The two patched modules are:
The variable module:
#2799811-2: hook_variable_group_info() allows adding a description which is not used in variable_realm_edit_variables_form()
#2141531-10: The realms of a variable edit form are lost when #ajax is used.
#2432801-2: Incorrect call to variable_get_value()
#2627438-2: typo in hook_variable_info()
#2574061-2: implement hook_hook_info() for Variable Realm
#2574689-3: exported Features code is incorrectly indented
#2576245: export of language_default variable is broken (& any other variables which store an object)
and this unidentified one https://www.drupal.org/files/issues/variable.realm-variable-config-form-...
and the plupload library
#1903850-16: [meta] Patch to remove plupload library examples folder for Drupal distribution
I'll keep testing it and reviewing, however I just wanted to share this because I've not yet upgraded to Drupal 10 and haven't tested that and Drupal 9.5 doesn't run PHP 8.2, so I was pleasantly surprised to start using PHP 8.2 with Drupal 7.94 on a decently complicated setup so much initial success on the first try.
I'm sure there's lots of work to do on contrib yet however this is a great start!
***EDIT*** I just wrote this PHP 8.2 compatibility patch for the date module (and needed it)
#3328051: PHP 8.2 - Fix deprecated dynamic properties
Thanks again to everyone that is contributing and great work everyone! Especially @poker10 and @mcdruid
Comment #19
joseph.olstad@mcdruid and @poker10 , wondering if I could have a second opinion on a migrate module issue, I've noticed the tests pass up until PHP 7.3, then from PHP 7.4, 8.0, 8.1, 8.2 , the same error from core in all mentioned test fails.
Spits up an error comming from core
modules/field/field.crud.inc#3333649: Migrate.MigrateCommentUnitTest is failing on PHP 7.4+, test divulges error comming from core
https://www.drupal.org/pift-ci-job/2568554
https://www.drupal.org/node/391350/qa
This module is fairly important because many other important contrib modules such as the 'date' module have automated tests to make sure the date integration with the migrate module is working. People also use the migrate module to migrate from D6 and possibly use it to prepare for migrations to symfony based Drupal although I'm not 100% sure on that.
Comment #20
poker10 commentedI think that these two issues are probably related:
#3129961: Fix $field / $instance exceptions in field.crud.inc and image.module
#3314719: Notice: Trying to access array offset on value of type null in _field_write_instance()
But it would be great to find the real cause, so we can tell if this is a problem in core (e.g. if this can happen unless there are malformed data or not).
Comment #21
joseph.olstadI've got a PHP 8.2 compatible RTBC patch for ctools that is safe but cannot be tested with the Drupal ci testbot until a D10 deprecation issue is resolved and I think they've already resolved similar issues before. Trying to nudge this along , created a new issue in the ctools queue with the notes.
#3335458: D7 ctools head tests affected by D10 deprecations - See upstream issues
Comment #22
joelpittet#3336591: PHP 8.2 Compatibility Adding this to related for Panels
Comment #23
poker10 commentedRe #19, I have checked the issue and it seems to be a problem in the Migrate module, not in D7 core. Added a comment to that issue.
Comment #24
gábor hojtsyLooks like core is done, it has a green test on 8.2 running fine. So this is about key contrib modules now? If this should be kept about core, then the contrib should have a followup maybe?
Comment #25
joseph.olstad@Gábor Hojtsy,
There is still one related core patch in a needs review state related to PHP 8.2 compatibility.
#3314719: Notice: Trying to access array offset on value of type null in _field_write_instance()
Comment #26
mcdruid commentedI think we can close this for D7 core now.
If that specific issue would help contrib modules to pass tests on more recent PHP versions, let's please add it to #3366270: [meta] Priorities for 2023-12-06 release of Drupal 7 if it's not already there.
If there are more changes that could be made in core which should be considered, can we please file a follow-up for those?
Thanks!