Skip to content

Commit d33a8be

Browse files
author
silinmykola
committed
fix after a CR
1 parent 19f70ff commit d33a8be

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public function testSetPublicHeadersWithoutTtl(): void
245245
{
246246
$this->expectException('InvalidArgumentException');
247247
$this->expectExceptionMessage('Time to live is a mandatory parameter for set public headers');
248-
$this->model->setPublicHeaders('');
248+
$this->model->setPublicHeaders(null);
249249
}
250250

251251
/**

lib/internal/Magento/Framework/ObjectManager/Config/Config.php

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
*/
66
namespace Magento\Framework\ObjectManager\Config;
77

8+
use Magento\Framework\Serialize\SerializerInterface;
89
use Magento\Framework\ObjectManager\ConfigCacheInterface;
910
use Magento\Framework\ObjectManager\DefinitionInterface;
1011
use Magento\Framework\ObjectManager\RelationsInterface;
11-
use Magento\Framework\Serialize\SerializerInterface;
1212

13-
/**
14-
* The object manager config
15-
*/
1613
class Config implements \Magento\Framework\ObjectManager\ConfigInterface
1714
{
1815
/**
@@ -30,7 +27,7 @@ class Config implements \Magento\Framework\ObjectManager\ConfigInterface
3027
protected $_definitions;
3128

3229
/**
33-
* The current cache key
30+
* Current cache key
3431
*
3532
* @var string
3633
*/
@@ -44,7 +41,7 @@ class Config implements \Magento\Framework\ObjectManager\ConfigInterface
4441
protected $_preferences = [];
4542

4643
/**
47-
* The list of virtual types
44+
* Virtual types
4845
*
4946
* @var array
5047
*/
@@ -79,23 +76,18 @@ class Config implements \Magento\Framework\ObjectManager\ConfigInterface
7976
protected $_mergedArguments;
8077

8178
/**
82-
* @var SerializerInterface
79+
* @var \Magento\Framework\Serialize\SerializerInterface
8380
*/
8481
private $serializer;
8582

8683
/**
87-
* @param RelationsInterface|null $relations
88-
* @param DefinitionInterface|null $definitions
89-
* @param SerializerInterface|null $serializer
84+
* @param RelationsInterface $relations
85+
* @param DefinitionInterface $definitions
9086
*/
91-
public function __construct(
92-
RelationsInterface $relations = null,
93-
DefinitionInterface $definitions = null,
94-
SerializerInterface $serializer = null
95-
) {
87+
public function __construct(RelationsInterface $relations = null, DefinitionInterface $definitions = null)
88+
{
9689
$this->_relations = $relations ?: new \Magento\Framework\ObjectManager\Relations\Runtime();
9790
$this->_definitions = $definitions ?: new \Magento\Framework\ObjectManager\Definition\Runtime();
98-
$this->serializer = $serializer ?: new \Magento\Framework\Serialize\Serializer\Json();
9991
}
10092

10193
/**
@@ -283,14 +275,14 @@ public function extend(array $configuration)
283275
// md5() here is not for cryptographic use.
284276
// phpcs:ignore Magento2.Security.InsecureFunction
285277
$this->_currentCacheKey = md5(
286-
$this->serializer->serialize(
278+
$this->getSerializer()->serialize(
287279
[$this->_arguments, $this->_nonShared, $this->_preferences, $this->_virtualTypes]
288280
)
289281
);
290282
}
291283
// md5() here is not for cryptographic use.
292284
// phpcs:ignore Magento2.Security.InsecureFunction
293-
$key = md5($this->_currentCacheKey . $this->serializer->serialize($configuration));
285+
$key = md5($this->_currentCacheKey . $this->getSerializer()->serialize($configuration));
294286
$cached = $this->_cache->get($key);
295287
if ($cached) {
296288
list(
@@ -343,4 +335,19 @@ public function getPreferences()
343335
{
344336
return $this->_preferences;
345337
}
338+
339+
/**
340+
* Get serializer
341+
*
342+
* @return \Magento\Framework\Serialize\SerializerInterface
343+
* @deprecated 101.0.0
344+
*/
345+
private function getSerializer()
346+
{
347+
if ($this->serializer === null) {
348+
$this->serializer = \Magento\Framework\App\ObjectManager::getInstance()
349+
->get(SerializerInterface::class);
350+
}
351+
return $this->serializer;
352+
}
346353
}

0 commit comments

Comments
 (0)