Problem/Motivation

PHP 8.4 alpha1 released at July 6, 2024, feature freeze and first beta at Aug 15 2024, stable is expected November 21, 2024.
Release schedule is https://wiki.php.net/todo/php84
Release cycle change https://wiki.php.net/rfc/release_cycle_update

Proposed resolution

General deprecations RFC https://wiki.php.net/rfc/deprecations_php_8_4

Remaining follow-up #3490454: [META] Replace E_USER_WARNING with exception handling for edge cases in error reporting

Done

- Deprecate passing E_USER_ERROR to trigger_error() - #3465827: Stop passing E_USER_ERROR to trigger_error() on PHP 8.4
- Deprecate proprietary CSV escaping mechanism #3477324: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4
- Closures now displays its source location, see merged PR #3477366: Fix closures in tests for PHP 8.4
- Remove E_STRICT error level and deprecate E_STRICT constant - #3465826: Remove deprecated in PHP 8.4 the \E_STRICT usage

Deprecations in dependencies

- issue #624 #3488401: upgrade prophecy to 1.20
- #3484463: Upgrade open-telemetry packages for PHP 8.4
- https://github.com/minkphp/Mink/pull/869 #3484728: update behat/mink to 1.12.0 for PHP 8.4

- composer 2.8.2 https://github.com/composer/composer/commit/8ae6fa1205897dcfc57867542c94...
- phpstan dependencies https://github.com/reactphp/promise/pull/259
- phpunit 10.5.35/9.6.21 #3477361: Update phpunit/phpunit to 9.6.21 for PHP 8.4
- guzzle fixed guzzle, promises, psr - waiting for 7.8.2 release
- https://github.com/open-telemetry/opentelemetry-php/pull/1297 commit

- - justinrainbow/json-schema fixed via 5.3.0 and composer 2.7.8
- https://github.com/bovigo/vfsStream/issues/289, PR, v1.6.12 #3471080: Update mikey179/vfsstream to v1.6.12 for PHP 8.4

Remaining tasks

- #3414933: [PHP 8.4] Use DOMDocument HTML5 support when available
- Get CI environment #3488473: Add core testing using PHP 8.4
- track progress of changes in upcoming releases
- #3479340: Adopt #[\Deprecated] attribute the RFC

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3427903

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

Gábor Hojtsy created an issue. See original summary.

andypost’s picture

andypost’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes
andypost’s picture

andypost’s picture

andypost’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes
andypost’s picture

andypost’s picture

updated vendor patch as vendor/psr/http-factory/src/UploadedFileFactoryInterface.php is fixed

catch’s picture

Tentatively tagging this for 10.3 and 11.0 release highlights. It would be pretty nice to be able to say we're compatible with PHP 8.4 before it's even released, although feels like there might be more breaking changes before it gets to rc, so maybe only really possible for 11.0 rather than 10.3. If there's still outstanding issues or we're not convinced about 8.4 stability, we could change this to 10.4/11.1.

andypost’s picture

Issue summary: View changes

As release schedule updated, PHP feature freeze (13 Aug) and first beta at Aug 15 2024

Added to IS

andypost’s picture

ATM the real blocker to pass tests is "prophecy" as usual, all failed tests are caused by not fixed (nullable types) when mocks are instantiated

andypost’s picture

andypost’s picture

Issue summary: View changes
andypost’s picture

Published PHP 8.4_alpha1 image

andypost’s picture

andypost’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes

Updated IS, for alpha2 a bit less tests failed

only on build-test remains

---- Drupal\BuildTests\Command\GenerateThemeTest ----
Status    Group      Filename          Line Function                            
--------------------------------------------------------------------------------
Fail      Other      phpunit-5.xml        0 Drupal\BuildTests\Command\GenerateT
    PHPUnit Test failed to complete; Error: PHPUnit 10.5.26 by Sebastian
    Bergmann and contributors.
    
    Runtime:       PHP 8.4.0alpha2
    Configuration: /builds/issue/drupal-3427903/core/phpunit.xml.dist
    
    .....F.........                                                   15 / 15
    (100%)
    
    Time: 01:50.329, Memory: 16.00 MB
    
    There was 1 failure:
    
    1)
    Drupal\BuildTests\Command\GenerateThemeTest::testContribStarterkitDevSnapshotWithGitNotInstalled
    Fake git used by process.
    Failed asserting that 0 matches expected 127.
    
    /builds/issue/drupal-3427903/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php:291
    
    FAILURES!
    Tests: 15, Assertions: 81, Failures: 1.
