Skip to content

Ignore missing 'debug.file_link_formatter' service in Debug bundle #21292

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

Merged
merged 1 commit into from
Feb 6, 2017

Conversation

core23
Copy link
Contributor

@core23 core23 commented Jan 14, 2017

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/A

The new HtmlDumper requires the debug.file_link_formatter service which isn't available in older versions of the DebugBundle

@core23 core23 changed the base branch from master to 3.2 January 14, 2017 15:19
@core23 core23 changed the title Patch/debug ignore Ignore missing 'debug.file_link_formatter' service in Debug bundle Jan 14, 2017
@@ -38,7 +38,7 @@
<argument>0</argument> <!-- flags -->
<call method="setDisplayOptions">
<argument type="collection">
<argument key="fileLinkFormat" type="service" id="debug.file_link_formatter"></argument>
<argument key="fileLinkFormat" type="service" id="debug.file_link_formatter" on-invalid="ignore"></argument>
Copy link
Member

Choose a reason for hiding this comment

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

If the service is invalid then the call still occurs with an empty collection as argument. I suggest to remove the call entirely and add it conditionally in DebugExtension instead

@nicolas-grekas nicolas-grekas added this to the 3.2 milestone Jan 16, 2017
@nicolas-grekas
Copy link
Member

@core23 can you look at @chalasr's comment please?

@core23
Copy link
Contributor Author

core23 commented Jan 22, 2017

I'm a little bit busy right now. Hope I can have a look at this next weekend.

@core23 core23 force-pushed the patch/debug-ignore branch 3 times, most recently from f93ce7e to bdd59ae Compare January 28, 2017 19:02
/**
* {@inheritdoc}
*/
public function getXsdValidationBasePath()
Copy link
Member

Choose a reason for hiding this comment

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

should be removed

/**
* {@inheritdoc}
*/
public function getNamespace()
Copy link
Member

Choose a reason for hiding this comment

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

should be removed

*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('var_dumper.html_dumper')) {
Copy link
Member

Choose a reason for hiding this comment

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

could be !$container->hasDefinition('var_dumper.html_dumper') || !$container->hasDefinition('debug.file_link_formatter'), removing the next check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch


$dumperDefinition->addMethodCall('setDisplayOptions', array(
array(
'fileLinkFormat' => $formatterDefintion,
Copy link
Member

Choose a reason for hiding this comment

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

this is wrong. You must use a reference, not an inline definition (which would create another instance of the class, as it would be a different service)

@@ -36,11 +36,6 @@
<argument>null</argument>
<argument>%kernel.charset%</argument>
<argument>0</argument> <!-- flags -->
<call method="setDisplayOptions">
<argument type="collection">
<argument key="fileLinkFormat" type="service" id="debug.file_link_formatter"></argument>
Copy link
Member

Choose a reason for hiding this comment

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

much simpler would be to use on-invalid="ignore" instead of changing it in a compiler pass

Copy link
Member

@chalasr chalasr Feb 2, 2017

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I agree with @stof. Looks like overkill to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was my first implementation #21292 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

@core23 I know. and a community review asked you to change it, but several core team members looking at your PR are preferring the first implementation until now (and other core team members have not said what they prefer).

Copy link
Member

Choose a reason for hiding this comment

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

sorry about the bad suggestion!

@stof
Copy link
Member

stof commented Feb 2, 2017

status: needs work

@core23
Copy link
Contributor Author

core23 commented Feb 3, 2017

Fixed :)

@chalasr
Copy link
Member

chalasr commented Feb 3, 2017

Looks good to me 👍

Status: needs review

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.

👍

@xabbuh
Copy link
Member

xabbuh commented Feb 6, 2017

👍

@core23 core23 force-pushed the patch/debug-ignore branch 2 times, most recently from ef86dc8 to 2d60309 Compare February 6, 2017 16:23
@core23 core23 force-pushed the patch/debug-ignore branch from 2d60309 to 2201fbe Compare February 6, 2017 16:35
@xabbuh
Copy link
Member

xabbuh commented Feb 6, 2017

Rereading the discussion at #21292 (comment) I think it would indeed be simpler to use the on-invalid attribute and drop the compiler pass.

@core23
Copy link
Contributor Author

core23 commented Feb 6, 2017

Fixed that

@nicolas-grekas
Copy link
Member

Thank you @core23.

@nicolas-grekas nicolas-grekas merged commit 2201fbe into symfony:3.2 Feb 6, 2017
nicolas-grekas added a commit that referenced this pull request Feb 6, 2017
…g bundle (core23)

This PR was merged into the 3.2 branch.

Discussion
----------

Ignore missing 'debug.file_link_formatter' service in Debug bundle

| 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/A

The new `HtmlDumper` requires the `debug.file_link_formatter` service which isn't available in older versions of the `DebugBundle`

Commits
-------

2201fbe Ignore missing 'debug.file_link_formatter' service in Debug bundle
@core23 core23 deleted the patch/debug-ignore branch February 6, 2017 16:43
@fabpot fabpot mentioned this pull request Feb 17, 2017
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.

7 participants