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

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

Merged
merged 1 commit into from Dec 8, 2016

Conversation

Projects
None yet
6 participants
@mbabker
Copy link
Contributor

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

xabbuh commented Dec 1, 2016

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

@nicolas-grekas

This comment has been minimized.

Copy link
Member

nicolas-grekas commented Dec 1, 2016

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

xabbuh commented Dec 2, 2016

Sorry, I confused that on my mobile. :(

👍 looks good to me

Status: Reviewed

@nicolas-grekas

This comment has been minimized.

Copy link
Member

nicolas-grekas commented Dec 2, 2016

👍

@nicolas-grekas nicolas-grekas added this to the 3.2 milestone Dec 6, 2016

@fabpot

This comment has been minimized.

Copy link
Member

fabpot commented Dec 8, 2016

Thank you @mbabker.

@fabpot fabpot merged commit 0cd2c58 into symfony:3.2 Dec 8, 2016

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request Dec 8, 2016

bug #20701 Ignore missing 'debug.file_link_formatter' service in Debu…
…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 mbabker:twig-bundle-deps branch Dec 8, 2016

@fabpot fabpot referenced this pull request Dec 13, 2016

Merged

Release v3.2.1 #20897

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