View Issue Details

IDProjectCategoryView StatusLast Update
0001344XdebugUncategorizedpublic2020-03-12 17:01
Reporternicolas-grekas Assigned Toderick  
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionwon't fix 
Product Version2.4.1 
Summary0001344: Allow prefix remapping with xdebug.file_link_format
Description

When a PHP app runs inside a container/VM, files needs to be remapped so that one file in the /foobar directory on the guest points to e.g /home/... in the host.

We're going to add this feature in Symfony, by using an additional convention in file_link_format: a trailing # after %f & %l defines a map of prefixes that need remapping.

e.g. subl://%f:%l#/foobar/=/home/toto/&/baz/=/home/titi/ remaps both /foobar/ & /baz/.
the string after # is parsed with parse_url.

See https://github.com/symfony/symfony/pull/19807

Would be nice to also have this natively in xdebug.

TagsNo tags attached.
Operating System
PHP Version7.0.5-7.0.9

Activities

nicolas-grekas

2016-10-05 08:38

reporter   ~0003716

Last edited: 2017-01-03 21:35

Because parse_str replaces e.g. dots by underscores, Symfony replaced parse_str by custom processing, see.
https://github.com/symfony/symfony/pull/20101

The = separator is now > to make it even less ikelly to collide with a char in some path. The above example should be updated to:
subl://%f:%l&/foobar/>/home/toto/&/baz/>/home/titi/ remaps both /foobar/ & /baz/.

derick

2016-12-11 23:29

administrator   ~0004004

Where would Xdebug get this information from?

nicolas-grekas

2016-12-29 19:09

reporter   ~0004103

From the existing xdebug.file_link_format setting itself!

derick

2017-01-03 18:41

administrator   ~0004113

Sorry, I still don't understand what you are asking. What is that extra stuff supposed to do? The file link format is rendered by Xdebug for whenever a file/line number is shown in HTML.

nicolas-grekas

2017-01-03 21:34

reporter   ~0004146

Last edited: 2017-01-03 21:36

Let's say xdebug.file_link_format=subl://%f:%l&/foobar/>/home/toto/&/baz/>/home/titi/

The first "&" after the last "%f|%l" starts a map, where keys and values are separated by ">", and key-value pairs by a "&". In the previous example, the map is:

  • /foobar/ => /home/toto/
  • /baz/ => /home/titi/

This map defines prefixes that should be replaced in the rendered file.
Eg if file is "/foobar/abc/def", the "%f" will be rendered as "/home/toto/abc/def".

This is useful on VM/container setups, where paths inside the VM have a different prefix from the IDE pov.

For reference, the logic in Symfony is implemented by this class:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php

derick

2017-01-04 10:06

administrator   ~0004148

IMO, it's up to IDEs to implement these mappings. And many already do so.

PhpStorm: https://www.jetbrains.com/help/phpstorm/2016.3/deployment-mappings-tab.html
Netbeans: http://forums.netbeans.org/ptopic53513.html
Eclipse PDT: http://www.eclipse.org/pdt/help/html/adding_a_server_path_map.htm
Sublime Text: https://github.com/martomo/SublimeTextXdebug#features

Xdebug never does anything with path mappings itself, as it doesn't know about them. I don't think it should do this depending on a setting that is supposed to format a link. Having this information both in PHP configuration, and in an IDE, is double up and likely going to be confusing — setting up path mappings is confusing enough for many people.

Issue History

Date Modified Username Field Change
2016-09-01 15:55 nicolas-grekas New Issue
2016-10-05 08:38 nicolas-grekas Note Added: 0003716
2016-12-11 23:29 derick Note Added: 0004004
2016-12-11 23:29 derick Assigned To => derick
2016-12-11 23:29 derick Status new => feedback
2016-12-29 19:09 nicolas-grekas Note Added: 0004103
2016-12-29 19:09 nicolas-grekas Status feedback => assigned
2017-01-03 18:41 derick Note Added: 0004113
2017-01-03 18:41 derick Status assigned => feedback
2017-01-03 21:34 nicolas-grekas Note Added: 0004146
2017-01-03 21:34 nicolas-grekas Status feedback => assigned
2017-01-03 21:34 nicolas-grekas Note Edited: 0004146
2017-01-03 21:35 nicolas-grekas Note Edited: 0003716
2017-01-03 21:35 nicolas-grekas Note Edited: 0004146
2017-01-03 21:36 nicolas-grekas Note Edited: 0004146
2017-01-04 10:06 derick Note Added: 0004148
2017-01-04 10:06 derick Status assigned => resolved
2017-01-04 10:06 derick Resolution open => won't fix
2020-03-12 17:01 derick Category Feature/Change request => Uncategorized