---- Drupal\BuildTests\TestSiteApplication\InstallTest ----
andypost’s picture

Only 1 failed test left (see #22) https://git.drupalcode.org/issue/drupal-3427903/-/pipelines/226036/test_...

Also there's a lot of deprecations because of prophecy but they could be added to ignored deprecations

catch’s picture

That build test failure looks familiar and is something to do with sqlite, #3458975: GenerateThemeTest::testContribStarterkitDevSnapshotWithGitNotInstalled fails on sqlite shows the same error.

andypost’s picture

rfay’s picture

DDEV HEAD has PHP8.4.0alpha2 now, this should help with resolving the various issues. This will be updated and be in the next DDEV release, but is already available easily via HEAD, even using Homebrew. See https://ddev.readthedocs.io/en/stable/developers/building-contributing/#...

andypost’s picture

I pushed to CI 8.4alpha3 using patch so in 2 weeks first beta should arive

Ref https://git.drupalcode.org/project/drupalci_environments/-/commit/753d2a...

andypost’s picture

PHP released alpha4 instead of broken alpha3

Ref https://downloads.php.net/~saki/

andypost’s picture

xjm’s picture

Title: [META] Make Drupal 10.3/11 compatible with PHP 8.4 » [META] Make Drupal 10/11 compatible with PHP 8.4
Issue tags: -10.3.0 release highlights, -11.0.0 release notes
Parent issue: #3366286: [META] Make Drupal 10.2/11 compatible with PHP 8.3 » #3465335: [meta] Requirements for tagging 11.1.0-beta1 and 10.4.0-beta1
Related issues: +#3366286: [META] Make Drupal 10.2/11 compatible with PHP 8.3

Moving to target 11.1.0/10.4.0. Some or all of the fixes might still be backportable to the patch branches, but targeting the minors will help us keep track of things as we get closer to the PHP 8.4.0 release.

andypost’s picture

andypost’s picture

Issue summary: View changes
andypost’s picture

All tests pass now except BigPipeTest caused by #3465827: Stop passing E_USER_ERROR to trigger_error() on PHP 8.4

    1) Drupal\Tests\big_pipe\Functional\BigPipeTest::testBigPipe
    Two new watchdog entries.
    Failed asserting that 6 matches expected 4.
    
    /builds/issue/drupal-3427903/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php:195
andypost’s picture

Issue summary: View changes

composer finally released https://getcomposer.org/changelog/2.7.8

production 8.4 image updated so less changes in pipeline

andypost’s picture

Issue summary: View changes
andypost’s picture

andypost’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes

updated remaining dependencies

andypost’s picture

andypost’s picture

PHPstan fixed by pcov added 8.4 image and now only BigPipe test fails

andypost’s picture

First green run!

The changes in the fix probably needs split #3465827: Stop passing E_USER_ERROR to trigger_error() on PHP 8.4

andypost’s picture

PHP 8.4 allow to use `#[Deprecated]` attribute even for class/interface constants https://3v4l.org/rGPoD/rfc


class A {
#[Deprecated]
const A='a';
}

interface B {
    #[Deprecated]
    const B='b';
}
var_dump(A::A);
var_dump(B::B);

results

Deprecated: Constant A::A is deprecated in /in/rGPoD on line 11
string(1) "a"

Deprecated: Constant B::B is deprecated in /in/rGPoD on line 12
string(1) "b"
andypost’s picture

Issue summary: View changes
andypost’s picture

andypost’s picture

Deprecation of E_STRICT just commited and fix backported to 10.4 in #3465826: Remove deprecated in PHP 8.4 the \E_STRICT usage

andypost’s picture

