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

Circular reference detected for Drupal::service('url_generator') #609

Open
ivangrozni opened this issue Jun 21, 2022 · 3 comments
Open

Circular reference detected for Drupal::service('url_generator') #609

ivangrozni opened this issue Jun 21, 2022 · 3 comments

Comments

@ivangrozni
Copy link

ivangrozni commented Jun 21, 2022

I'm having issues debugging a php error that is only thrown during behat testing. If I try to load url_generator service during behat step definition I'm getting this error and the tests are ultimately failing.

Circular reference detected for service "url_generator", path: "url_generator". (Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException)

I was able to get all other services service I tried, looks like url_generator is the only exception. If I check:

$c = \Drupal::genContainer();
$c->hasService('url_generator');
=> bool(true)
$c->initialized('url_generator');
=> bool(false)
$c->get('url_generator');
=> Circular reference detected for service "url_generator", path: "url_generator". (Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException)

This error only started after I've updated to php8.1. I can not even reproduce if I run it within drush php console (I can get url_generator service normally).

The other url_generator service issue I see during behat execution is:

Type error: Drupal\Core\Routing\UrlGenerator::setContext(): Argument #1 ($context) must be of type Symfony\Component\Routing\RequestContext, null given (Behat\Testwork\Call\Exception\FatalThrowableError)

They are probably related somehow, not sure.

Any idea where could the error be?

@Berdir
Copy link
Contributor

Berdir commented Jun 21, 2022

That should be fixed with the latest Drupal driver version

@ivangrozni
Copy link
Author

@Berdir Thanks for response. I'll test it out

@mostepaniukvm
Copy link

After php8.1 update faced the same. Updating drupal/drupal-extension with all dependencies solved the problem

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

3 participants