Skip to content

Commit c62d609

Browse files
35481 Modified the code to use escapeQuote except addslashes
1 parent 4346564 commit c62d609

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

app/code/Magento/Theme/Block/Html/Header.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace Magento\Theme\Block\Html;
88

9+
use Magento\Framework\Escaper;
10+
911
/**
1012
* Html page header block
1113
*
@@ -14,6 +16,27 @@
1416
*/
1517
class Header extends \Magento\Framework\View\Element\Template
1618
{
19+
/**
20+
* @var Escaper
21+
*/
22+
protected $escaper;
23+
24+
/**
25+
* Constructor
26+
*
27+
* @param \Magento\Framework\View\Element\Template\Context $context
28+
* @param Magento\Framework\Escaper $escaper
29+
* @param array $data
30+
*/
31+
public function __construct(
32+
\Magento\Framework\View\Element\Template\Context $context,
33+
\Magento\Framework\Escaper $escaper,
34+
array $data = []
35+
) {
36+
$this->_escaper = $escaper;
37+
parent::__construct($context, $data);
38+
}
39+
1740
/**
1841
* Current template name
1942
*
@@ -34,7 +57,7 @@ public function getWelcome()
3457
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
3558
);
3659
}
37-
$this->_data['welcome'] = addslashes($this->_data['welcome']);
60+
$this->_data['welcome'] = $this->_escaper->escapeQuote($this->_data['welcome'], $addSlashes = true);
3861
return __($this->_data['welcome']);
3962
}
4063
}

0 commit comments

Comments
 (0)