Score:0

Webform 5.3 to 6.1.0 , Error : Call to undefined method Drupal\webform\Routing\WebformUncacheableResponse::addCacheableDependency()

us flag

I updated the webform module from 5.3.0 to the latest version (6.1.0) and then when I click submit on one of my forms, I receive this ERROR:

Error: Call to undefined method Drupal\webform\Routing\WebformUncacheableResponse::addCacheableDependency() in Drupal\webform\Controller\WebformEntityController->javascript () (/home/acelys/www/uno-test.agglonet.com/web/modules /contrib/webform/src/Controller/WebformEntityController.php line 123)

I wrote the error on google and no response at all AND i looked at the line of code shown in the error message, I noticed that the addCacehableDependency() function was not used in the version Ancient and now it is used in the newer version of webform, but there is no error in this file where the code exists.

any ideas ? Thanks !

jbarrio avatar
cn flag
Have you done a drush deploy after upgrading the module looking for possible hook updates, etc? Have you cleared the cache?
cn flag
I’m voting to close this question because it’s a bug report for a contributed module and needs to be handled in the issue queue on Drupal.org
Score:3
cn flag

You need to wait until this issue is fixed https://www.drupal.org/project/webform/issues/3247584

If you want to patch it yourself, addCacheableDependency() works only with the second response:

  public function javascript(Request $request, WebformInterface $webform) {
    $assets = $webform->getAssets();
    if ($webform->access('update')) {
      $response = new WebformUncacheableResponse($assets['javascript'], 200, ['Content-Type' => 'text/javascript']);
    }
    else {
      $response = new CacheableResponse($assets['javascript'], 200, ['Content-Type' => 'text/javascript']);
      $response
        ->addCacheableDependency($webform)
        ->addCacheableDependency($this->config('webform.settings'));
    }
    return $response;
  }
OmarAc avatar
us flag
iI works, Thank you !
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.