mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
fix: Use strict array comparisons in lib/
To avoid surprises with corner cases. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
c1dd559965
commit
3c80b7f2b3
5 changed files with 6 additions and 5 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue