Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Unserialize.php
Go to the documentation of this file.
1 <?php
8 
11 
16 {
22  private $serializer;
23 
27  public function __construct(Serialize $serializer = null)
28  {
29  $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Serialize::class);
30  }
31 
36  public function unserialize($string)
37  {
38  if (preg_match('/[oc]:[+\-]?\d+:"/i', $string)) {
39  trigger_error('String contains serialized object');
40  return false;
41  }
42  return $this->serializer->unserialize($string);
43  }
44 }
__construct(Serialize $serializer=null)
Definition: Unserialize.php:27