--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -1557,6 +1557,14 @@
         return ($result);
     }
 
+    function __serialize(): array
+    {
+        // Quick bug fix, where $this->re contains unserializable data.
+        // Actual fix would be to delete it beforehand (for example in clearResult()).
+        $this->re = [];
+        return (array)$this;
+    }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
