Uncaught PHP Exception TypeError

Created on 10 June 2024, 6 months ago
Updated 12 June 2024, 5 months ago

Problem/Motivation

Hi,
After installing this module, my site got wsod.

Error message in nginx logs:

[error] 1089#1089: *765 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception TypeError: "Drupal\legal\EventSubscriber\LegalNavigationLock::__construct(): Argument #5 ($request_stack) must be of type Drupal\Core\Http\RequestStack, Symfony\Component\HttpFoundation\RequestStack given, called in /var/www/html/test/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259" at /var/www/html/test/web/modules/contrib/legal/src/EventSubscriber/LegalNavigationLock.php line 83" while reading response header from upstream, client: 172.20.10.2, server: new.test.com, request: "GET /en HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php8.3-fpm.sock:", host: "new.test.com", referrer: "https://new.test.com/en/admin/structure/menu/item/5/edit"

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: won't fix

Version

3.0

Component

Code

Created by

🇫🇮Finland anaconda777

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

Comments & Activities

  • Issue created by @anaconda777
  • 🇫🇮Finland anaconda777

    Was able to fix this with ChatGPT

    Just change ( modules/contrib/legal/src/EventSubscriber/LegalNavigationLock.php) the
    use Drupal\Core\Http\RequestStack;
    to
    use Symfony\Component\HttpFoundation\RequestStack;

    and
    use Symfony\Component\HttpKernel\Event\GetResponseEvent;
    to
    use Symfony\Component\HttpKernel\Event\RequestEvent;

    and line 109:
    should be like this:
    public function onKernelRequestLockNavigation(RequestEvent $event): void {

    Thanks again for chatgpt, dont have time to make patch sorry

  • First commit to issue fork.
  • Assigned to bharath-kondeti
  • 🇬🇧United Kingdom robert castelo

    There is no file modules/contrib/legal/src/EventSubscriber/LegalNavigationLock.php in the 3.0.2 release.

    Have you perhaps applied a patch that adds that file?

  • Status changed to Postponed: needs info 6 months ago
  • 🇮🇳India bharath-kondeti Hyderabad

    The patch file is already fixed in this issue https://www.drupal.org/project/legal/issues/2897486#comment-15572202 🐛 Don't log out users who do not accept the T&C Needs review .

  • Status changed to Closed: won't fix 6 months ago
  • 🇬🇧United Kingdom robert castelo

    OK, so the issue is a patch has been applied and now that patch throws an error with the latest release.

    The release is working fine.

  • 🇫🇮Finland anaconda777

    Oh sorry, it was indeed a old version and its patch. I think I didnt apply it to this version, maybe
    after composer install that file still stayed there...

Production build 0.71.5 2024