PHP 8.4 compatibility improved

Created on 5 June 2025, about 2 months ago

Problem/Motivation

There is a lot of "Deprecated: XXX(): Implicitly marking parameter $xxx as nullable is deprecated, the explicit nullable type must be used instead in xxx_file.php on line xxx" warnings after cache reset under Drupal 11 and php 8.4.

Proposed resolution

Use nullable types for such parameters. Available since PHP 7.1 so no worries about backwards compatibility.

πŸ“Œ Task
Status

Active

Version

3.35

Component

Code

Created by

πŸ‡§πŸ‡ΎBelarus f1mishutka Minsk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @f1mishutka
  • πŸ‡§πŸ‡ΎBelarus f1mishutka Minsk

    f1mishutka β†’ changed the visibility of the branch 3528571-php-8.4-compatibility to hidden.

  • Pipeline finished with Success
    about 2 months ago
    Total: 149s
    #515114
  • πŸ‡§πŸ‡ΎBelarus f1mishutka Minsk

    Simple patch ready in merge request. Actually just a matter of php syntax, no functionality changed.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Merged into 8.x-3.x-dev

  • πŸ‡§πŸ‡ΎBelarus f1mishutka Minsk

    Thanks!

  • First commit to issue fork.
  • πŸ‡©πŸ‡ͺGermany hosterholz

    There are still nullable parameters and another deprecation

    FILE: /var/www/html/docroot/themes/contrib/bootstrap/src/Plugin/Provider/ProviderException.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------
     29 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be
        |         | explicitly nullable instead. Found implicitly nullable parameter: $previous.
        |         | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/docroot/themes/contrib/bootstrap/src/Plugin/Markdown/AllowedHtml/Bootstrap.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------
     23 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be
        |         | explicitly nullable instead. Found implicitly nullable parameter: $activeTheme.
        |         | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/docroot/themes/contrib/bootstrap/src/Utility/ArrayObject.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------
     17 | WARNING | When the magic __serialize() and __unserialize() methods are available and the code base does not need
        |         | to support PHP < 7.4, the implementation of the Serializable interface can be removed.
        |         | (PHPCompatibility.Interfaces.RemovedSerializable.RedundantSerializableImplementation)
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/docroot/themes/contrib/bootstrap/src/SerializedResponse.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ------------------------------------------------------------------------------------------------------------------------
      98 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be
         |         | explicitly nullable instead. Found implicitly nullable parameter: $request.
         |         | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
     127 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be
         |         | explicitly nullable instead. Found implicitly nullable parameter: $request.
         |         | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
     143 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be
         |         | explicitly nullable instead. Found implicitly nullable parameter: $request.
         |         | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/docroot/themes/contrib/bootstrap/deprecated.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------
     718 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be
         |         | explicitly nullable instead. Found implicitly nullable parameter: $target.
         |         | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
    ------------------------------------------------------------------------------------------------------------------------
    
    
  • πŸ‡§πŸ‡ΎBelarus f1mishutka Minsk

    f1mishutka β†’ changed the visibility of the branch issue-3528571-php8.4-compatibility to hidden.

  • πŸ‡§πŸ‡ΎBelarus f1mishutka Minsk

    MR 61 looks good and works for us.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    This is all merged into the 8.x-3.x dev branch

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    I'll wait a bit before tagging 3.36

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Thanks @hosterholz!

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    crediting for fix

  • πŸ‡§πŸ‡ΎBelarus f1mishutka Minsk
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    creditted dejan.maric.max and socialnicheguru for their work in the related issue.

Production build 0.71.5 2024