PHP 8.4 compatibility

Created on 8 January 2025, about 2 months ago

Problem/Motivation

Deprecated: Drupal\symfony_mailer\Controller\SymfonyMailerController::createPolicy(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/symfony_mailer/src/Controller/SymfonyMailerController.php on line 171

Steps to reproduce

Rebuild cache on PHP 8.4

Proposed resolution

  /**
   * Creates a policy and redirects to the edit page.
   *
   * @param string $policy_id
   *   The policy ID.
   * @param \Symfony\Component\HttpFoundation\Request|null $request
   *   The current request.
   *
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   A redirect to the policy edit page.
   */
  public function createPolicy(string $policy_id, ?Request $request = NULL) {

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @solideogloria
  • Hi @solideogloria, i think the version should be 1.x-dev instead of 2.x-dev. Can you please verify it once.

  • Pipeline finished with Success
    about 2 months ago
    Total: 233s
    #396367
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia hetal.solanki

    @solideogloria

    I have review MR!123 after upgrade php version and MR working fine.

    So i am moving this issue in RTBC.

    Thank you!!

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom adamps

    Patches should be committed to 2.x first please then we can backport (it is the default branch for a reason๐Ÿ˜ƒ).

    The MR seems to only change the comment - missing the actual change to the function.

  • The function is already fixed in 1.x, it seems.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom adamps

    Looks like it. I did a fix in a hurry without creating an issue, commit b286c9c7c6740419c7ad5d63fdadfa68f97f3f76. I didn't yet create a release.

    Please can someone confirm it's fixed in 1.x dev?

  • I still get warnings after using cex in a php 8.4/drupal 11 environment:

    PHP Deprecated:  Drupal\symfony_mailer\Processor\OverrideManager::getInfo(): Implicitly marking parameter $filterId as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/symfony_mailer/src/Processor/OverrideManager.php on line 153
    
    Deprecated: Drupal\symfony_mailer\Processor\OverrideManager::getInfo(): Implicitly marking parameter $filterId as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/symfony_mailer/src/Processor/OverrideManager.php on line 153
    PHP Deprecated:  Drupal\symfony_mailer\Processor\OverrideManagerInterface::getInfo(): Implicitly marking parameter $filterId as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/symfony_mailer/src/Processor/OverrideManagerInterface.php on line 62
    
    Deprecated: Drupal\symfony_mailer\Processor\OverrideManagerInterface::getInfo(): Implicitly marking parameter $filterId as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/symfony_mailer/src/Processor/OverrideManagerInterface.php on line 62

    Seems like we need to change the type hint, as well:

    public function getInfo(string $filterId = NULL);

    to

    public function getInfo(?string $filterId = NULL);

    Should I create a new patch/mr?

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom adamps

    Great thanks.

    There should be a release fairly soon, however I do want to get some other fixes in first. Anyone in a hurry can take the dev release or apply the very simple code change as a patch.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States drupgirl

    Applied path 123.diff on version 1.5 and this issue still exists.

    PHP Deprecated: Drupal\symfony_mailer\Controller\SymfonyMailerController::createPolicy(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in /web/modules/contrib/symfony_mailer/src/Controller/SymfonyMailerController.php on line 171

    Deprecated: Drupal\symfony_mailer\Controller\SymfonyMailerController::createPolicy(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in /web/modules/contrib/symfony_mailer/src/Controller/SymfonyMailerController.php on line 171

Production build 0.71.5 2024