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 #3500632: Convert hook_requirements() that do not interact with install time 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
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | 3535562-status-mail-broken-hook.patch | 2.48 KB | majid.ali |
| #10 | 3535562-symfony-mailer--8-for-1.x.patch | 868 bytes | robloach |
| #9 | 3535562-symfony-mailer--8.patch | 813 bytes | robloach |
Issue fork symfony_mailer-3535562
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
Comment #2
micahw156Comment #3
danchadwick commentedThis 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.
Comment #4
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
Comment #5
danchadwick commented@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.
Comment #6
adamps commentedThe 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.
Comment #7
adamps commentedIt looks like we could do something like this
My sites are still on D10 so I can't test it.
Comment #9
robloachHere's the patch.
Comment #10
robloachAnd here is the patch for 1.x
Comment #11
adamps commentedThe MR appears to have no commits.
Comment #12
sah62 commentedI'm running 1.6.2. The 1.x patch seems to be working for me.
Comment #13
johnny5th commentedThe patch works great but exposes another issue:
UpdateEmailBuilder provides a link to the update manager, which has been removed in 11.2.
Comment #14
adamps commented@johnny5th Good point. We can check if the route exists, or just catch the RouteNotFoundException.
Comment #18
oulalahakabu commentedMRs done.
Comment #19
adamps commentedThanks. Would be great if someone else could test.
#13 is still open. It could be put into a separate issue, but would be nicer to add it here if possible.
Comment #24
adamps commentedThanks everyone. I have fixed the extra problem from #13 and it all looks good.
Comment #26
adamps commentedComment #30
majid.ali commentedIssue still persist in 1.x after updating to Drupal 11.2. Same reason as for 2.x the route
update.report_updatehas been removed https://www.drupal.org/node/3511861 and throws errorRoute "update.report_update" does not exist.. Pushed the fix in MR https://git.drupalcode.org/project/symfony_mailer/-/merge_requests/184/d... and added static patch as well.allow_authorize_operationsis deprecated in 12 https://www.drupal.org/node/3571399 and it will be removed.Comment #31
nojj commentedI have the same issue with a Drupal 11.3.7 site and Mailer 1.6.2.
what patch do I need to fix this?
the site does not crash, but the mails are not sent.