-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Symfony version(s) affected: 5.x
Description
The documentation for the framework.ide
configuration says:
[...] If you prefer to open those files in your favorite IDE or text editor, set this option to any of the following values:
phpstorm
,sublime
,textmate
,macvim
,emacs
,atom
andvscode
.
Setting one of these values will automatically resolve them to the respective xdebug.file_link_format
, i.e. atom
will be expanded to atom://core/open/file?filename=%f&line=%l
.
But when using environment variables for this configuration the value is not expanded automatically.
How to reproduce
The following two configurations work as expected, i.e. file links in the profiler are rendered as atom://core/open/file?...
:
# config/packages/framework.yaml
framework:
ide: 'atom' # set short version directly
# config/packages/framework.yaml
parameters:
file_link_format: 'atom'
framework:
ide: '%file_link_format%' # set short version via parameter expansion
While the following does not work as expected:
# config/packages/framework.yaml
framework:
ide: '%env(FILE_LINK_FORMAT)%' # take value from environment
# .env
FILE_LINK_FORMAT=atom
Here the value is used literally and all file links in the profiler are rendered as <a href="atom">...</a>
Possible Solution
The automatic expansion of the known link formats is done in Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension::load()
.
But this seems to be executed only once when configuration was changed and the result is cached (i.e. at "parse-time"?). Since the value of the environment is only known at run-rime it is evaluated after this.
-
Solution in code: refactor such that the expansion of known link formats is done after expansion of all environment variables in the configuration - i.e. at run-time with every call.
-
Solution in docs: document that expansion of the known formats does not work with environment variables.