Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Enable DebugBundle #710

Merged
merged 1 commit into from
Sep 25, 2014
Merged

Enable DebugBundle #710

merged 1 commit into from
Sep 25, 2014

Conversation

nicolas-grekas
Copy link
Member

This enables the DebugBundle as proposed in symfony/symfony#10640

fabpot added a commit to symfony/symfony that referenced this pull request Sep 23, 2014
…an, moux2003, tony-co, romainneutron, oscherler, lyrixx)

This PR was merged into the 2.6-dev branch.

Discussion
----------

VarDumper and DebugBundle

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

From a user land point of view, this PR creates a global `dump()` function that is to be used instead of `var_dump()`. The component can be used standalone in any dev workflow. Please see the [provided README](https://github.com/symfony/symfony/pull/10640/files?short_path=52d526f#diff-52d526f19bc9e3825c80e7694755409c) for details.

When used with the Framework bundle, variables passed to `dump()` are dumped in a new dedicated panel in the web toolbar. The function is also available in twig templates.

Regarding the implementation, I'm pretty sure you'll find a lot to comment. As I'm sure of nothing else, not even the names of things, please do.

I tried to organize this PR in several commits, from the most fundamental algorithm to pure Symfony glue.
I suggest you follow this order while progressing in the review and the discussion around this PR, so that we can together validate commits one after the other.

Don't hesitate to fork the PR and submit PR on it, I'll cherry-pick your patches.

TODO:
- [x] open a doc PR: symfony/symfony-docs#4243
- [x] open a PR on the Standard edition: symfony/symfony-standard#710
- [x] prefix the CSS classes
- [x] tests for the DebugBundle + other Symfony glue classes
- [x] inline css and js for compat with e.g. Silex
- [x] finish and merge nicolas-grekas/Patchwork-Dumper#5 for better UX
- [x] show a dump excerpt on hovering the icon in the toolbar
- [x] verify README and comments
- [x] validate interfaces/names (Caster / Cloner / Dumper)
- [x] validate new VarDumper component + DebugBundle
- [x] validate Resource/ext/ vs independent repos.
- [x] test and define behavior after KernelEvents::RESPONSE
- [x] update dependencies between components/bundles and composer.json files
- [x] no hard dep on iconv

Not for this PR but might be worth later:
- show a light stack trace + timing + memory at debug() calls
- create a "theme" concept for custom colors/UX

Commits
-------

80fd736 [DebugBundle] Enhance some comments
2e167ba [TwigBridge] add Twig dump() function + tests and fixes
0f8d30f [VarDumper] Replace \e with \x1B in CliDumper to support colour in PHP < 5.4
d43ae82 [VarDumper] Add workaround to https://bugs.php.net/65967
a8d81e4 [DebugBundle] Inlined assets to avoid installation issues
5f59811 [DebugBundle] Add doc example for Twig usage
e4e00ef [TwigBridge] DumpNode and Token parser
de05cd9 [DebugBundle] enhance dump excerpts
49f13c6 [HttpKernel] add tests for DumpDataCollector
081363c [HttpKernel] tests for DumpListener
0d8a942 [VarDumper] add Stub objects for cutting cleanly and dumping consts
c8746a4 [DebugBundle] add tests for twig and for the bundle
8d5d970 [DebugBundle] adjust after review
eb98c81 [DebugBundle] dump() + better Symfony glue
9dea601 [DebugBundle] global dump() function for daily use
297d373 [VarDumper] README, LICENSE and composer.json
a69e962 [VarDumper] tests for HtmlDumper
5eaa187 [VarDumper] tests for CliDumper
e6dde33 [VarDumper] HTML variant of the CLI dumper
fa81544 [VarDumper] CLI dedicated dumper and related abstract
1d5e3f4 [VarDumper] interface for dumping collected variables
0266072 [VarDumper] casters for DOM objects
c426d8b [VarDumper] casters for Doctrine objects
0a92c08 [VarDumper] casters for PDO related objects
da3e50a [VarDumper] casters for SPL data structures
c91bc83 [VarDumper] casters for exceptions representation
3ddbf4b [VarDumper] add casters for per class/resource custom state extraction
5b7ae28 [VarDumper] symfony_debug ext. fast and memory efficient cloning algo
07135a0 [VarDumper] algo to clone any PHP variable to a breadth-first queue
4bf9300 [Debug] a README for the debug extension
eec5c92 [Debug] Symfony debug extension
@stof
Copy link
Member

stof commented Sep 25, 2014

👍

@nicolas-grekas
Copy link
Member Author

Did I miss a composer.json update?

@kbond
Copy link
Member

kbond commented Sep 25, 2014

what about adding the function file from the component to autoload-dev in the composer.json?

@stof
Copy link
Member

stof commented Sep 25, 2014

@nicolas-grekas nope, given that the SE already requires the fullstack repo at 2.6

@nicolas-grekas
Copy link
Member Author

@kbond I don't see the benefit.
It could also expose prod env to fatal errors: if a dump() is committed (by mistake) but the function not loaded. That's safer this way IMHO.

@fabpot
Copy link
Member

fabpot commented Sep 25, 2014

Thank you @nicolas-grekas.

@fabpot fabpot merged commit dadea61 into symfony:master Sep 25, 2014
fabpot added a commit that referenced this pull request Sep 25, 2014
This PR was merged into the 2.6-dev branch.

Discussion
----------

Enable DebugBundle

This enables the DebugBundle as proposed in symfony/symfony#10640

Commits
-------

dadea61 Enable DebugBundle
@kbond
Copy link
Member

kbond commented Sep 25, 2014

I think it would be safer to have a fatal error than potentially dumping sensitive data in production..

@nicolas-grekas nicolas-grekas deleted the debug-bundle branch September 25, 2014 15:52
@Tobion
Copy link
Contributor

Tobion commented Sep 27, 2014

the argument of @kbond makes sense to me.

@stof
Copy link
Member

stof commented Oct 2, 2014

Well, the prod should be configured with a debug handler which does not dump to the output but to somewhere else (potentially to nowhere).

@martijn80
Copy link

Im looking for a way to this (configuring the debug handler to output to nowhere in production) @stof anyplace to start?

@lyrixx
Copy link
Member

lyrixx commented May 20, 2015

@martijn80 Thanks to this PR, you can

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

Successfully merging this pull request may close these issues.

7 participants