Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Fatal Error with PHP 8.2 when using drupal api driver #659

Open
bserem opened this issue Feb 6, 2024 · 3 comments
Open

PHP Fatal Error with PHP 8.2 when using drupal api driver #659

bserem opened this issue Feb 6, 2024 · 3 comments

Comments

@bserem
Copy link

bserem commented Feb 6, 2024

On projects that get updated to PHP 8.2 we get the following issue when trying to run API tests:

PHP Fatal error:  Declaration of Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::addListener($event_name, $listener, $priority = 0) must be compatible with Symfony\Component\EventDispatcher\EventDispatcherInterface::addListener(string $eventName, callable $listener, int $priority = 0): void in /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php on line 217

I suspect it's the PHP version, if someone else can also verify

@bserem
Copy link
Author

bserem commented Feb 7, 2024

As a temporary workaround, passing php 8.1 as a dependency in composer.json gets the jb done:

  "config": {
    "bin-dir": "bin/",
    "platform": {
        "php": "8.1"
    }
  },

@pfrenssen
Copy link
Collaborator

Are you sure this is caused by drupalextension code? It is not clear from the report where the error is originating or how to replicate it. It could also be possible it is thrown in Drupal itself or in the jhedstrom/DrupalDriver project. Can you perhaps provide a full backtrace?

@bserem
Copy link
Author

bserem commented Jun 13, 2024

@pfrenssen how can I generate a full backtrace?

The problem seems to be that Drupal requires symfony/event-dispatcher:6.4.2 whereas drupalextension install symfony/event-dispatcher:7.1.1 unless you restrict it manually.

(sorry for the late reply, life got in the way)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants