Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[HttpKernel] Use VarDumper in the profiler#19614

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 2 commits intosymfony:masterfromwouterj:profiler_dumper
Sep 17, 2016

Conversation

@wouterj
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed ticketspart of#18149
LicenseMIT
Doc PR-

/cc@javiereguiluz@nicolas-grekas As you're the main maintainers of the changed features.

Summary

  • ThevarToString() method is deprecated in favor ofcloneVar() (using the VarCloner) anddump() (using the VarDumper).

    This allows to show more detailed and better formatted data in the profiler.

  • TheData class of VarDumper is made serializable, to reduce the size of the stored profiler data.

Screenshots

sf-profiler-dumper

Further Improvements

  • Change the dump colors (I've now implemented a very basic light theme, but my colorskills are close to zero, so a proper designer should look at it)

TomasVotruba, felipsmartins, reypm, sergiors, apfelbox, and Renrhaf reacted with thumbs up emojiro0NL, hason, staabm, sstok, ogizanagi, DavidBadura, Koc, chalasr, unexge, HeahDude, and 7 more reacted with hooray emoji
returnstream_get_contents($dump);
}

@trigger_error('Dumping non-cloned data is deprecated since version 3.2 and will be removed in 4.0. Use DataCollector::cloneVar().',E_USER_DEPRECATED);
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

not sure if this makes sense:

  • Strings are still perfectly fine
  • Deprecations aren't shown, as profiler pages aren't data-collected afaik

@fabpot
Copy link
Member

@wouterj Looks really interesting. Would it be possible to try to keep the same vertical height as before?

Koc, ogizanagi, EnchanterIO, and patrick-mcdougle reacted with thumbs up emoji

$this->dumper->setOutput($prevOutput);
rewind($dump);

returnstream_get_contents($dump);
Copy link
Contributor

Choose a reason for hiding this comment

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

@nicolas-grekas is it possible provide more convenient api for getting dumped content?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Proposed a way to do this:#19616

Choose a reason for hiding this comment

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

This snippet can be reduced to three lines by using the second arg of the dump method and the third of steam_get_contents

Koc reacted with thumbs up emoji
@Koc
Copy link
Contributor

Koc commentedAug 14, 2016

ref#18149,#18074

@wouterj
Copy link
MemberAuthor

wouterj commentedAug 14, 2016
edited
Loading

Would it be possible to try to keep the same vertical height as before?

Yes. I've now updated the styles to accomplish this. The margin, padding and background (for visible correctness) have now been removed. New after screenshot:

sf-profiler-dumper-vertical-height

nouwaarom, mickaelandrieu, jakzal, sstok, staabm, yceruto, ogizanagi, DavidBadura, kevin-verschaeve, iammichiel, and 2 more reacted with heart emoji

* @author Nicolas Grekas <p@tchwork.com>
*/
class Data
class Dataimplements \Serializable

Choose a reason for hiding this comment

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

Is it need? I don't get why, can't the object be serialized without implementing this?

Copy link
Contributor

Choose a reason for hiding this comment

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

@wouterj can you show before/after content of serialized object? Looks like you pass all of the properties to serialize, does it some changes?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

reverted this change, it was also causing build errors.

@wouterj
Copy link
MemberAuthor

I don't understand the PHP 7.1 failures.

@yceruto
Copy link
Member

yceruto commentedAug 15, 2016
edited
Loading

If anything helps"A non well formed numeric value encountered" is a common data conversion error str to time or number format.

