|
@@ -13,6 +13,10 @@ namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
|
|
|
|
|
|
use Symfony\Component\Templating\Helper\Helper;
|
|
|
|
|
|
+if (!defined('ENT_SUBSTITUTE')) {
|
|
|
+ define('ENT_SUBSTITUTE', 8);
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* CodeHelper.
|
|
|
*
|
|
@@ -22,17 +26,20 @@ class CodeHelper extends Helper
|
|
|
{
|
|
|
protected $fileLinkFormat;
|
|
|
protected $rootDir;
|
|
|
+ protected $charset;
|
|
|
|
|
|
/**
|
|
|
* Constructor.
|
|
|
*
|
|
|
* @param string $fileLinkFormat The format for links to source files
|
|
|
* @param string $rootDir The project root directory
|
|
|
+ * @param string $charset The charset
|
|
|
*/
|
|
|
- public function __construct($fileLinkFormat, $rootDir)
|
|
|
+ public function __construct($fileLinkFormat, $rootDir, $charset)
|
|
|
{
|
|
|
$this->fileLinkFormat = empty($fileLinkFormat) ? ini_get('xdebug.file_link_format') : $fileLinkFormat;
|
|
|
$this->rootDir = str_replace('\\', '/', $rootDir).'/';
|
|
|
+ $this->charset = $charset;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -173,7 +180,7 @@ class CodeHelper extends Helper
|
|
|
}
|
|
|
|
|
|
if (false !== $link = $this->getFileLink($file, $line)) {
|
|
|
- return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', $link, $text);
|
|
|
+ return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), $text);
|
|
|
}
|
|
|
|
|
|
return $text;
|