Skip to content

Commit

Permalink
bug #19950 [FrameworkBundle] Parse source link maps using json_decode…
Browse files Browse the repository at this point in the history
…() instead of parse_str() (nicolas-grekas)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[FrameworkBundle] Parse source link maps using json_decode() instead of parse_str()

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | updated code exists only on master
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19807
| License       | MIT
| Doc PR        | symfony/symfony-docs#6944

Because `parse_str()` turns some characters into underscores in keys (e.g. `.`).

Commits
-------

9b174fb [FrameworkBundle] Parse source link maps using json_decode() instead of parse_str()
  • Loading branch information
nicolas-grekas committed Sep 16, 2016
2 parents a9c94a8 + eb7dd12 commit 5d98d75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Templating/Helper/CodeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function __construct($fileLinkFormat, $rootDir, $charset)
$fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
if ($fileLinkFormat && !is_array($fileLinkFormat)) {
$i = max(strpos($fileLinkFormat, '%f'), strpos($fileLinkFormat, '%l'));
$i = strpos($fileLinkFormat, '#', $i) ?: strlen($fileLinkFormat);
$i = strpos($fileLinkFormat, '#"', $i) ?: strlen($fileLinkFormat);
$fileLinkFormat = array(substr($fileLinkFormat, 0, $i), substr($fileLinkFormat, $i + 1));
parse_str($fileLinkFormat[1], $fileLinkFormat[1]);
$fileLinkFormat[1] = @json_decode('{'.$fileLinkFormat[1].'}', true) ?: array();
}
$this->fileLinkFormat = $fileLinkFormat;
$this->rootDir = str_replace('\\', '/', $rootDir).'/';
Expand Down

0 comments on commit 5d98d75

Please sign in to comment.