diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php
index 544728fd2c6eea03de6d4385e7b6a00247c05e10..4370473b6631897a00fdd0f2ccc01c7f06935b64 100644
--- a/lib/SimpleSAML/Configuration.php
+++ b/lib/SimpleSAML/Configuration.php
@@ -120,7 +120,17 @@ class SimpleSAML_Configuration
 
             // the file initializes a variable named '$config'
             ob_start();
-            require($filename);
+            if (interface_exists('Throwable')) {
+                try {
+                    require($filename);
+                } catch (ParseError $e) {
+                    self::$loadedConfigs[$filename] = self::loadFromArray(array(), '[ARRAY]', 'simplesaml');
+                    throw new SimpleSAML\Error\ConfigurationError($e->getMessage(), $filename, array());
+                }
+            } else {
+                require($filename);
+            }
+
             $spurious_output = ob_get_length() > 0;
             ob_end_clean();