From 74ae1d63bdde4e94ad3698b49f01b76744b220ef Mon Sep 17 00:00:00 2001 From: Thibault Dockx <thibault.dockx@fusiondirectory.org> Date: Tue, 25 Feb 2025 15:21:39 +0000 Subject: [PATCH] :sparkles: (Personal) - adapts to php 8.2 Personal classes adapted to php8.2 --- plugins/personal/generic/class_UserPasswordAttribute.inc | 4 ++-- plugins/personal/generic/class_user.inc | 8 ++++---- plugins/personal/roles/class_userRoles.inc | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/personal/generic/class_UserPasswordAttribute.inc b/plugins/personal/generic/class_UserPasswordAttribute.inc index 819218efc..5497a0597 100755 --- a/plugins/personal/generic/class_UserPasswordAttribute.inc +++ b/plugins/personal/generic/class_UserPasswordAttribute.inc @@ -192,10 +192,10 @@ class UserPasswordAttribute extends CompositeAttribute if ($value == '%askme%') { return ['%askme%', '', '', $value, 'FALSE']; } - $parts = explode('|', $value, 3); + $parts = explode('|', (string) $value, 3); if ((count($parts) < 3) || !in_array($parts[1], ['TRUE','FALSE'])) { /* Old format from FD<1.4 */ - list($value, $password) = explode('|', $value, 2); + list($value, $password) = explode('|', (string) $value, 2); } else { list($pw_storage, $locked, $password) = $parts; return [$pw_storage, $password, $password, $this->attributes[3]->getValue(), $locked]; diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 68cd52544..ec2059d81 100755 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -405,7 +405,7 @@ class user extends simplePlugin // Get the hash of current data before modifications. global $config; $ldap = $config->get_ldap_link(); - $currentSnapHash = md5($ldap->generateLdif($this->dn, '(!(objectClass=gosaDepartment))', 'sub')); + $currentSnapHash = md5((string) $ldap->generateLdif($this->dn, '(!(objectClass=gosaDepartment))', 'sub')); // Verify if current snap hash already exist in the list of existing snapshots - not taking a snap if it exists. $snapshotHandler = new SnapshotHandler(); @@ -513,7 +513,7 @@ class user extends simplePlugin if (isset($attrs['pwdHistory'][0])) { unset($attrs['pwdHistory']['count']); foreach ($attrs['pwdHistory'] as $pwdHistory) { - $pwdHistory = explode('#', $pwdHistory, 4); + $pwdHistory = explode('#', (string) $pwdHistory, 4); $method = passwordMethod::get_method($pwdHistory[3], $user); if (($method !== NULL) && $method->checkPassword($new_password, $pwdHistory[3])) { return _('Password is in history of old passwords'); @@ -537,9 +537,9 @@ class user extends simplePlugin return _('The passwords you\'ve entered as "New password" and "Repeated new password" do not match.'); } elseif ($new_password == '') { return msgPool::required(_('New password')); - } elseif ($check_differ && (mb_substr($current_password, 0, $differ) == mb_substr($new_password, 0, $differ))) { + } elseif ($check_differ && (mb_substr((string) $current_password, 0, $differ) == mb_substr((string) $new_password, 0, $differ))) { return _('The password used as new and current are too similar.'); - } elseif ($check_length && (mb_strlen($new_password) < $length)) { + } elseif ($check_length && (mb_strlen((string) $new_password) < $length)) { return _('The password used as new is too short.'); } elseif (!passwordMethod::is_harmless($new_password)) { return _('The password contains possibly problematic Unicode characters!'); diff --git a/plugins/personal/roles/class_userRoles.inc b/plugins/personal/roles/class_userRoles.inc index 60a004e0e..be542e137 100755 --- a/plugins/personal/roles/class_userRoles.inc +++ b/plugins/personal/roles/class_userRoles.inc @@ -214,7 +214,7 @@ class userRoles extends simplePlugin $warning->display(); } } - } catch (NonExistingLdapNodeException $e) { + } catch (NonExistingLdapNodeException) { /* Ignore deleted groups */ } } @@ -241,7 +241,7 @@ class userRoles extends simplePlugin $warning->display(); } } - } catch (NonExistingLdapNodeException $e) { + } catch (NonExistingLdapNodeException) { /* Ignore deleted roles */ } } -- GitLab