Skip to content

[FrameworkBundle][Profiler][Console][Messenger] RunCommandMessage disables the profiler #52925

@kaznovac

Description

@kaznovac

Symfony version(s) affected

6.4.*

Description

Running command via messenger with RunCommandMessage will disable profiler for the current request.

How to reproduce

create controller that dispatches RunCommandMessage and look for the profiler

Possible Solution

allow mixing of virtual (cli) and http request stack (use them interchangeably).
maybe cli profiler should be represented as subrequest in this context?

Additional Context

Profiler gets disabled as the --profile option is not set:

if (!$input->hasOption('profile') || !$input->getOption('profile')) {
$this->profiler->disable();
return;
}

But simply making RunCommandMessageHandler profiler configuration aware (to append the --profile cli parameter option) will not work straightforwardly as VirtualRequestStack will forbid mixing of RequestStacks

if ($this->decorated->getCurrentRequest()) {
throw new \LogicException('Cannot mix virtual and HTTP requests.');
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions