Make Drupal 7 compatible with PHP 8.3, which is released on 23 November 2023.
| Comment | File | Size | Author |
|---|
Issue fork drupal-3380823
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
liam morlandComment #3
joseph.olstadD7 default should now be set to PHP 8.2
AND
PHP 8.3 automated tests should be added here:
https://www.drupal.org/node/3060/qa
Comment #4
poker10 commentedThanks for creating the issue. Let's try how PHP 8.3 test suite runs on D7 core currently. Adding a noop patch.
Comment #5
poker10 commentedSorry, the patch was somehow UTF-16..
Comment #6
poker10 commentedThis looks good. There seems to be only one problem with unserialization in D7 core tests (there could be more, but not catched by tests).
I have created an issue with the fix for the unserialize failure: #3380876: [D7 PHP 8.3] unserialize(): Extra data starting at offset
Comment #7
poker10 commentedThe child issue is fixed. Let's check with another noop patch if we are green now.
Comment #8
poker10 commentedSeems like other failure/s appeared in PHP8.3-RC tests, so we need to check these as well (probably something must have changed between PHP8.3 beta and RC, because we were already green after #3380876).
Comment #9
poker10 commentedSeems like the
TextSummaryTestCasefailures could be related to similar failures in D10: #3383577: TextSummaryTest:testLength() fails on some libxml versions. So we need to create an issue for this in D7 as well.Comment #10
poker10 commentedCreated new child issue #3397882: [D7 PHP 8.3] TextSummaryTestCase::testLength() fails on some libxml versions.
Comment #11
andypostqueued last patch on 8.3.0RC5 looks only 2 broken tests!
https://www.drupal.org/pift-ci-job/2801464
Comment #12
joseph.olstadNice, only 2 fails! Subscribing.
PHP 8.3 is scheduled to release on November 23, 2023
Release candidate 6 is in a few days from now, perhaps we get lucky with rc6 passing more tests than rc5?
or is this a documented/expected fail?
Comment #13
poker10 commentedI do not think that the failures will disappear, as it seems like that they are caused by some changes in libxml library, not directly by PHP 8.3 (see the child issue).
Comment #14
andypostRelease 8.3.0 is packaged to CI images https://www.drupal.org/pift-ci-job/2818363
Comment #15
andypostFailed test for session needs new issue and still active #3397882: [D7 PHP 8.3] TextSummaryTestCase::testLength() fails on some libxml versions
Comment #17
poker10 commentedI have created another child issue for the session failure.
testEmptySessionId() failure: #3446569: [D7 PHP 8.3] Fix SessionHttpsTestCase->testEmptySessionId() failure
testLength() failure: #3397882: [D7 PHP 8.3] TextSummaryTestCase::testLength() fails on some libxml versions
Created also a draft MR here with PHP 8.3 testing (https://git.drupalcode.org/project/drupal/-/merge_requests/8020) and after applying fixes from both issues, tests are green, see: https://git.drupalcode.org/project/drupal/-/pipelines/170105 (sorry for multiple commits, but I had/have issues with replicating the session failure locally).
Comment #18
poker10 commentedHiding the old patch as we have now a MR here for testing.
Comment #19
joseph.olstad@poker10, great work!
So if I understand correctly, you've put all the fixes into the MR 8020, then split off the actual code that does the fixes into those two issues 3446569 and 3397882 ?
Right now I see 100% green in the MR 8020
Comment #20
poker10 commentedYes - both fixes are in MR 8020 to see the final effect (but this MR will not be committed) and then there are two separate issues with MRs to commit.
I have done it because the MR workflow is more flexible and also because I was not able to simulate the session test failure locally, so I needed to experiment a bit.
Comment #21
diogothecoder commentedThanks @liam-morland for reporting this issue and @poker10 for raising the merge request. Do we know whether it will be approved and merged before Drupal 7 comes to end-of-life support in Jan 2025?
Comment #22
liam morlandAll test are passing
Comment #23
liam morland@poker10 Is there a reason the merge request is still marked as a draft?
Comment #24
poker10 commented@liam morland This is a meta issue for tracking all child issues needed to fix PHP 8.3 compatibility. So far we have identified only two (#3397882 and #3446569). I have created an MR here with the two fixes to see, if both will be committed, if our tests will be green. So there will be no commit from this meta issue, we will commit both fixes from the separate issues I mentioned.
Comment #25
andypostCurious if it make sense to file PHP 8.4 compatibility issue as it coming in a month
Comment #26
poker10 commentedThe last release of D7 is currently planned for 2024-12-04 , so I think we can create that issue and at least check, what issues there will be with automated testing and try to fix them. I think that it could still be possible to fix them until the release (or EOL) if there will be enough interest and if they won't require some major changes to D7 code.
Comment #28
poker10 commentedChild issues are now committed. Tests are green on PHP 8.3 - https://git.drupalcode.org/project/drupal/-/pipelines/357773
I have also run Gitlab pipeline for PostgreSQL17 and MySQL 8.4, both seems to be green (which are obviously good news).
Curiously also run pipeline for PHP 8.4, but there are failures and given the large amount of changes, I do not think that there is enough time to fix the PHP 8.4 compatibility for D7.
We can keep this issue open just in case someone will run into an issue on PHP 8.3, but then we will close it. Thanks!
(moving back to Active, as there is nothing to review/commit)
Comment #29
joseph.olstadNice work Juraj!
Thanks for getting this in before January 2025!
Comment #30
andypostMeantime PHP 8.4 is out)
Comment #31
poker10 commentedI tested the PHP8.4 in the draft MR I have created today (https://git.drupalcode.org/project/drupal/-/pipelines/357813), but there seems to be a lot of changes / errors, so given that the last D7 release is tomorrow, I do not think it is something we can fix until EOL, unfortunatelly.
Comment #32
ressaThanks! It says on PHP requirements for Drupal 7 that PHP 8.3 is supported "Yes, as of Drupal 7.103", so perhaps this issue could be included on the release page for Drupal 7.103?
Comment #33
poker10 commentedThanks @ressa! Added a mention about the PHP 8.3 compatibility to the release notes on https://www.drupal.org/project/drupal/releases/7.103.
Comment #34
ressaPerfect! Thanks @poker10 and all the other D7 maintainers for keeping Drupal 7 updated, and expanding it with new features, like PHP 8.3 compatibility.
Comment #35
joseph.olstadThanks especially to @poker10
Comment #36
poker10 commentedFixing credits.