diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index f1363e6..db67a22 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -150,21 +150,66 @@ public function rename($name, $new_name) {
   }
 
   /**
-   * Implements Drupal\Core\Config\StorageInterface::encode().
+   * {@inheritdoc}
    */
   public function encode($data) {
-    return serialize($data);
+    return $this->encodeXml(new \SimpleXMLElement('<e type="array"></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;
+    return $this->decodeXml(new \SimpleXMLElement($raw));
+  }
+
+  /**
+   * Decodes the XML produced by encodeXml.
+   *
+   * @param \SimpleXMLElement $simplexml
+   *   This contains the XML.
+   */
+  protected function decodeXml(\SimpleXMLElement $simplexml) {
+    $value = (string) $simplexml['value'];
+    switch ((string) $simplexml['type']) {
+      case 'integer': return (int) $value;
+      case 'boolean': return (bool) $value;
+      case 'float'  : return (double) $value;
+      case 'array':
+        $value = array();
+        foreach ($simplexml as $element) {
+          $value[(string) $element['key']] = $this->decodeXml($element);;
+        }
+        break;
+    }
+    return $value;
   }
 
   /**
