Update Status mailer policy broken by core hooks modernization

Created on 11 July 2025, about 1 month ago

Problem/Motivation

Update Status policy crashes in Drupal 11 due to missing update_requirements().

Error: Call to undefined function Drupal\symfony_mailer\Plugin\EmailBuilder\update_requirements() in .../modules/contrib/symfony_mailer/src/Plugin/EmailBuilder/UpdateEmailBuilder.php on line 64 #0 [internal function]: Drupal\symfony_mailer\Plugin\EmailBuilder\UpdateEmailBuilder->build()

(This location is from 1.6.x release but 2.x/src/Plugin/Mailer/UpdateMailer.php is also affected.)

Issue πŸ“Œ Convert hook requirements that do not interact with install time Active removed hooks from update.install, including update_requirements(), and replaced them with Drupal\update\Hook\UpdateRequirements. These calls will need to be replaced in the mailer policies.

Steps to reproduce

Install Drupal 11.2.0 or higher and enable the Update Status mailer policy. Drupal will crash when attempting to send a status email message.

I'm reluctant to elevate priority on this, but this has been causing cron runs to crash in my production environment.

Proposed resolution

This bug can be mitigated by disabling the Update Status policy and letting Drupal core generate the email message text.

Calls to update_requirements() will need to be replaced with calls to (I think) UpdateRequirements::runtime(), but I am not sure that the new autowired hook services can be injected as dependencies, so I currently have no recommendations about how to make this work.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Policy

Created by

πŸ‡ΊπŸ‡ΈUnited States micahw156

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

Comments & Activities

  • Issue created by @micahw156
  • πŸ‡ΊπŸ‡ΈUnited States micahw156
  • πŸ‡ΊπŸ‡ΈUnited States danchadwick Boston

    This issue is quite severe depending upon configuration. If a production site uses the update manager to send emails, then cron will crash, resulting in a total loss of cron activity (and the pollution of the error logs with many php errors). In my site, this means that none of the automatic processing the site requires happens, resulting in a near-complete loss of functionality.

    There priority guidelines for critical require that there be no workaround, so raising to major.

  • πŸ‡ΊπŸ‡ΈUnited States micahw156

    @danchadwick, I was able to mitigate this problem by disabling the update status override at admin/config/system/mailer/override which reverts update emails to Drupal Core's original unformatted state and allows cron to run without errors.

    Micah

  • πŸ‡ΊπŸ‡ΈUnited States danchadwick Boston

    @micahw156 - Yes, I saw that in the issue and did mitigate it as such. Without such a mitigation, it would definitely warrant critical priority. Thank you for your report.

  • πŸ‡¬πŸ‡§United Kingdom adamps

    The problem is that Core doesn't provide an API for the information that we need. So I had to call an internal function, which has now been removed. We can check the issue that removed it to see if it explains the replacement to use.

  • πŸ‡¬πŸ‡§United Kingdom adamps

    It looks like we could do something like this

    if (function_exists('update_requirements')) {
      $requirements = update_requirements('runtime');
    }
    else {
      $requirements = \Drupal::moduleHandler()->invoke('update', 'runtime_requirements');
    }
    

    My sites are still on D10 so I can't test it.

  • First commit to issue fork.
  • πŸ‡¨πŸ‡¦Canada RobLoach Earth

    Here's the patch.

  • πŸ‡¨πŸ‡¦Canada RobLoach Earth

    And here is the patch for 1.x

Production build 0.71.5 2024