diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index b883673e582..7baf1742d61 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -123,7 +123,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { $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 afa9f076e1a..217f447d916 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -242,11 +242,11 @@ class PersonalInfo implements ISettings { $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 f9035902bb3..0fb318d57b6 100644 --- a/apps/user_ldap/lib/Helper.php +++ b/apps/user_ldap/lib/Helper.php @@ -141,7 +141,7 @@ class Helper { */ 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 338d49ad03b..7b1993fa7cf 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -447,7 +447,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 841a4d70f9f..418dcb2b211 100644 --- a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php +++ b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php @@ -71,7 +71,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]); } diff --git a/apps/user_status/lib/Listener/UserLiveStatusListener.php b/apps/user_status/lib/Listener/UserLiveStatusListener.php index 2db999d3712..cd26bd03976 100644 --- a/apps/user_status/lib/Listener/UserLiveStatusListener.php +++ b/apps/user_status/lib/Listener/UserLiveStatusListener.php @@ -82,7 +82,7 @@ class UserLiveStatusListener implements IEventListener { // 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 ac3d1dee08d..6eec7eb0d2b 100644 --- a/build/integration/features/bootstrap/Trashbin.php +++ b/build/integration/features/bootstrap/Trashbin.php @@ -97,7 +97,7 @@ trait Trashbin { $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'); } } @@ -121,7 +121,7 @@ trait Trashbin { return $item['{http://nextcloud.org/ns}trashbin-filename']; }, $elementList)); - if (array_search($name, array_values($trashContent)) === false) { + if (array_search($name, array_values($trashContent), true) === false) { Assert::fail("$name" . ' is not in trash listing'); } } diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 262db1db709..fb552ce785b 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -438,7 +438,7 @@ trait WebDav { } 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 b656158b530..632d19968a6 100644 --- a/lib/base.php +++ b/lib/base.php @@ -970,7 +970,7 @@ class OC { 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 1189712ba8d..373a697a327 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -354,7 +354,7 @@ class AccountManager implements IAccountManager { 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 260f9218a88..c46d4c6c8eb 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -250,7 +250,7 @@ class Local extends \OC\Files\Storage\Common { 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 fa8cc51f606..abe392335f5 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -654,7 +654,7 @@ class Factory implements IFactory { // 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 fb59fb670a6..f117a3a7f7c 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -645,7 +645,8 @@ class Tags implements ITags { return array_search(strtolower($needle), array_map( function ($tag) use ($mem) { return strtolower(call_user_func([$tag, $mem])); - }, $haystack) + }, $haystack), + true ); }