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

Error: "You have requested a synthetic service ("request")." when using excluded_404s #123

Closed
yannickl88 opened this issue May 18, 2015 · 1 comment

Comments

@yannickl88
Copy link

Whey I configure the bundle to use excluded_404s for a fingers_crossed handler I get the following error:

RuntimeException in ContainerBuilder.php line 915:
You have requested a synthetic service ("request"). The DIC does not know how to construct this service.

When looking in the code, I think this causes the error (MonologExtension.php line 293-298)

} elseif (!empty($handler['excluded_404s'])) {
    $activationDef = new Definition('%monolog.activation_strategy.not_found.class%', array($handler['excluded_404s'], $handler['action_level']));
    $activationDef->addMethodCall('setRequest', array(new Reference('request', ContainerInterface::NULL_ON_INVALID_REFERENCE, false)));
    $container->setDefinition($handlerId.'.not_found_strategy', $activationDef);
    $activation = new Reference($handlerId.'.not_found_strategy');
} else {

I'm using symfony 2.6.7 with monolog-bundle 2.7.1

My guess is that the MonologExtension should use the request stack, but that might not be compatible with older versions of symfony.

@Seldaek
Copy link
Member

Seldaek commented Jun 20, 2015

Yeah and in my experience this isn't an issue so I am not sure why you experience that.

fabpot added a commit that referenced this issue Oct 19, 2016
This PR was squashed before being merged into the 3.x-dev branch (closes #169).

Discussion
----------

Deprecate the NotFoundActivationStrategy class

Use the version that is in monolog-bridge instead. That version uses
request_stack rather than request from the service container, which
means excluded_404s shall be properly ignored in Symfony 3.

Replaces #94, Fixes #166 and invalidates #123.

This change remains backwards compatible with Symfony 2.6 and above.

Commits
-------

b77bdf0 Deprecate the NotFoundActivationStrategy class
@fabpot fabpot closed this as completed Oct 19, 2016
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