Convert a php serialized string to an array.

{@inheritDoc}
344055
public static function decode($string)
    {
        if (!$string) {
            return new ArrayObject();
        }

        try {
            $array = unserialize($string);
        } catch (\Exception $e) {
            throw new PhpException("Serialize Error: " . $e->getMessage());
        }

        if (!is_array($array)) {
            $array = [];
        }

        return ArrayObject::make($array);
    }
197165
public function unserialize($serialized): void
    {
        $this->definitionMap = unserialize($serialized)
            ->mapWithKeys(function (array $node, string $key): array {
                return [$key => AST::fromArray($node)];
            });
    }
248933
function jsonSerialize()
    {
        $result = [
            'force_reply' => $this->forceReply
        ];

        if ($this->selective !== null) {
            $result['selective'] = $this->selective;
        }

        return $result;
    }
1045891
public function unserialize($serialized = null)
    {
        if (is_null($serialized)) {
            return unserialize($this->serialize);
        }

        return unserialize($serialized);
    }
217533
public static function toArray($value)
    {
        # If it's already an array then just pass it back
        if (is_array($value)) {
            return $value;
        }

        if ($value instanceof SerialObject) {
            return $value->asArray();
        }

        if ($value instanceof \ArrayObject) {
            return $value->getArrayCopy();
        }

        # If it's not an array then create a new array to be returned
        $array = [];

        # If a value was passed as a string/int then include it in the new array
        if ($value) {
            $array[] = $value;
        }

        return $array;
    }
823074
public function unserialize($value)
    {
        $array = (array) \simplexml_load_string($value);
        self::castToArray($array);
        self::recoverArrayNumericKeyValues($array);
        $replacements = \array_flip($this->replacements);
        $array = self::replaceKeys($replacements, $array);

        return $array;
    }
778883
protected static function unserialize($string)
    {
        if (is_array($string)) {
            return $string;
        }

        if (($data = unserialize($string)) !== false) {
            return $data;
        }

        return unserialize(stripslashes($string));
    }
710141
function serialize(array $data) {
        $preSerialized = array();
        $serialized = '';

        if (count($data)) {
            foreach ($data as $bucket => $bucketData) {
                $preSerialized[] = $bucket . '|' . serialize($bucketData);
            }
            $serialized = implode('', $preSerialized);
        }

        return $serialized;
    }
675357
public function toArray($plain = false)
    {
        $result = array();

        foreach ($this as $key => $value) {
            if ($plain) {
                $result[] = $value->toArray();
            } else {
                $result[] = $this->connection->unmarshall($value);
            }
        }

        return $result;
    }
660288
public static function toArray(string $string, string $delimiter = ','): array
    {
        $arrayTemp = explode($delimiter, $string);
        $array = [];
        foreach ($arrayTemp as $item) {
            $itemClear = trim($item);
            if ($itemClear) {
                $array[] = $itemClear;
            }
        }

        return $array;
    }
1201301
private function recursiveDeserialize($serializedObject)
    {
        if (!is_array($serializedObject)) {
            return $serializedObject;
        } elseif ($this->dataFormatter->isSerializedObject($serializedObject)) {
            return $this->deserializeObject($serializedObject);
        } else {
            $deserializedArray = [];
            foreach ($serializedObject as $key => $value) {
                $deserializedArray[$key] = $this->recursiveDeserialize($value);
            }

            return $deserializedArray;
        }
    }
1363766
protected function serialize($value)
    {
        if (!is_array($value)) {
            return $value;
        }
        return Serialize::serialize($value, $this->serializer);
    }
707172
protected static function _parse($string) {
		if (substr_count($string, '::') !== 2) {
			throw new Exception('Possible data tampering: form signature string has wrong format.');
		}
		list($locked, $excluded) = explode('::', $string, 3);

		return [
			'locked' => unserialize(urldecode($locked)),
			'excluded' => unserialize(urldecode($excluded))
		];
	}
523968
public function toArray($paramns): array
    {
        if (is_string($paramns)) {
            return $this->jsonDecode($paramns, true);
        }

        return $this->jsonDecode($this->jsonEncode($paramns), true);
    }
235889
public function unserialize($serialized) // [\SplDoublyLinkedList]
	{
		try
		{
			if(null === $this->last)
			{
				$this->first = unserialize($serialized);
			}
			else
			{
				$this->last->next = unserialize($serialized);
			}
		}
		catch(\Exception $e)
		{
			$error = $e->getMessage();
			
			throw new UnserializeException(substr($error, strpos($error, ': ') + 2));
		}
		
		$n    = 0;
		$iter = $this->first;
		$last = null;
		
		while(null !== $iter)
		{
			$last = $iter;
			$iter = $iter->next;
			++$n;
		}
		
		$this->last = $last;
		$this->size = $n;
	}
440055
public function decodeArray($string, $fieldName = 'Unknown', $assoc = false)
    {
        if (empty($string)) {
            return [];
        }
        $array = self::decode(!empty($string) ? $string : '[]', $fieldName, $assoc);
        if (!$array || !is_array($array)) {
            throw new \Exception('The field '.$fieldName.' is not a JSON array as expected.');
        }

        return $array;
    }
454207
public function unserialize($raw) {
        $returnData = array();
        $offset     = 0;

        while ($offset < strlen($raw)) {
            $num     = ord($raw[$offset]);
            $offset += 1;
            $varname = substr($raw, $offset, $num);
            $offset += $num;
            $data    = unserialize(substr($raw, $offset));

            $returnData[$varname] = $data;
            $offset += strlen(serialize($data));
        }

        return $returnData;
    }