Make Drupal 7 compatible with PHP 8.3, which is released on 23 November 2023.

https://www.php.net/releases/8.3/index.php

CommentFileSizeAuthor
#7 3380823-7-noop.patch281 bytespoker10
#5 3380823-5-noop.patch281 bytespoker10
#4 3380823-4.patch586 bytespoker10

Issue fork drupal-3380823

Command icon 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

Liam Morland created an issue. See original summary.

liam morland’s picture

joseph.olstad’s picture

D7 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

poker10’s picture

StatusFileSize
new586 bytes

Thanks for creating the issue. Let's try how PHP 8.3 test suite runs on D7 core currently. Adding a noop patch.

poker10’s picture

StatusFileSize
new281 bytes

Sorry, the patch was somehow UTF-16..

poker10’s picture

This 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

poker10’s picture

StatusFileSize
new281 bytes

The child issue is fixed. Let's check with another noop patch if we are green now.

poker10’s picture

Seems 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).

poker10’s picture

Seems like the TextSummaryTestCase failures 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.

poker10’s picture

andypost’s picture

queued last patch on 8.3.0RC5 looks only 2 broken tests!

https://www.drupal.org/pift-ci-job/2801464

joseph.olstad’s picture

Nice, 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?

poker10’s picture

I 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).

andypost’s picture

Issue summary: View changes

Release 8.3.0 is packaged to CI images https://www.drupal.org/pift-ci-job/2818363

andypost’s picture

poker10’s picture

I 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).

poker10’s picture

Hiding the old patch as we have now a MR here for testing.

joseph.olstad’s picture

@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

poker10’s picture

Yes - 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.

diogothecoder’s picture

Thanks @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?

liam morland’s picture

Status: Active » Needs review

All test are passing

liam morland’s picture

@poker10 Is there a reason the merge request is still marked as a draft?

poker10’s picture

@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.

andypost’s picture

Curious if it make sense to file PHP 8.4 compatibility issue as it coming in a month

poker10’s picture

The 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.

poker10’s picture

Status: Needs review » Active

Child 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)

joseph.olstad’s picture

Nice work Juraj!

Thanks for getting this in before January 2025!

andypost’s picture

Meantime PHP 8.4 is out)

poker10’s picture

I 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.

ressa’s picture

Thanks! 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?

poker10’s picture

Thanks @ressa! Added a mention about the PHP 8.3 compatibility to the release notes on https://www.drupal.org/project/drupal/releases/7.103.

ressa’s picture

Perfect! Thanks @poker10 and all the other D7 maintainers for keeping Drupal 7 updated, and expanding it with new features, like PHP 8.3 compatibility.

joseph.olstad’s picture

Status: Active » Fixed

Thanks especially to @poker10

poker10’s picture

Fixing credits.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.