Fix for PHP 8 RC2

This commit is contained in:
Visman 2020-10-29 14:32:54 +07:00
parent 50562d6ae3
commit 97de25a05f
8 changed files with 22 additions and 12 deletions

View file

@ -157,7 +157,7 @@ class Router
'page' !== $name
|| 1 !== $args[$name]
) {
$data['{' . $name . '}'] = \rawurlencode(\str_replace($this->subSearch, $this->subRepl, $args[$name]));
$data['{' . $name . '}'] = \rawurlencode(\str_replace($this->subSearch, $this->subRepl, (string) $args[$name]));
continue;
}
}

View file

@ -240,9 +240,9 @@ abstract class Page extends Model
$navGen[$matches[4][$i]] = [$matches[3][$i], $matches[2][$i]];
} else {
$navGen = \array_merge(
\array_slice($navGen, 0, $matches[1][$i]),
\array_slice($navGen, 0, (int) $matches[1][$i]),
[$matches[4][$i] => [$matches[3][$i], $matches[2][$i]]],
\array_slice($navGen, $matches[1][$i])
\array_slice($navGen, (int) $matches[1][$i])
);
}
}

View file

@ -380,7 +380,7 @@ class Bans extends Admin
}
$startNum = ($page - 1) * $this->c->config->o_disp_users;
$idsN = \array_slice($idsN, $startNum, $this->c->config->o_disp_users);
$idsN = \array_slice($idsN, $startNum, (int) $this->c->config->o_disp_users);
$banList = $this->c->bans->getList($idsN);
$this->nameTpl = 'admin/bans_result';
@ -742,6 +742,7 @@ class Bans extends Admin
{
if (
empty($v->getErrors())
&& null !== $username
&& '' != \trim($username)
) {
$user = $this->c->users->loadByName($username, true);
@ -769,7 +770,10 @@ class Bans extends Admin
*/
public function vIpBan(Validator $v, $ips)
{
if ('' != \trim($ips)) {
if (
null !== $ips
&& '' != \trim($ips)
) {
$ending6 = ['', '::'];
$ending4 = ['', '.255', '.255.255', '.255.255.255'];
$addresses = \explode(' ', $ips);
@ -802,7 +806,10 @@ class Bans extends Admin
*/
public function vEmailBan(Validator $v, $email)
{
if ('' != \trim($email)) {
if (
null !== $email
&& '' != \trim($email)
) {
$error = true;
if (
@ -832,7 +839,10 @@ class Bans extends Admin
*/
public function vExpireBan(Validator $v, $expire)
{
if ('' != \trim($expire)) {
if (
null !== $expire
&& '' != \trim($expire)
) {
if (\strtotime($expire . ' UTC') - \time() < 86400) {
$v->addError('Invalid date message');
}

View file

@ -107,7 +107,7 @@ class Result extends Users
}
$startNum = ($page - 1) * $this->c->config->o_disp_users;
$idsN = \array_slice($idsN, $startNum, $this->c->config->o_disp_users);
$idsN = \array_slice($idsN, $startNum, (int) $this->c->config->o_disp_users);
$ids = [];
$userList = [];

View file

@ -27,7 +27,7 @@ class Stat extends Users
}
$startNum = ($page - 1) * $this->c->config->o_disp_users;
$stat = \array_slice($stat, $startNum, $this->c->config->o_disp_users);
$stat = \array_slice($stat, $startNum, (int) $this->c->config->o_disp_users);
$user = $this->c->users->load((int) $args['id']);

View file

@ -91,7 +91,7 @@ class Userlist extends Page
if ($number) {
$this->startNum = ($page - 1) * $this->c->config->o_disp_users;
$ids = \array_slice($ids, $this->startNum, $this->c->config->o_disp_users);
$ids = \array_slice($ids, $this->startNum, (int) $this->c->config->o_disp_users);
$this->userList = $this->c->users->loadByIds($ids);
$links = [];

View file

@ -62,7 +62,7 @@ class ActionP extends Method
$this->model->idsList = \array_slice(
$list,
($this->model->page - 1) * $this->c->user->disp_posts,
$this->c->user->disp_posts
(int) $this->c->user->disp_posts
);
return $this->c->posts->view($this->model);

View file

@ -112,7 +112,7 @@ class ActionT extends Method
$this->model->idsList = \array_slice(
$list,
($this->model->page - 1) * $this->c->user->disp_topics,
$this->c->user->disp_topics
(int) $this->c->user->disp_topics
);
return $this->c->topics->view($this->model);