From 7f1fa41e3adf497ed373b8057eba6006a4482421 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 18 Feb 2020 10:36:47 +0100 Subject: [PATCH] LdapObject : add __toString() method Fix password recovery bug report by Adrien Malgoyre on Ldapsaisie-devel mailing list. --- .../includes/class/class.LSldapObject.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public_html/includes/class/class.LSldapObject.php b/public_html/includes/class/class.LSldapObject.php index e4bb6d19..b71c709d 100644 --- a/public_html/includes/class/class.LSldapObject.php +++ b/public_html/includes/class/class.LSldapObject.php @@ -1857,6 +1857,22 @@ class LSldapObject { return LSconfig :: get($param, $default, $cast, $this -> config); } + /** + * Allow conversion of LdapObject to string + * + * @retval string The string representation of the LdapObject + */ + public function __toString() { + if ($this -> dn) + return " dn.">"; + $rdn_attr = $this -> getConfig('rdn'); + if( $rdn_attr && isset($this -> attrs[$rdn_attr]) ) { + $rdn_val = $this -> attrs[$rdn_attr] -> getUpdateData(); + if (!empty($rdn_val)) + return ""; + } + return ""; + } } /**