diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index f1363e6..6570b4f 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -150,21 +150,83 @@ public function rename($name, $new_name) {
   }
 
   /**
-   * Implements Drupal\Core\Config\StorageInterface::encode().
+   * {@inheritdoc}
    */
   public function encode($data) {
-    return serialize($data);
+    if ($data) {
+      $xml = new \SimpleXMLElement('<config></config>');
+      $this->encodeXml($xml, $data);
+      return $xml->e[0]->asXml();
+    }
+    else {
+      return '';
+    }
   }
 
   /**
-   * 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 = '') {
+    $new_simplexml = $simplexml->addChild('e');
+    $new_simplexml->addAttribute('type', gettype($value));
+    if ($key) {
+      $new_simplexml->addAttribute('key', $key);
+    }
+    if (is_array($value)) {
+      foreach ($value as $new_key => $new_value) {
+        $this->encodeXml($new_simplexml, $new_value, $new_key);
+      }
+    }
+    else {
+      $new_simplexml->addAttribute('value', (string)$value);
+    }
+  }
+
+  /**
+   * {@inheritdoc}
    */
   public function decode($raw) {
-    $data = @unserialize($raw);
-    return is_array($data) ? $data : FALSE;
+    $data = array();
+    if ($raw) {
+      $this->decodeXml($data, new \SimpleXMLElement($raw), TRUE);
+      return $data;
+    }
+    return $data;
+  }
+
+  /**
+   * Decodes the XML produced by encodeXml.
+   *
+   * @param array $a
+   *   This array contains the decoded data.
+   * @param \SimpleXMLElement $simplexml
+   *   This contains the XML.
+   * @param bool $top
+   *   TRUE for the top element.
+   */
+  protected function decodeXml(array &$a, \SimpleXMLElement $simplexml, $top = FALSE) {
+    if (!$top) {
+      $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;
+    }
   }
 
   /**
