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

Ignore missing 'debug.file_link_formatter' service in Debug and Twig bundles #20701

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
Dec 8, 2016
Merged

Ignore missing 'debug.file_link_formatter' service in Debug and Twig bundles #20701

merged 1 commit into from
Dec 8, 2016

Conversation

mbabker
Copy link
Contributor

@mbabker mbabker commented Nov 30, 2016

Q A
Branch? 3.2
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? TBD
Fixed tickets N/A
License MIT
Doc PR N/A

The TwigBundle's twig.extension.code service and the DebugBundle's data_collector.dump service require the new debug.file_link_formatter service however this is only available with the FrameworkBundle or WebProfilerBundle 3.2. The class it refers to was added to the HttpKernel at 3.2 as well. In the case of the TwigBundle, attempting to upgrade a site's dependencies where you try to install symfony/twig-bundle ~3.2 with symfony/framework-bundle <3.2 or symfony/web-profiler-bundle <3.2 causes a ServiceNotFoundException with message 'The service "twig" has a dependency on a non-existent service "debug.file_link_formatter".' to be thrown.

@mbabker
Copy link
Contributor Author

mbabker commented Nov 30, 2016

Wait, the service is also defined as part of the Framework bundle with 3.2. So either way it seems there's a missing required dependency, but now I'm not sure what it should be.

@xabbuh
Copy link
Member

xabbuh commented Dec 1, 2016

In the TwigBundle, we could just pass null if the service does not exist to fall back to the default behaviour:

<service id="twig.extension.code" class="Symfony\Bridge\Twig\Extension\CodeExtension" public="false">
    <tag name="twig.extension" />
    <argument type="service" id="debug.file_link_formatter" on-invalid="ignore"></argument>
    <argument>%kernel.root_dir%</argument>
    <argument>%kernel.charset%</argument>
</service>

@mbabker mbabker changed the title TwigBundle 3.2 requires WebProfilerBundle ~3.2 Ignore missing 'debug.file_link_formatter' service in TwigBundle Dec 1, 2016
@mbabker
Copy link
Contributor Author

mbabker commented Dec 1, 2016

Thanks for that idea @xabbuh. I've changed the PR's details to match the suggestion.

@xabbuh
Copy link
Member

xabbuh commented Dec 1, 2016

I think we can solve this for the FrameworkBundle in a similar way.

@nicolas-grekas
Copy link
Member

Shouldn't we patch these files also?
src/Symfony/Bundle/DebugBundle/Resources/config/services.xml
src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml

@xabbuh, it looks like debug.file_link_formatter is always defined in FrameworkBundle 3.2, isn't it?

@mbabker mbabker changed the title Ignore missing 'debug.file_link_formatter' service in TwigBundle Ignore missing 'debug.file_link_formatter' service in Debug and Twig bundles Dec 1, 2016
@mbabker
Copy link
Contributor Author

mbabker commented Dec 1, 2016

Shouldn't we patch these files also?
src/Symfony/Bundle/DebugBundle/Resources/config/services.xml

Done

src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml

Not needed, the service has a second definition in that file and the bundle depends on HttpKernel ~3.2 so the service class will always exist.

@xabbuh
Copy link
Member

xabbuh commented Dec 2, 2016

I think you also need to update the DumpDataCollector to properly deal with the passed formatter being null.

@mbabker
Copy link
Contributor Author

mbabker commented Dec 2, 2016

It does already unless I've misread

$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
?

@xabbuh
Copy link
Member

xabbuh commented Dec 2, 2016

Sorry, I confused that on my mobile. :(

👍 looks good to me

Status: Reviewed

@nicolas-grekas
Copy link
Member

👍

@nicolas-grekas nicolas-grekas added this to the 3.2 milestone Dec 6, 2016
@fabpot
Copy link
Member

fabpot commented Dec 8, 2016

Thank you @mbabker.

@fabpot fabpot merged commit 0cd2c58 into symfony:3.2 Dec 8, 2016
fabpot added a commit that referenced this pull request Dec 8, 2016
…g and Twig bundles (mbabker)

This PR was merged into the 3.2 branch.

Discussion
----------

Ignore missing 'debug.file_link_formatter' service in Debug and Twig bundles

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | TBD
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

The TwigBundle's `twig.extension.code` service and the DebugBundle's `data_collector.dump` service require the new `debug.file_link_formatter` service however this is only available with the FrameworkBundle or WebProfilerBundle 3.2.  The class it refers to was added to the HttpKernel at 3.2 as well.  In the case of the TwigBundle, attempting to upgrade a site's dependencies where you try to install `symfony/twig-bundle ~3.2` with `symfony/framework-bundle <3.2` or `symfony/web-profiler-bundle <3.2` causes a `ServiceNotFoundException` with message 'The service "twig" has a dependency on a non-existent service "debug.file_link_formatter".' to be thrown.

Commits
-------

0cd2c58 Ignore missing 'debug.file_link_formatter' service in Debug and Twig bundles
@mbabker mbabker deleted the twig-bundle-deps branch December 8, 2016 13:14
@fabpot fabpot mentioned this pull request Dec 13, 2016
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.

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