Skip to content

Commit 16a7c94

Browse files
author
Andrey Konosov
committed
MAGETWO-58265: [Github][Cloud][Customer]Fix Varnish X-Header
- Added backward compatible workaround in observers
1 parent e7088a6 commit 16a7c94

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

app/code/Magento/CacheInvalidate/Observer/InvalidateVarnishObserver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ public function __construct(
5151
*/
5252
public function execute(\Magento\Framework\Event\Observer $observer)
5353
{
54+
$object = $observer->getEvent()->getObject();
55+
if (!is_object($object)) {
56+
return;
57+
}
5458
if ($this->config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->config->isEnabled()) {
55-
$object = $observer->getEvent()->getObject();
5659
$bareTags = $this->tagResolver->getTags($object);
5760

5861
$tags = [];

app/code/Magento/PageCache/Observer/FlushCacheByTags.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ public function __construct(\Magento\PageCache\Model\Config $config, \Magento\Fr
4949
*/
5050
public function execute(\Magento\Framework\Event\Observer $observer)
5151
{
52+
$object = $observer->getEvent()->getObject();
53+
if (!is_object($object)) {
54+
return;
55+
}
56+
5257
if ($this->_config->getType() == \Magento\PageCache\Model\Config::BUILT_IN && $this->_config->isEnabled()) {
53-
$object = $observer->getEvent()->getObject();
5458
$tags = $this->getTagResolver()->getTags($object);
5559

5660
if (!empty($tags)) {
@@ -62,6 +66,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
6266
/**
6367
* TODO: Workaround to support backwards compatibility, will rework to use Dependency Injection in MAGETWO-49547
6468
*
69+
*
6570
* @return \Magento\PageCache\Model\Cache\Type
6671
*/
6772
private function getCache()

0 commit comments

Comments
 (0)