Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f532322

Browse filesBrowse files
bug #19950 [FrameworkBundle] Parse source link maps using json_decode() 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()
2 parents 2b0df63 + 9b174fb commit f532322
Copy full SHA for f532322

File tree

Expand file treeCollapse file tree

5 files changed

+11
-11
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+11
-11
lines changed

‎src/Symfony/Bridge/Twig/Extension/CodeExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Extension/CodeExtension.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public function __construct($fileLinkFormat, $rootDir, $charset)
3434
$fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
3535
if ($fileLinkFormat && !is_array($fileLinkFormat)) {
3636
$i = max(strpos($fileLinkFormat, '%f'), strpos($fileLinkFormat, '%l'));
37-
$i = strpos($fileLinkFormat, '#', $i) ?: strlen($fileLinkFormat);
37+
$i = strpos($fileLinkFormat, '#"', $i) ?: strlen($fileLinkFormat);
3838
$fileLinkFormat = array(substr($fileLinkFormat, 0, $i), substr($fileLinkFormat, $i + 1));
39-
parse_str($fileLinkFormat[1], $fileLinkFormat[1]);
39+
$fileLinkFormat[1] = @json_decode('{'.$fileLinkFormat[1].'}', true) ?: array();
4040
}
4141
$this->fileLinkFormat = $fileLinkFormat;
4242
$this->rootDir = str_replace('/', DIRECTORY_SEPARATOR, dirname($rootDir)).DIRECTORY_SEPARATOR;

‎src/Symfony/Bridge/Twig/Tests/Extension/CodeExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Extension/CodeExtensionTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ public function testGetName()
6464

6565
protected function getExtension()
6666
{
67-
return new CodeExtension('proto://%f#&line=%l#'.substr(__FILE__, 0, 5).'=foobar', '/root', 'UTF-8');
67+
return new CodeExtension('proto://%f#&line=%l#'.json_encode(substr(__FILE__, 0, 5)).':"foobar"', '/root', 'UTF-8');
6868
}
6969
}

‎src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public function __construct($fileLinkFormat, $rootDir, $charset)
3636
$fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
3737
if ($fileLinkFormat && !is_array($fileLinkFormat)) {
3838
$i = max(strpos($fileLinkFormat, '%f'), strpos($fileLinkFormat, '%l'));
39-
$i = strpos($fileLinkFormat, '#', $i) ?: strlen($fileLinkFormat);
39+
$i = strpos($fileLinkFormat, '#"', $i) ?: strlen($fileLinkFormat);
4040
$fileLinkFormat = array(substr($fileLinkFormat, 0, $i), substr($fileLinkFormat, $i + 1));
41-
parse_str($fileLinkFormat[1], $fileLinkFormat[1]);
41+
$fileLinkFormat[1] = @json_decode('{'.$fileLinkFormat[1].'}', true) ?: array();
4242
}
4343
$this->fileLinkFormat = $fileLinkFormat;
4444
$this->rootDir = str_replace('\\', '/', $rootDir).'/';

‎src/Symfony/Component/Debug/ExceptionHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/ExceptionHandler.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public function __construct($debug = true, $charset = null, $fileLinkFormat = nu
4040
$fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
4141
if ($fileLinkFormat && !is_array($fileLinkFormat)) {
4242
$i = max(strpos($fileLinkFormat, '%f'), strpos($fileLinkFormat, '%l'));
43-
$i = strpos($fileLinkFormat, '#', $i) ?: strlen($fileLinkFormat);
43+
$i = strpos($fileLinkFormat, '#"', $i) ?: strlen($fileLinkFormat);
4444
$fileLinkFormat = array(substr($fileLinkFormat, 0, $i), substr($fileLinkFormat, $i + 1));
45-
parse_str($fileLinkFormat[1], $fileLinkFormat[1]);
45+
$fileLinkFormat[1] = @json_decode('{'.$fileLinkFormat[1].'}', true) ?: array();
4646
}
4747
$this->debug = $debug;
4848
$this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
@@ -97,9 +97,9 @@ public function setFileLinkFormat($fileLinkFormat)
9797
{
9898
$old = $this->fileLinkFormat;
9999
if ($fileLinkFormat && !is_array($fileLinkFormat)) {
100-
$i = strpos($fileLinkFormat, '#') ?: strlen($fileLinkFormat);
100+
$i = strpos($fileLinkFormat, '#"') ?: strlen($fileLinkFormat);
101101
$fileLinkFormat = array(substr($fileLinkFormat, 0, $i), substr($fileLinkFormat, $i + 1));
102-
parse_str($fileLinkFormat[1], $fileLinkFormat[1]);
102+
$fileLinkFormat[1] = @json_decode('{'.$fileLinkFormat[1].'}', true) ?: array();
103103
}
104104
$this->fileLinkFormat = $fileLinkFormat;
105105
if ($old) {

‎src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public function __construct(Stopwatch $stopwatch = null, $fileLinkFormat = null,
4343
$fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
4444
if ($fileLinkFormat && !is_array($fileLinkFormat)) {
4545
$i = max(strpos($fileLinkFormat, '%f'), strpos($fileLinkFormat, '%l'));
46-
$i = strpos($fileLinkFormat, '#', $i) ?: strlen($fileLinkFormat);
46+
$i = strpos($fileLinkFormat, '#"', $i) ?: strlen($fileLinkFormat);
4747
$fileLinkFormat = array(substr($fileLinkFormat, 0, $i), substr($fileLinkFormat, $i + 1));
48-
parse_str($fileLinkFormat[1], $fileLinkFormat[1]);
48+
$fileLinkFormat[1] = @json_decode('{'.$fileLinkFormat[1].'}', true) ?: array();
4949
}
5050
$this->stopwatch = $stopwatch;
5151
$this->fileLinkFormat = $fileLinkFormat;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.