Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

HypeMC
Copy link
Member

@HypeMC HypeMC commented Oct 9, 2025

Q A
Branch? 7.4
Bug fix? yes
New feature? yes
Deprecations? no
Issues Fix #61971
License MIT

Currently, when profiling a console command, calls to dump() aren't collected.
With this PR, they'll be collected when profiling is enabled, or output directly when it's not.

Not entirely sure whether this should be considered a bug or simply a missing feature.

@carsonbot carsonbot added this to the 6.4 milestone Oct 9, 2025
@carsonbot carsonbot changed the title [HttpKernel][DebugBundle] Collect dumps when console profiling is enabled [DebugBundle][HttpKernel] Collect dumps when console profiling is enabled Oct 9, 2025
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be dealt with outside of the class? Inside the injected dumper?
I'm asking because this makes the constructor a bit weird.
Some explanations could be helpful.

* @return void
*/
public function configure()
public function configure(/* ?ConsoleCommandEvent $event = null */)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing @param

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@HypeMC
Copy link
Member Author

HypeMC commented Oct 11, 2025

Can't this be dealt with outside of the class? Inside the injected dumper? I'm asking because this makes the constructor a bit weird. Some explanations could be helpful.

@nicolas-grekas I've considered several approaches. The main obstacle I came across was having access to the Input object to check for the --profile option, while also avoiding unnecessary instantiation of the DumpDataCollector when profiling isn't enabled.

I also thought about creating a new implementation of DataDumperInterface, injecting both the CLI and collector dumpers into it, and turning it into a console event listener so it could access the Input object. Maybe that would be a better approach?

@HypeMC HypeMC force-pushed the dump-with-profile branch from b144bb7 to 26f1f11 Compare October 11, 2025 14:55
@nicolas-grekas
Copy link
Member

I wonder if not-instantiating the dump-collector is really a concern? Would it make things simpler if not?

Otherwise, let's add some explanation about the argument in an @param then?
Also some notes in the changelog/upgrade files.

@HypeMC
Copy link
Member Author

HypeMC commented Oct 11, 2025

I wonder if not-instantiating the dump-collector is really a concern? Would it make things simpler if not?

@nicolas-grekas It might not be a real concern, but it doesn't simplify things either. I could always inject the DumpDataCollector, but I'd still need access to the Input object, which would require making it a listener. Also, I'd need to add a new constructor argument to inject the CLI dumper, since the current dumper might be a Connection.

Otherwise, let's add some explanation about the argument in an @param then? Also some notes in the changelog/upgrade files.

Regarding the changelog/upgrade part, should I retarget 7.4 and mark it as a feature?

@HypeMC HypeMC force-pushed the dump-with-profile branch from 26f1f11 to d94360f Compare October 11, 2025 16:51
@nicolas-grekas
Copy link
Member

Yes, let's target 7.4.
Thanks for the chat 🙂

@HypeMC HypeMC changed the base branch from 6.4 to 7.4 October 11, 2025 17:19
@HypeMC HypeMC modified the milestones: 6.4, 7.4 Oct 11, 2025
@HypeMC HypeMC added Feature Bug and removed Bug labels Oct 11, 2025
@HypeMC HypeMC force-pushed the dump-with-profile branch from d94360f to 292adba Compare October 11, 2025 17:20
@HypeMC HypeMC force-pushed the dump-with-profile branch from 292adba to c4f8091 Compare October 11, 2025 17:29
@HypeMC
Copy link
Member Author

HypeMC commented Oct 11, 2025

Yes, let's target 7.4. Thanks for the chat 🙂

@nicolas-grekas Done. Thanks for the feedback.

@MatTheCat
Copy link
Contributor

I thought the logic was that if the dump had somewhere to be displayed on it wouldn’t appear in the profiler: that matched Twig’s dump function’s behavior. Should this one be updated too?

@HypeMC
Copy link
Member Author

HypeMC commented Oct 12, 2025

@MatTheCat With this PR, the dump() function works in the CLI the same way it does in the web context. When the profiler is not enabled, it outputs directly, otherwise, it sends the data to the profiler.

The Twig dump() function, on the other hand, renders the dump as part of the template in both contexts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Console][WebProfiler] Profiled commands don't contain dump data

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.