diff --git a/composer.json b/composer.json
index 40519df92009bae46a413f0808cf0828d59be036..88762ea4d5a732116fdb10e8debeefc074373d03 100644
--- a/composer.json
+++ b/composer.json
@@ -49,10 +49,10 @@
         "ext-pcre": "*",
         "ext-SPL": "*",
         "ext-zlib": "*",
-        "gettext/gettext": "^4.6",
+        "gettext/gettext": "v4.x-dev#3e7460f8d9c90174824e3f39240bd578bb3d376a",
         "phpmailer/phpmailer": "^6.5",
         "simplesamlphp/assert": "^0.2.11",
-        "simplesamlphp/saml2": "^4.4",
+        "simplesamlphp/saml2": "^4.5",
         "symfony/cache": "^5.4",
         "symfony/config": "^5.4",
         "symfony/console": "^5.4",
diff --git a/composer.lock b/composer.lock
index ed8facf0ddded61790829558eb4fed45e6c81f68..8bd51e811172c71dac8e261d868e08a2e610590b 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,20 +4,20 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "c2176427956e72c623e660394ffd6404",
+    "content-hash": "499ed983a7e8abed35ed5ab324abc681",
     "packages": [
         {
             "name": "gettext/gettext",
-            "version": "v4.8.6",
+            "version": "4.x-dev",
             "source": {
                 "type": "git",
                 "url": "https://github.com/php-gettext/Gettext.git",
-                "reference": "bbeb8f4d3077663739aecb4551b22e720c0e9efe"
+                "reference": "3e7460f8d9c90174824e3f39240bd578bb3d376a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/bbeb8f4d3077663739aecb4551b22e720c0e9efe",
-                "reference": "bbeb8f4d3077663739aecb4551b22e720c0e9efe",
+                "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/3e7460f8d9c90174824e3f39240bd578bb3d376a",
+                "reference": "3e7460f8d9c90174824e3f39240bd578bb3d376a",
                 "shasum": ""
             },
             "require": {
@@ -69,7 +69,7 @@
             "support": {
                 "email": "oom@oscarotero.com",
                 "issues": "https://github.com/oscarotero/Gettext/issues",
-                "source": "https://github.com/php-gettext/Gettext/tree/v4.8.6"
+                "source": "https://github.com/php-gettext/Gettext/tree/4.x"
             },
             "funding": [
                 {
@@ -85,7 +85,7 @@
                     "type": "patreon"
                 }
             ],
-            "time": "2021-10-19T10:44:53+00:00"
+            "time": "2022-02-17T10:14:02+00:00"
         },
         {
             "name": "gettext/languages",
@@ -6628,6 +6628,7 @@
     "aliases": [],
     "minimum-stability": "stable",
     "stability-flags": {
+        "gettext/gettext": 20,
         "simplesamlphp/simplesamlphp-module-adfs": 5
     },
     "prefer-stable": false,
diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index 55851f9e7b90e758860efc8c5c7a632c7527e60d..401fd6ade6777427523960471778c80236a4603f 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -28,7 +28,7 @@ use SimpleSAML\Utils;
  * @package SimpleSAMLphp
  */
 
-class Session implements Serializable, Utils\ClearableState
+class Session implements Utils\ClearableState
 {
     /**
      * This is a timeout value for setData, which indicates that the data
@@ -200,15 +200,15 @@ class Session implements Serializable, Utils\ClearableState
 
 
     /**
-     * Serialize this session object.
+     * Serialize this Session.
      *
      * This method will be invoked by any calls to serialize().
      *
-     * @return string The serialized representation of this session object.
+     * @return array The serialized representation of this Session.
      */
-    public function serialize(): string
+    public function __serialize(): array
     {
-        return serialize(get_object_vars($this));
+        return get_object_vars($this);
     }
 
 
@@ -218,17 +218,12 @@ class Session implements Serializable, Utils\ClearableState
      * This method will be invoked by any calls to unserialize(), allowing us to restore any data that might not
      * be serializable in its original form (e.g.: DOM objects).
      *
-     * @param string $serialized The serialized representation of a session that we want to restore.
-     *
-     * Cannot typehint param as string due to upstream restrictions
+     * @param array $serialized The serialized representation of a session that we want to restore.
      */
-    public function unserialize($serialized): void
+    public function __unserialize($serialized): void
     {
-        $session = unserialize($serialized);
-        if (is_array($session)) {
-            foreach ($session as $k => $v) {
-                $this->$k = $v;
-            }
+        foreach ($serialized as $k => $v) {
+            $this->$k = $v;
         }
         self::$config = Configuration::getInstance();