{
returnarray(
new \Twig_SimpleFunction('profiler_dump',array($this,'dumpValue')),
new \Twig_SimpleFunction('profiler_dump',array($this,'dumpValue'),array('is_safe' =>array('html'))),
Copy link
Member

@nicolas-grekasnicolas-grekasAug 16, 2016
edited
Loading

Choose a reason for hiding this comment

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

This looks dangerous to me: the legacy implementation is still in use, but it's now considered "html-safe".
What about using a new function instead?

@nicolas-grekas
Copy link
Member

See suggestions as patch directly innicolas-grekas#6

@nicolas-grekasnicolas-grekas changed the title[Profiler] Use VarDumper in the profiler[HttpKernel] Use VarDumper in the profilerAug 17, 2016
@wouterj
Copy link
MemberAuthor

Thanks@nicolas-grekas for your patch! I've cherry-picked it into this PR and tried to fix the LoggerDataCollector (not sure if this is what was expected though, will test later this week in a Symfony app).

I hope the PHP 7.1 test failure is suddently fixed as well. I've tested it using PHP 7.1.0-beta2 on my local PC and don't get the error.

@weaverryan
Copy link
Member

This is great! Is it possible in the component to have the objects dumped in a non-expanded state by default? I was thinking that for things like your contentDocument, it pushes the other content far down on the initial load of the page.

Thanks!

ogizanagi, unexge, and linaori reacted with thumbs up emoji

@wouterj
Copy link
MemberAuthor

@weaverryan I've now collapsed all dumps by default (and expanded the first level for the log context).

Also tried to fix the tests.

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedAug 18, 2016
edited
Loading

New suggestions inthe latest commit ofnicolas-grekas#6 (needs#19656 to be at its best):

  • add warnings in the "Logs" count, more important now that throwing exceptions in dev can be turned of (see[Debug] Better error handling #19568)
  • properly remove sanitizeContext: VarDumper does the job.

fabpot added a commit that referenced this pull requestAug 19, 2016
…ctures (nicolas-grekas)This PR was merged into the 3.2-dev branch.Discussion----------[VarDumper] Allow dumping subparts of cloned Data structures| Q             | A| ------------- | ---| Branch?       | master| New feature?  | yes| Tests pass?   | yes| License       | MIT| Doc PR     |symfony/symfony-docs#6891ping@wouterj: with this, we'll be able to dump only the trace for deprecations in#19614 instead of being forced to dump the full exception right now. See test case.We'd do `{{ profiler_dump(log.context.seek('trace')) }}` in `logger.html.twig`.Commits-------8f2f440 [VarDumper] Allow dumping subparts of cloned Data structures
@nicolas-grekas
Copy link
Member

PR rebased in my fork to benefit from latest VarDumper features. Don't forget to setframework.php_errors.log totrue inapp/config/config.yml until#19656 is merged.
This still needs work to put everything together in a nice way but I think my contrib can pause here as the difficult part related to tightly plugging VarDumper should be OK now.

@wouterj
Copy link
MemberAuthor

Discovered a problem with this implementation (with all latest work by@nicolas-grekas): The logger panel is now completely unresponsive in the CMF sandbox (it has 251 debug messages with context that includes a Doctrine mapped document).

Is there anyway to work around this?

@nicolas-grekas
Copy link
Member

That's one of the reasons why I think this needs more work :) The dumps integration is a bit rough right now, but there is no issue with the base implementation, only more CSS to write and a few JS to fine tune the US. What about adding back the show/hide context button?


namespaceSymfony\Component\Form\Extension\DataCollector;

useSymfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface;
Copy link
Member

Choose a reason for hiding this comment

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

useless as it is already in the same namespace

nicolas-grekas reacted with thumbs up emoji
@stof
Copy link
Member

The serialized data is fine. We never guaranteed BC on the storage format of the profiler between minor versions (i.e. you cannot load a profile generated with X.Y in a X.Z runtime, you have to clear your profile storage when upgrading, which is done by default as they are stored in the cache).

regarding the DebugAccessDecisionManager and the FormDataExtractor, I think it is fine, as they are mostly meant to be consumed by the profiler collectors.

@fabpot
Copy link
Member

what's the status of this PR? I would really like to be able to merge it in time for 3.2 (end of dev by the end of the month).

@wouterj
Copy link
MemberAuthor

With the great help of@nicolas-grekas, I think this PR is now finished and ready for review. I've just tested all changed profiler panels and fixed some small rendering issues.

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedSep 17, 2016
edited
Loading

Two glitches:

  • one test needs a fix in DumpDataCollectorTest
  • var-dumper ~3.2 needs to be added to the composer.json of SecurityBundle (require-dev)

@wouterj
Copy link
MemberAuthor

thanks, applied the changes

@nicolas-grekas
Copy link
Member

👍

@fabpot
Copy link
Member

Thank you@wouterj.

wouterj, ogizanagi, fsevestre, yceruto, kevintweber, rvanlaak, iammichiel, kbond, and aecca reacted with hooray emoji

@fabpotfabpot merged commiteddecbd intosymfony:masterSep 17, 2016
fabpot added a commit that referenced this pull requestSep 17, 2016
…icolas-grekas)This PR was merged into the 3.2-dev branch.Discussion----------[HttpKernel] Use VarDumper in the profiler| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets | part of#18149| License       | MIT| Doc PR        | -/cc@javiereguiluz@nicolas-grekas As you're the main maintainers of the changed features.Summary--- * The `varToString()` method is deprecated in favor of `cloneVar()` (using the VarCloner) and `dump()` (using the VarDumper).   This allows to show more detailed and better formatted data in the profiler. * The `Data` class of VarDumper is made serializable, to reduce the size of the stored profiler data.Screenshots---![sf-profiler-dumper](https://cloud.githubusercontent.com/assets/749025/17651142/9bcddc14-6260-11e6-80f6-81b84c82c0a3.png)Further Improvements--- * Change the dump colors (I've now implemented a very basic light theme, but my colorskills are close to zero, so a proper designer should look at it)Commits-------eddecbd [HttpKernel] Use VarDumper in the Logs&Events panels of the profiler41a7649 [HttpKernel] Use VarDumper in the profiler
@wouterjwouterj deleted the profiler_dumper branchSeptember 17, 2016 15:52
@fabpotfabpot mentioned this pull requestOct 27, 2016
fabpot added a commit that referenced this pull requestDec 2, 2016
…or should use cloneVar (ogizanagi)This PR was merged into the 3.2 branch.Discussion----------[WebProfilerBundle][Translator] Fix TranslationDataCollector should use cloneVar| Q             | A| ------------- | ---| Branch?       | 3.2| Bug fix?      | yes?| New feature?  | no?| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | N/A| License       | MIT| Doc PR        | N/AWas missed in#19614 ?### Before![capture d ecran 2016-11-30 a 15 45 33](https://cloud.githubusercontent.com/assets/2211145/20756865/9a416934-b714-11e6-9cb5-890a6222b6fa.png)### After![capture d ecran 2016-11-30 a 15 43 58](https://cloud.githubusercontent.com/assets/2211145/20756877/9efaccae-b714-11e6-9523-b3f8f2e4bd8c.png)Commits-------07cdfd5 [WebProfiler][Translator] Fix TranslationDataCollector should use cloneVar
ostrolucky pushed a commit to ostrolucky/symfony that referenced this pull requestMar 25, 2018
…Collector should use cloneVar (ogizanagi)This PR was merged into the 3.2 branch.Discussion----------[WebProfilerBundle][Translator] Fix TranslationDataCollector should use cloneVar| Q             | A| ------------- | ---| Branch?       | 3.2| Bug fix?      | yes?| New feature?  | no?| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | N/A| License       | MIT| Doc PR        | N/AWas missed insymfony#19614 ?### Before![capture d ecran 2016-11-30 a 15 45 33](https://cloud.githubusercontent.com/assets/2211145/20756865/9a416934-b714-11e6-9cb5-890a6222b6fa.png)### After![capture d ecran 2016-11-30 a 15 43 58](https://cloud.githubusercontent.com/assets/2211145/20756877/9efaccae-b714-11e6-9523-b3f8f2e4bd8c.png)Commits-------07cdfd5 [WebProfiler][Translator] Fix TranslationDataCollector should use cloneVar
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

9 participants

@wouterj@fabpot@Koc@yceruto@nicolas-grekas@weaverryan@stof@lunetics@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp