Strict in_array()

This commit is contained in:
Visman 2021-07-18 10:45:28 +07:00
parent 1f910ad585
commit c9cff3bf8f
8 changed files with 11 additions and 11 deletions

View file

@ -59,7 +59,7 @@ class DB extends PDO
$type = \strstr($dsn, ':', true);
if (
! $type
|| ! \in_array($type, PDO::getAvailableDrivers())
|| ! \in_array($type, PDO::getAvailableDrivers(), true)
|| ! \is_file(__DIR__ . '/DB/' . \ucfirst($type) . '.php')
) {
throw new PDOException("Driver isn't found for '$type'");
@ -102,7 +102,7 @@ class DB extends PDO
foreach ($options as $key => $value) {
if (
! isset($verify[$key])
|| ! \in_array($value, $verify[$key])
|| ! \in_array($value, $verify[$key], true)
) {
return false;
}

View file

@ -113,7 +113,7 @@ class Image extends File
}
if (\is_array($info['extension'])) {
if (\in_array($this->ext, $info['extension'])) {
if (\in_array($this->ext, $info['extension'], true)) {
$info['extension'] = $this->ext;
} else {
$info['extension'] = \reset($info['extension']); // ???? выбор расширения?

View file

@ -108,7 +108,7 @@ class Mail
];
$this->EOL = "\r\n";
} else {
$this->EOL = \in_array($eol, ["\r\n", "\n", "\r"]) ? $eol : \PHP_EOL;
$this->EOL = \in_array($eol, ["\r\n", "\n", "\r"], true) ? $eol : \PHP_EOL;
}
}
@ -630,7 +630,7 @@ class Mail
if (
null !== $code
&& ! \in_array($return, $code)
&& ! \in_array($return, $code, true)
) {
throw new SmtpException("Unable to send email. Response of mail server: \"{$this->response}\"");
}

View file

@ -31,7 +31,7 @@ class Secury
) {
throw new InvalidArgumentException('Algorithm and salt can not be empty');
}
if (! \in_array($hmac['algo'], \hash_hmac_algos())) {
if (! \in_array($hmac['algo'], \hash_hmac_algos(), true)) {
throw new UnexpectedValueException('Algorithm not supported');
}
$this->hmac = $hmac;

View file

@ -39,7 +39,7 @@ class Model extends DataModel
$this->c->GROUP_MEMBER
];
return ! \in_array($this->g_id, $notDeleted) && $this->g_id !== $this->c->config->i_default_user_group;
return ! \in_array($this->g_id, $notDeleted, true) && $this->g_id !== $this->c->config->i_default_user_group;
}
/**

View file

@ -34,11 +34,11 @@ class Groups extends Admin
foreach ($this->c->groups->getList() as $key => $group) {
$groupsList[$key] = [$group->g_title, $group->linkEdit, $group->linkDelete];
if (! \in_array($group->g_id, $notForNew)) {
if (! \in_array($group->g_id, $notForNew, true)) {
$groupsNew[$key] = $group->g_title;
}
if (
! \in_array($group->g_id, $notForDefault)
! \in_array($group->g_id, $notForDefault, true)
&& 0 == $group->g_moderator
) {
$groupsDefault[$key] = $group->g_title;

View file

@ -1160,7 +1160,7 @@ class Install extends Admin
'o_regs_report' => 0,
'i_default_email_setting' => 2,
'o_mailing_list' => $v->email,
'o_avatars' => \in_array(\strtolower(@\ini_get('file_uploads')), ['on', 'true', '1']) ? 1 : 0,
'o_avatars' => \in_array(\strtolower(@\ini_get('file_uploads')), ['on', 'true', '1'], true) ? 1 : 0,
'o_avatars_dir' => '/img/avatars',
'i_avatars_width' => 60,
'i_avatars_height' => 60,

View file

@ -136,7 +136,7 @@ class Moderate extends Page
$v->addError('Nowhere to move');
} elseif (
1 === $v->confirm
&& ! \in_array($v->destination, $this->listOfIndexes)
&& ! \in_array($v->destination, $this->listOfIndexes, true)
) {
$v->addError('Invalid destination');
} elseif (