Skip to content

Commit

Permalink
Check for xdebug link format via both ini_get and get_cfg_var
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Bessette authored and ClementGautier committed Jul 11, 2014
1 parent e40e325 commit 97e07d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/Symfony/Bridge/Twig/Extension/CodeExtension.php
Expand Up @@ -35,7 +35,15 @@ class CodeExtension extends \Twig_Extension
*/
public function __construct($fileLinkFormat, $rootDir, $charset)
{
$this->fileLinkFormat = empty($fileLinkFormat) ? ini_get('xdebug.file_link_format') : $fileLinkFormat;
if (empty($fileLinkFormat)) {
$fileLinkFormat = ini_get('xdebug.file_link_format');

if (empty($fileLinkFormat)) {
$fileLinkFormat = get_cfg_var('xdebug.file_link_format');
}
}

$this->fileLinkFormat = $fileLinkFormat;
$this->rootDir = str_replace('\\', '/', dirname($rootDir)).'/';
$this->charset = $charset;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Debug/ExceptionHandler.php
Expand Up @@ -349,7 +349,7 @@ private function formatPath($path, $line)
$path = self::utf8Htmlize($path);
$file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;

if ($linkFormat = ini_get('xdebug.file_link_format')) {
if (($linkFormat = ini_get('xdebug.file_link_format')) || ($linkFormat = get_cfg_var('xdebug.file_link_format'))) {
$link = str_replace(array('%f', '%l'), array($path, $line), $linkFormat);

return sprintf(' <a href="%s" title="Go to source">in %s line %d</a>', $link, $file, $line);
Expand Down

0 comments on commit 97e07d5

Please sign in to comment.