diff --git a/modules/saml/lib/IdP/SAML1.php b/modules/saml/lib/IdP/SAML1.php
index be68b66e778fd2700477f79eaaef750fd2a43867..ecac85d133c13af95da4acff0dcef55ba56897f2 100644
--- a/modules/saml/lib/IdP/SAML1.php
+++ b/modules/saml/lib/IdP/SAML1.php
@@ -36,11 +36,12 @@ class sspmod_saml_IdP_SAML1 {
 		$config = SimpleSAML_Configuration::getInstance();
 		$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
 
-		SimpleSAML_Stats::log('saml:idp:Response', array(
+		$statsData = array(
 			'spEntityID' => $spEntityId,
 			'idpEntityID' => $idpMetadata->getString('entityid'),
 			'protocol' => 'saml1',
-		));
+		);
+		SimpleSAML_Stats::log('saml:idp:Response', $statsData);
 
 		/* Generate and send response. */
 		$ar = new SimpleSAML_XML_Shib13_AuthnResponse();
diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php
index ffaf2ded2666a45c0d55750bcb116047978fb937..527a640789dc436e2f36c78c4787694d8d6c1546 100644
--- a/modules/saml/lib/IdP/SAML2.php
+++ b/modules/saml/lib/IdP/SAML2.php
@@ -63,11 +63,12 @@ class sspmod_saml_IdP_SAML2 {
 		/* Register the session association with the IdP. */
 		$idp->addAssociation($association);
 
-		SimpleSAML_Stats::log('saml:idp:Response', array(
+		$statsData = array(
 			'spEntityID' => $spEntityId,
 			'idpEntityID' => $idpMetadata->getString('entityid'),
 			'protocol' => 'saml2',
-		));
+		);
+		SimpleSAML_Stats::log('saml:idp:Response', $statsData);
 
 		/* Send the response. */
 		$binding = SAML2_Binding::getBinding($protocolBinding);
@@ -117,12 +118,13 @@ class sspmod_saml_IdP_SAML2 {
 		);
 		$ar->setStatus($status);
 
-		SimpleSAML_Stats::log('saml:idp:Response:error', array(
+		$statsData = array(
 			'spEntityID' => $spEntityId,
 			'idpEntityID' => $idpMetadata->getString('entityid'),
 			'protocol' => 'saml2',
 			'error' => $status,
-		));
+		);
+		SimpleSAML_Stats::log('saml:idp:Response:error', $statsData);
 
 		$binding = SAML2_Binding::getBinding($protocolBinding);
 		$binding->send($ar);