Skip to content

Commit

Permalink
bug#9154 Fix problem with Windows file links (backslash in JavaScript…
Browse files Browse the repository at this point in the history
… string) (fabpot)

This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #9154).

Discussion
----------

Fix problem with Windows file links (backslash in JavaScript string)

This PR was submitted on the symfony/WebProfilerBundle read-only repository and moved automatically to the main Symfony repository (closes symfony/web-profiler-bundle#5).

When you have set php.ini setting xdebug.file_link_format, under Windows this window.location call here isn't escaped properly, so it results in something like:

```HTML
<span class="sf-toolbar-info-method" onclick="window.location='pstorm://open/?url=file://F:\HtDocs\myproject\src\Foo\Core\Controller\PageController.php&amp;line=28';window.event.stopPropagation();return false;">
    pageAction
</span>
```

All backslashes in window.location are treated as escape sequences witch result in an incorrect link:
pstorm://open/?url=file://F:HtDocsmyprojectsrcFooCoreControllerPageController.php&line=28

So clicking this link my IDE (phpStorm) couldn't find that file.

The patch fixes this by escaping the backslashes.

Commits
-------

03c6027 Fix problem with Windows file links (backslash in JavaScript string)
  • Loading branch information
fabpot committed Sep 27, 2013
2 parents 27cc10c + 5e2ac93 commit a46ff2f
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -5,7 +5,7 @@
{% if collector.controller.class is defined %}
{% set link = collector.controller.file|file_link(collector.controller.line) %}
<span class="sf-toolbar-info-class sf-toolbar-info-with-next-pointer">{{ collector.controller.class|abbr_class }}</span>
<span class="sf-toolbar-info-method" onclick="{% if link %}window.location='{{link}}';window.event.stopPropagation();return false;{% endif %}">
<span class="sf-toolbar-info-method" onclick="{% if link %}window.location='{{link|e('js')}}';window.event.stopPropagation();return false;{% endif %}">
{{ collector.controller.method }}
</span>
{% else %}
Expand Down

0 comments on commit a46ff2f

Please sign in to comment.