Problem/Motivation

// Overrides webform.exception_html_subscriber to support ExceptionEvent in
    // Drupal 9/Symfony 4.4.
    //
    // Issue #3113876: The "GetResponseForExceptionEvent::getException()"
    // method is deprecated since Symfony 4.4, use "getThrowable()" instead.
    // @see https://www.drupal.org/node/3113876
    if (floatval(\Drupal::VERSION) >= 9) {
      $definition = $container->getDefinition('webform.exception_html_subscriber');
      $definition->setClass('Drupal\webform\EventSubscriber\WebformDefaultExceptionHtmlSubscriber');
    }

The code above was inserted and WebformDefaultExceptionHtmlSubscriber.php created to support compatibility with Drupal 9 that is compatible with symfony 4.4 and remove the deprecated code.
But the WebformDefaultExceptionHtmlSubscriber has the deprecated getException method that should be replaced with getThrowable.

CommentFileSizeAuthor
#3 updated_test.png60.26 KBguilhermevp
#2 3213647-2.patch807 bytespaulocs

Comments

paulocs created an issue. See original summary.

paulocs’s picture

Assigned: paulocs » Unassigned
Status: Active » Needs review
StatusFileSize
new807 bytes
guilhermevp’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new60.26 KB

Patch works as intended.

1

jrockowitz’s picture

Status: Reviewed & tested by the community » Needs work

Can the patch use if (floatval(\Drupal::VERSION) >= 9) { so that we can commit it? When Drupal 9.x is only supported I can removed the if/then statement.

paulocs’s picture

Hey @jrockowitz,
I didn't add it before because WebformDefaultExceptionHtmlSubscriber.php is used only if in Drupal 9.
WebformServiceProvider.php already does this verification.
See:

if (floatval(\Drupal::VERSION) >= 9) {
      $definition = $container->getDefinition('webform.exception_html_subscriber');
      $definition->setClass('Drupal\webform\EventSubscriber\WebformDefaultExceptionHtmlSubscriber');
    }

Should I add #4 in the patch anyway?

Cheers, Paulo.

jrockowitz’s picture

Okay, I would have to investigate this is a little. The 6.x version needs to work in Drupal 8/9

paulocs’s picture

Okay.
It works with both I just mean that WebformExceptionHtmlSubscriber is replaced with WebformDefaultExceptionHtmlSubscriber when the user is using D9 so maybe the verification #4 would be duplicated as WebformDefaultExceptionHtmlSubscriber is only used if if (floatval(\Drupal::VERSION) >= 9).

WebformServiceProvider subscribe the service based on the Drupal version.

// Overrides webform.exception_html_subscriber to support ExceptionEvent in
    // Drupal 9/Symfony 4.4.
    //
    // Issue #3113876: The "GetResponseForExceptionEvent::getException()"
    // method is deprecated since Symfony 4.4, use "getThrowable()" instead.
    // @see https://www.drupal.org/node/3113876
    if (floatval(\Drupal::VERSION) >= 9) {
      $definition = $container->getDefinition('webform.exception_html_subscriber');
      $definition->setClass('Drupal\webform\EventSubscriber\WebformDefaultExceptionHtmlSubscriber');
    }
jrockowitz’s picture

Status: Needs work » Reviewed & tested by the community

Gotcha! I think this is RTBC

jrockowitz’s picture

  • paulocs authored 5df7d61 on 6.x
    Issue #3213647 by paulocs, guilhermevp: getException() method is...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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