setRequest issue with Drupal 10.3

Created on 28 June 2024, 6 months ago
Updated 19 July 2024, 5 months ago

Problem/Motivation

In my projects, if I try to update to Drupal 10.3 I have the following issue when I try to apply database update :

TypeError: Drupal\views\ViewExecutable::setRequest(): Argument #1 ($request) must be of type Symfony\Component\HttpFoundation\Request, null given,

If I disable content_snapshot the problem disappear.

The problem seems to come from ContentSnapshotExtensionPass, when I comment the line $container->addCompilerPass(new ContentSnapshotExtensionPass()) it's ok.

Steps to reproduce

Setup project with Drupal 10.3 and install/enable content_snapshot

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇫🇷France notFloran Reims

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

Comments & Activities

  • Issue created by @notFloran
  • 🇮🇳India abhiyanshu

    Disabling a module/Commenting out the code should generally be considered a temporary workaround.
    It's better to address the error instead.

    Coming to the error, it seems there's a problem with the setRequest() method of the ViewExecutable class in the Views module. Specifically, it expects a Symfony\Component\HttpFoundation\Request object as the argument, but it's receiving null instead.

    I think we need to set a request object before calling setRequest()

    use Symfony\Component\HttpFoundation\Request;
    
    $request = Request::createFromGlobals();
    $viewExecutable->setRequest($request);
  • 🇫🇷France notFloran Reims

    Yep I know is not a solution, my comment about that was here to help to debug the issue.

    I dig a little more and it seems like it's the call to the "module_handler" service that's causing the problem : $container->get('module_handler')

  • 🇵🇱Poland Luke_Nuke

    Just a heads-up, that this module is not abandoned, and I'll be looking into all reported stuff soon, so thanks for the feedback, and thanks for your patience ^^

Production build 0.71.5 2024