diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index b883673e58253..7baf1742d61bb 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -123,7 +123,7 @@ private function getTagsAndFav($fileId) { $isFav = false; $tags = $this->getTags($fileId); if ($tags) { - $favPos = array_search(self::TAG_FAVORITE, $tags); + $favPos = array_search(self::TAG_FAVORITE, $tags, true); if ($favPos !== false) { $isFav = true; unset($tags[$favPos]); diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index afa9f076e1a53..217f447d91625 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -242,11 +242,11 @@ private function getLanguageMap(IUser $user): array { $languages = $this->l10nFactory->getLanguages(); // associate the user language with the proper array - $userLangIndex = array_search($userConfLang, array_column($languages['commonLanguages'], 'code')); + $userLangIndex = array_search($userConfLang, array_column($languages['commonLanguages'], 'code'), true); $userLang = $languages['commonLanguages'][$userLangIndex]; // search in the other languages if ($userLangIndex === false) { - $userLangIndex = array_search($userConfLang, array_column($languages['otherLanguages'], 'code')); + $userLangIndex = array_search($userConfLang, array_column($languages['otherLanguages'], 'code'), true); $userLang = $languages['otherLanguages'][$userLangIndex]; } // if user language is not available but set somehow: show the actual code as name diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php index f9035902bb342..0fb318d57b6f9 100644 --- a/apps/user_ldap/lib/Helper.php +++ b/apps/user_ldap/lib/Helper.php @@ -141,7 +141,7 @@ private function getServersConfig(string $value): array { */ public function deleteServerConfiguration($prefix) { $prefixes = $this->getServerConfigurationPrefixes(); - $index = array_search($prefix, $prefixes); + $index = array_search($prefix, $prefixes, true); if ($index === false) { return false; } diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index fdcc15535ead8..2c0680c567dca 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -447,7 +447,7 @@ public function unmap($name) { 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 b245e52fe6e23..45e162a190288 100644 --- a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php +++ b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php @@ -71,7 +71,7 @@ public function testMarkAndFetchUser(): void { // 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]); } diff --git a/apps/user_status/lib/Listener/UserLiveStatusListener.php b/apps/user_status/lib/Listener/UserLiveStatusListener.php index 2db999d3712c3..cd26bd0397639 100644 --- a/apps/user_status/lib/Listener/UserLiveStatusListener.php +++ b/apps/user_status/lib/Listener/UserLiveStatusListener.php @@ -82,7 +82,7 @@ public function handle(Event $event): void { // If the emitted status is more important than the current status // treat it as outdated and update - if (array_search($event->getStatus(), StatusService::PRIORITY_ORDERED_STATUSES) < array_search($userStatus->getStatus(), StatusService::PRIORITY_ORDERED_STATUSES)) { + if (array_search($event->getStatus(), StatusService::PRIORITY_ORDERED_STATUSES, true) < array_search($userStatus->getStatus(), StatusService::PRIORITY_ORDERED_STATUSES, true)) { $needsUpdate = true; } diff --git a/build/integration/features/bootstrap/Trashbin.php b/build/integration/features/bootstrap/Trashbin.php index dfcc23289a79b..1517ef3aaed82 100644 --- a/build/integration/features/bootstrap/Trashbin.php +++ b/build/integration/features/bootstrap/Trashbin.php @@ -97,7 +97,7 @@ public function checkTrashContents($user, $folder, $expectedElements) { $elementsSimplified = $this->simplifyArray($elementRows); foreach ($elementsSimplified as $expectedElement) { $expectedElement = ltrim($expectedElement, '/'); - if (array_search($expectedElement, $trashContent) === false) { + if (array_search($expectedElement, $trashContent, true) === false) { Assert::fail("$expectedElement" . ' is not in trash listing'); } } diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 2cb37002ac02c..e433a570a78ab 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -438,7 +438,7 @@ public function theResponseShouldContainAShareTypesPropertyWith($table) { } foreach ($table->getRows() as $row) { - $key = array_search($row[0], $foundTypes); + $key = array_search($row[0], $foundTypes, true); if ($key === false) { throw new \Exception('Expected type ' . $row[0] . ' not found'); } diff --git a/lib/base.php b/lib/base.php index 8ba7a9f77e63f..51a7a58bd1a0f 100644 --- a/lib/base.php +++ b/lib/base.php @@ -935,7 +935,7 @@ private static function registerAppRestrictionsHooks(): void { if (empty($restrictions)) { continue; } - $key = array_search($group->getGID(), $restrictions); + $key = array_search($group->getGID(), $restrictions, true); unset($restrictions[$key]); $restrictions = array_values($restrictions); if (empty($restrictions)) { diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 1189712ba8d17..373a697a327a5 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -354,7 +354,7 @@ protected function sendEmailVerificationEmail(IUser $user, string $email): bool protected function addMissingDefaultValues(array $userData, array $defaultUserData): array { foreach ($defaultUserData as $defaultDataItem) { // If property does not exist, initialize it - $userDataIndex = array_search($defaultDataItem['name'], array_column($userData, 'name')); + $userDataIndex = array_search($defaultDataItem['name'], array_column($userData, 'name'), true); if ($userDataIndex === false) { $userData[] = $defaultDataItem; continue; diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 260f9218a88e2..c46d4c6c8eb89 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -250,7 +250,7 @@ public function file_exists(string $path): bool { return false; } $content = scandir($parentPath, SCANDIR_SORT_NONE); - return is_array($content) && array_search(basename($fullPath), $content) !== false; + return is_array($content) && array_search(basename($fullPath), $content, true) !== false; } else { return file_exists($this->getSourcePath($path)); } diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index fa8cc51f60636..abe392335f5e5 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -654,7 +654,7 @@ public function getLanguages(): array { // put appropriate languages into appropriate arrays, to print them sorted // common languages -> divider -> other languages if (in_array($lang, self::COMMON_LANGUAGE_CODES)) { - $commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)] = $ln; + $commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES, true)] = $ln; } else { $otherLanguages[] = $ln; } diff --git a/lib/private/Tags.php b/lib/private/Tags.php index 309d373934896..81c8e102f1176 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -645,7 +645,8 @@ protected function array_searchi($needle, $haystack, $mem = 'getName') { return array_search(strtolower($needle), array_map( function ($tag) use ($mem) { return strtolower(call_user_func([$tag, $mem])); - }, $haystack) + }, $haystack), + true ); }