public static function sanitizeAttributeArray(array $attributes) { foreach ($attributes as $name => $values) { if (in_array(strtolower($name), self::MASK_ATTRIBUTES)) { $attributes[$name] = self::MASK_PASSWORD; } else { $replaced = false; $newValues = is_array($values) ? $values : [$values]; foreach ($newValues as $i => $v) { if (is_string($v) && self::isBinary($v)) { $newValues[$i] = LdapUtilities::MASK_BINARY; $replaced = true; } } if ($replaced) { $attributes[$name] = is_array($values) ? $newValues : reset($newValues); } } } return $attributes; }
/** * {@inheritdoc} */ public function getLogArray() { return $this->mergeLogDefaults(['DN' => $this->properties['dn'], 'Attributes' => print_r(LdapUtilities::sanitizeAttributeArray($this->properties['attributes']), true)]); }