diff --git a/docs/simplesamlphp-sp.md b/docs/simplesamlphp-sp.md
index 7fc47ee94129d3cf845d9b1a93eb356b7bf6a8e8..f212db95d807b691c20054ef1bfc56c7524f1d28 100644
--- a/docs/simplesamlphp-sp.md
+++ b/docs/simplesamlphp-sp.md
@@ -197,6 +197,26 @@ your own session after calling SimpleSAMLphp, you can do so by cleaning up the s
 If you don't cleanup SimpleSAMLphp's session and try to use $_SESSION afterwards, you won't be using your own session
 and all your data is likely to get lost or inaccessible.
 
+Note that if your application uses a [custom session handler](https://www.php.net/manual/en/function.session-set-save-handler.php), SimpleSAMLphp will use it as well. This can lead to problems because SimpleSAMLphp's stand-alone web UI uses the default PHP session handlers. Therefore, you may need to unset the custom handler before making any calls to SimpleSAMLphp:
+
+    // use custom save handler
+    session_set_save_handler($handler);
+    session_start();
+    
+    // close session and restore default handler
+    session_write_close();
+    session_set_save_handler(new SessionHandler(), true);
+    
+    // use SimpleSAML\Session
+    $session = \SimpleSAML\Session::getSessionFromRequest();
+    $session->cleanup();
+    session_write_close();
+    
+    // back to custom save handler
+    session_set_save_handler($handler);
+    session_start();
+
+
 
 Support
 -------