diff --git a/composer.json b/composer.json
index ca8d9831fe7a72e5783d477c04971077f67ab926..a58a21ff87dc5328d5b8f9e7722a74719a5c329d 100644
--- a/composer.json
+++ b/composer.json
@@ -19,11 +19,6 @@
             "email": "jaime.perez@uninett.no"
         }
     ],
-    "config": {
-        "platform": {
-            "php": "7.1.33"
-        }
-    },
     "autoload": {
         "psr-4": {
             "SimpleSAML\\": "lib/SimpleSAML"
@@ -80,16 +75,17 @@
         "simplesamlphp/simplesamlphp-module-statistics": "^0.9",
         "simplesamlphp/simplesamlphp-module-sqlauth": "^0.9",
         "simplesamlphp/twig-configurable-i18n": "~2.3.3",
-        "symfony/cache": "^4.4 || ^5.0",
-        "symfony/config": "^4.4 || ^5.0",
-        "symfony/console": "^4.4 || ^5.0",
-        "symfony/dependency-injection": "^4.4 || ^5.0",
-        "symfony/finder": "^4.4 || ^5.0",
-        "symfony/framework-bundle": "^4.4 || ^5.0",
-        "symfony/http-foundation": "^4.4 || ^5.0",
-        "symfony/http-kernel": "^4.4 || ^5.0",
-        "symfony/routing": "^4.4 || ^5.0",
-        "symfony/yaml": "^4.4 || ^5.0",
+        "symfony/cache": "^4.4",
+        "symfony/config": "^4.4",
+        "symfony/console": "^4.4",
+        "symfony/dependency-injection": "^4.4",
+        "symfony/finder": "^4.4",
+        "symfony/framework-bundle": "^4.4",
+        "symfony/http-foundation": "^4.4",
+        "symfony/http-kernel": "^4.4",
+        "symfony/routing": "^4.4",
+        "symfony/var-exporter": "^4.4",
+        "symfony/yaml": "^4.4",
         "twig/twig": "^1.43 || ^2.0"
     },
     "require-dev": {
diff --git a/composer.lock b/composer.lock
index cef6bdfbe150f24a6e55d7e8a5c0177b4740701f..972817d4ca53020c9de708f8957f6eca51b0c3ff 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "a42dc519d55b47fe6c8bedf72fb06364",
+    "content-hash": "f5bf19931f73cc09d7a4ce127b75b30e",
     "packages": [
         {
             "name": "gettext/gettext",
diff --git a/modules/admin/lib/Controller/Federation.php b/modules/admin/lib/Controller/Federation.php
index ec15f83799b744c9b8b10ac8e45ebbcbe212cd35..20f3247d205f2bf800e03ee621b02292d1571982 100644
--- a/modules/admin/lib/Controller/Federation.php
+++ b/modules/admin/lib/Controller/Federation.php
@@ -22,6 +22,7 @@ use SimpleSAML\XHTML\Template;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpFoundation\ResponseHeaderBag;
+use Symfony\Component\VarExporter\VarExporter;
 
 /**
  * Controller class for the admin module.
@@ -315,7 +316,7 @@ class Federation
                 unset($entity['metadata_array']['keys']);
             }
 
-            $entities[$index]['metadata_array'] = var_export($entity['metadata_array'], true);
+            $entities[$index]['metadata_array'] = VarExporter::export($entity['metadata_array']);
         }
 
         return $entities;
@@ -377,7 +378,7 @@ class Federation
                 'url' => $source->getMetadataURL(),
                 'name' => $name,
                 'metadata' => $xml,
-                'metadata_array' => var_export($metadata, true),
+                'metadata_array' => VarExporter::export($metadata),
                 'certificates' => $certificates,
             ];
         }
@@ -441,7 +442,7 @@ class Federation
                     unset($entityMetadata['expire']);
 
                     $text .= '$metadata[' . var_export($entityId, true) . '] = '
-                        . var_export($entityMetadata, true) . ";\n";
+                        . VarExporter::export($entityMetadata) . ";\n";
                 }
                 $entities = $text;
             }
@@ -523,7 +524,7 @@ class Federation
 
         $t = new Template($this->config, 'admin:show_metadata.twig');
         $t->data['entityid'] = $entityId;
-        $t->data['metadata'] = var_export($metadata, true);
+        $t->data['metadata'] = VarExporter::export($metadata);
         return $t;
     }
 }
diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php
index b13d86fed33df9cadcc69736232f554d5e5b9adb..e90815d15dd9b68eadb7bb660eb81425598acff5 100644
--- a/modules/saml/www/sp/metadata.php
+++ b/modules/saml/www/sp/metadata.php
@@ -1,5 +1,7 @@
 <?php
 
+use Symfony\Component\VarExporter\VarExporter;
+
 if (!array_key_exists('PATH_INFO', $_SERVER)) {
     throw new \SimpleSAML\Error\BadRequest('Missing authentication source id in metadata URL');
 }
@@ -279,7 +281,7 @@ if (array_key_exists('output', $_REQUEST) && $_REQUEST['output'] == 'xhtml') {
     $t->data['headerString'] = \SimpleSAML\Locale\Translate::noop('metadata_saml20-sp');
     $t->data['metadata'] = htmlspecialchars($xml);
     $t->data['metadataflat'] = '$metadata[' . var_export($entityId, true)
-        . '] = ' . var_export($metaArray20, true) . ';';
+        . '] = ' . VarExporter::export($metaArray20) . ';';
     $t->data['metaurl'] = $source->getMetadataURL();
     $t->show();
 } else {
diff --git a/www/admin/metadata-converter.php b/www/admin/metadata-converter.php
index 83837409de1e921376f45cc036fa3a9d68adab9c..94e38fec3e4f6d93e64a95549d78e8e163999e8c 100644
--- a/www/admin/metadata-converter.php
+++ b/www/admin/metadata-converter.php
@@ -2,6 +2,8 @@
 
 require_once('../_include.php');
 
+use Symfony\Component\VarExporter\VarExporter;
+
 // make sure that the user has admin access rights
 \SimpleSAML\Utils\Auth::requireAdmin();
 
@@ -42,7 +44,7 @@ if (!empty($xmldata)) {
             unset($entityMetadata['entityDescriptor']);
 
             $text .= '$metadata[' . var_export($entityId, true) . '] = ' .
-                var_export($entityMetadata, true) . ";\n";
+                VarExporter::export($entityMetadata) . ";\n";
         }
         $entities = $text;
     }
diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index 698cb9f4a308397905fe66165d02f9aeb9f3ea6c..2f820ea8166033a48a1573a9b70b78a8fea8c530 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -2,6 +2,8 @@
 
 require_once('../../_include.php');
 
+use Symfony\Component\VarExporter\VarExporter;
+
 use SAML2\Constants;
 use SimpleSAML\Module;
 use SimpleSAML\Utils\Auth as Auth;
@@ -209,7 +211,7 @@ try {
 
     $metaxml = $metaBuilder->getEntityDescriptorText();
 
-    $metaflat = '$metadata[' . var_export($idpentityid, true) . '] = ' . var_export($metaArray, true) . ';';
+    $metaflat = '$metadata[' . var_export($idpentityid, true) . '] = ' . VarExporter::export($metaArray) . ';';
 
     // sign the metadata if enabled
     $metaxml = \SimpleSAML\Metadata\Signer::sign($metaxml, $idpmeta->toArray(), 'SAML 2 IdP');