Apologies for the title. I wasn't sure how to make it more succinct.

Problem/Motivation

Handlers provided by modules are removed from the webform if the providing module is selected for uninstall even if the confirmation form for the un-installation is cancelled.

Steps to reproduce

  1. go to https://simplytest.me/
  2. Choose Webform ( I tested 5.16, 5.22 and 5.23-beta1)
  3. When logged in, install the Webform Scheduled Email Handler module
  4. Go to the Emails/Handlers for the default Contact webform
  5. Add a Scheduled Email Handler with any configuration
  6. Go to the module Uninstall form
  7. Select Webform Scheduled Email Handler to uninstall and click the Uninstall button
  8. You will see the uninstall confirm form which will list the contact form as an item to have configuration updated
  9. Click Cancel
  10. Return to the Emails/Handlers for the Contact form
  11. The Scheduled email handler will not be present anymore

The handler actually drops off of the webform as soon as the uninstall button is clicked on the uninstall list.
If you open the uninstall form in a new tab and get to the uninstall confirmation screen and then check your Handlers again in another tab your handler will be gone.

I noticed this when testing a custom module that is providing a webform handler. I was testing the uninstall/install process for the module and noticed that my handlers went missing even though I had chickened out and not uninstalled the module just yet. I had cancelled the uninstall at the confirmation form.

I then tried it with a handler provided by the webform module proper and experienced the same thing. Three tests on separate simplytest.me instances with nothing else installed have done the same thing. I'm not sure in the slightest yet why this happens.

Proposed resolution

Prevent handlers from being removed from webforms until their providing modules are fully uninstalled.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jimmynash created an issue. See original summary.

jrockowitz’s picture

Status: Active » Needs review
FileSize
1.96 KB

I was able to reproduce this issue and the attached patch fixes it but \Drupal\webform\Plugin\WebformHandlerInterface::deleteHandler is no longer invoked when a handler is deleted while its dependant module is uninstalled.

Still, I agree that this is a major bug where a handler is globally removed if someone just considers uninstalling its associated module.

jrockowitz’s picture

jimmynash’s picture

I tested the patch manually against my older version on my project at 5.16 and it did work.

I don't know what you mean about the deleteHandler not being invoked though. Is that a side effect of the patch in #3?

I still need to test this against an updated version but it did work for where I'm at now.

Thanks!

jrockowitz’s picture

When the handler was deleted via the uninstall screen,
Webform::deleteWebformHandler was being invoked. With this patch, Webform::deleteWebformHandle is no longer invoked when a handler is uninstalled. This is a very minor change and I doubt anyone is using \Drupal\webform\Plugin\WebformHandlerInterface::deleteHandler

  • jrockowitz authored 186a2df on 8.x-5.x
    Issue #3183339 by jrockowitz: Handlers provided by modules are removed...
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch since it addresses a Major issue. Please download the latest dev release to review.

  • jrockowitz authored 186a2df on 6.x
    Issue #3183339 by jrockowitz: Handlers provided by modules are removed...

Status: Fixed » Closed (fixed)

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