diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index f1363e6..fe99225 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -150,21 +150,74 @@ public function rename($name, $new_name) {
   }
 
   /**
-   * Implements Drupal\Core\Config\StorageInterface::encode().
+   * {@inheritdoc}
    */
   public function encode($data) {
-    return serialize($data);
+    return $data ? $this->encodeXml(new \SimpleXMLElement('<e></e>'), $data)->asXML() : '';
   }
 
   /**
-   * Implements Drupal\Core\Config\StorageInterface::decode().
+   * Recursively encodes a value as XML.
    *
-   * @throws ErrorException
-   *   unserialize() triggers E_NOTICE if the string cannot be unserialized.
+   * @param \SimpleXMLElement $simplexml
+   *   The simplexml element to add the encoding too.
+   * @param mixed $value
+   *   The value to be encoded.
+   * @param string $key
+   *   The key in the parent array.
+   */
+  protected function encodeXml(\SimpleXMLElement $simplexml, $value, $key = '') {
+    if ($key) {
+      $simplexml = $simplexml->addChild('e');
+      $simplexml->addAttribute('type', gettype($value));
+      $simplexml->addAttribute('key', $key);
+    }
+    if (is_array($value)) {
+      foreach ($value as $new_key => $new_value) {
+        $this->encodeXml($simplexml, $new_value, $new_key);
+      }
+    }
+    else {
+      $simplexml->addAttribute('value', (string) $value);
+    }
+    return $simplexml;
+  }
+
+  /**
+   * {@inheritdoc}
    */
   public function decode($raw) {
-    $data = @unserialize($raw);
-    return is_array($data) ? $data : FALSE;
+    $data = array();
+    if ($raw) {
+      foreach (new \SimpleXMLElement($raw) as $e) {
+        $this->decodeXml($data, $e);
+      }
+    }
+    return $data;
+  }
+
+  /**
+   * Decodes the XML produced by encodeXml.
+   *
+   * @param array $a
+   *   This array contains the decoded data.
+   * @param \SimpleXMLElement $simplexml
+   *   This contains the XML.
+   */
+  protected function decodeXml(array &$a, \SimpleXMLElement $simplexml) {
+    $a = &$a[(string) $simplexml['key']];
+    switch ((string) $simplexml['type']) {
+      case 'boolean': $a = (bool) (string) $simplexml['value']; break;
+      case 'integer': $a = (int) (string) $simplexml['value']; break;
+      case 'string': $a = (string) $simplexml['value']; break;
+      case 'float': $a = (double) (string) $simplexml['value']; break;
+      case 'array':
+        $a = array();
+        foreach ($simplexml as $element) {
+          $this->decodeXml($a, $element);
+        }
+        break;
+    }
   }
 
   /**
