From 7e26a2975d8adebeee7b024b6850cd924b8b6687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 13 Jan 2026 11:46:57 +0100 Subject: [PATCH] fix: Use strict array comparisons in user_ldap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise there are issues with string values looking like numbers. Signed-off-by: Côme Chilliet --- apps/user_ldap/lib/Mapping/AbstractMapping.php | 4 ++-- apps/user_ldap/tests/User/DeletedUsersIndexTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index fa10312a915..8568425015b 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -113,7 +113,7 @@ abstract class AbstractMapping { * @return string|false */ public function getDNByName($name) { - $dn = array_search($name, $this->cache); + $dn = array_search($name, $this->cache, true); if ($dn === false && ($dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name)) !== false) { $this->cache[$dn] = $name; } @@ -370,7 +370,7 @@ abstract class AbstractMapping { DELETE FROM `' . $this->getTableName() . '` WHERE `owncloud_name` = ?'); - $dn = array_search($name, $this->cache); + $dn = array_search($name, $this->cache, true); if ($dn !== false) { unset($this->cache[$dn]); } diff --git a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php index 0e77f5023d5..a4324edd322 100644 --- a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php +++ b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php @@ -75,7 +75,7 @@ class DeletedUsersIndexTest extends \Test\TestCase { // ensure the different uids were used foreach ($deletedUsers as $deletedUser) { $this->assertTrue(in_array($deletedUser->getOCName(), $uids)); - $i = array_search($deletedUser->getOCName(), $uids); + $i = array_search($deletedUser->getOCName(), $uids, true); $this->assertNotFalse($i); unset($uids[$i]); }