Skip to content

Commit 41a4cf6

Browse files
committed
#9236: update json controller to stop using Zend1
1 parent 2ad32d9 commit 41a4cf6

File tree

1 file changed

+12
-3
lines changed
  • lib/internal/Magento/Framework/Controller/Result

1 file changed

+12
-3
lines changed

lib/internal/Magento/Framework/Controller/Result/Json.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,21 @@ class Json extends AbstractResult
2828
*/
2929
protected $json;
3030

31+
/**
32+
* @var \Magento\Framework\Serialize\Serializer\Json
33+
*/
34+
private $serializer;
35+
3136
/**
3237
* @param \Magento\Framework\Translate\InlineInterface $translateInline
3338
*/
34-
public function __construct(InlineInterface $translateInline)
35-
{
39+
public function __construct(
40+
InlineInterface $translateInline,
41+
\Magento\Framework\Serialize\Serializer\Json $serializer = null
42+
) {
3643
$this->translateInline = $translateInline;
44+
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
45+
->get(\Magento\Framework\Serialize\Serializer\Json::class);
3746
}
3847

3948
/**
@@ -46,7 +55,7 @@ public function __construct(InlineInterface $translateInline)
4655
*/
4756
public function setData($data, $cycleCheck = false, $options = [])
4857
{
49-
$this->json = \Zend_Json::encode($data, $cycleCheck, $options);
58+
$this->json = $this->serializer->serialize($data);
5059
return $this;
5160
}
5261

0 commit comments

Comments
 (0)