Skip to content

Commit f4ac533

Browse files
committed
Read SYMFONY_IDE to render exception in case of fatal error
1 parent 5c34ba5 commit f4ac533

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

Debug/FileLinkFormatter.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\HttpKernel\Debug;
1313

14+
use Symfony\Component\ErrorHandler\ErrorRenderer\ErrorRendererInterface;
1415
use Symfony\Component\HttpFoundation\Request;
1516
use Symfony\Component\HttpFoundation\RequestStack;
1617
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@@ -24,16 +25,6 @@
2425
*/
2526
class FileLinkFormatter
2627
{
27-
private const FORMATS = [
28-
'textmate' => 'txmt://open?url=file://%f&line=%l',
29-
'macvim' => 'mvim://open?url=file://%f&line=%l',
30-
'emacs' => 'emacs://open?url=file://%f&line=%l',
31-
'sublime' => 'subl://open?url=file://%f&line=%l',
32-
'phpstorm' => 'phpstorm://open?file=%f&line=%l',
33-
'atom' => 'atom://core/open/file?filename=%f&line=%l',
34-
'vscode' => 'vscode://file/%f:%l',
35-
];
36-
3728
private array|false $fileLinkFormat;
3829
private ?RequestStack $requestStack = null;
3930
private ?string $baseDir = null;
@@ -44,7 +35,8 @@ class FileLinkFormatter
4435
*/
4536
public function __construct(string $fileLinkFormat = null, RequestStack $requestStack = null, string $baseDir = null, string|\Closure $urlFormat = null)
4637
{
47-
$fileLinkFormat = (self::FORMATS[$fileLinkFormat] ?? $fileLinkFormat) ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: false;
38+
$fileLinkFormat ??= $_SERVER['SYMFONY_IDE'] ?? null;
39+
$fileLinkFormat = (ErrorRendererInterface::IDE_LINK_FORMATS[$fileLinkFormat] ?? $fileLinkFormat) ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: false;
4840
if ($fileLinkFormat && !\is_array($fileLinkFormat)) {
4941
$i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f);
5042
$fileLinkFormat = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, \PREG_SPLIT_DELIM_CAPTURE);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=8.1",
20-
"symfony/error-handler": "^5.4|^6.0",
20+
"symfony/error-handler": "^6.1",
2121
"symfony/event-dispatcher": "^5.4|^6.0",
2222
"symfony/http-foundation": "^5.4|^6.0",
2323
"symfony/polyfill-ctype": "^1.8",

0 commit comments

Comments
 (0)