I pushed update of PHP CI image to 8.4.0 RC1 and a lots of new deprecations appeared... both in core and vendors(

andypost’s picture

Issue tags: +Barcelona2024

New deprecations

- https://github.com/composer/composer/commit/8ae6fa1205897dcfc57867542c94...
- https://github.com/sebastianbergmann/phpunit/commit/d7d8e73cfc78788ff6c7...

    /builds/issue/drupal-3427903/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php:101
    str_getcsv(): the $escape parameter must be provided as its default value
    will change

    /builds/issue/drupal-3427903/vendor/composer/composer/src/Composer/Util/Silencer.php:36
    Constant E_STRICT is deprecated
andypost’s picture

andypost’s picture

andypost’s picture

Issue summary: View changes

Filed #3477361: Update phpunit/phpunit to 9.6.21 for PHP 8.4

composer patch should wait for 2.7.10

andypost’s picture

Issue summary: View changes

And the last issue filed with patch #3477366: Fix closures in tests for PHP 8.4

andypost’s picture

Issue summary: View changes

phpunit upgraded to 11.x and will be backported to 10.4

andypost’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes
andypost’s picture

Filed minor upgrade for composer #3478331: Upgrade composer to 2.8.1 for PHP 8.4

rfay’s picture

Just stopping by to say thanks for all your work on this!

andypost’s picture

Issue summary: View changes

Composer dependencies been updated so remaining incompatibilities are 3 packages + phpstan (still using patches)

The only blocker is #3465827: Stop passing E_USER_ERROR to trigger_error() on PHP 8.4

PS: RTBC and waiting for commit #3477324: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4

andypost’s picture

andypost’s picture

Issue summary: View changes

andypost’s picture

andypost’s picture

composer fixed the issue so waiting for 2.8.2 release to update images

andypost’s picture

Filed open-telemetry upgrade #3484463: Upgrade open-telemetry packages for PHP 8.4

So only Mink and Prophecy releases left to wait

andypost’s picture

andypost’s picture

Issue summary: View changes

OT merged, only prophecy left (updated IS)

andypost’s picture

andypost’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes

Updated IS as there's one dependency waiting for release (Prophecy) and the only issue left #3465827: Stop passing E_USER_ERROR to trigger_error() on PHP 8.4

andypost’s picture

Issue summary: View changes

Prophecy has new release so filed last dependency upgrade - #3488401: upgrade prophecy to 1.20

PS: 10.5/10.4 branches require more upgrades (guzzle at least) via #3486545: Update Composer dependencies for 10.4.0-beta1

andypost’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes
andypost’s picture

So only 1 failure for 10.4 left

---- Drupal\Tests\Core\Database\ConditionTest ----
Status    Group      Filename          Line Function                            
--------------------------------------------------------------------------------
Fail      Other      phpunit-77.xml       0 Drupal\Tests\Core\Database\Conditio
    PHPUnit Test failed to complete; Error: PHPUnit 9.6.21 by Sebastian
    Bergmann and contributors.
    
    Testing Drupal\Tests\Core\Database\ConditionTest
    .......................                                           23 / 23
    (100%)
    
    Time: 00:00.194, Memory: 8.00 MB
    
    OK (23 tests, 33 assertions)
    
    Remaining self deprecation notices (4)
    
      1x: Invalid characters in query operator: IS NOT NULL) ;INSERT INTO
    {test} (name) VALUES ('test12345678'); -- 
        1x in ConditionTest::testCompileWithSqlInjectionForOperator from
    Drupal\Tests\Core\Database
    
      1x: Invalid characters in query operator: IS NOT NULL) UNION ALL SELECT
    name, pass FROM {users_field_data} -- 
        1x in ConditionTest::testCompileWithSqlInjectionForOperator from
    Drupal\Tests\Core\Database
    
      1x: Invalid characters in query operator: IS NOT NULL) UNION ALL SELECT
    name FROM {TEST_UPPERCASE} -- 
        1x in ConditionTest::testCompileWithSqlInjectionForOperator from
    Drupal\Tests\Core\Database
    
      1x: Invalid characters in query operator: = 1 UNION ALL SELECT password
    FROM user WHERE uid =
        1x in ConditionTest::testCompileWithSqlInjectionForOperator from
    Drupal\Tests\Core\Database

andypost’s picture

Issue summary: View changes

The last remaining bit is to enable CI #3488473: Add core testing using PHP 8.4

liam morland’s picture

I have added PHP 8.4 and Drupal 10.4 and 11.1 to the PHP support page.

andypost’s picture

andypost changed the visibility of the branch 10.5.x to hidden.

andypost changed the visibility of the branch 10.4.x to hidden.

andypost’s picture

Version: 11.x-dev » 10.4.x-dev
Status: Active » Fixed
Issue tags: +10.4.0 release notes

Used to run pipelines for the current 10.4 and 10.5 and both are green!

- https://git.drupalcode.org/issue/drupal-3427903/-/pipelines/378581
- https://git.drupalcode.org/issue/drupal-3427903/-/pipelines/378594

So closing this one and 10.4.0 release post can mention about compatibility like https://www.drupal.org/blog/drupal-11-1-0

Status: Fixed » Closed (fixed)

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

xjm’s picture

Belatedly granting Andy credit for all his work here.