Skip to content

Commit

Permalink
Use mb_strlen instead of count
Browse files Browse the repository at this point in the history
FIX: Parameter must be an array or an object that implements Countable

Ocurred when creating a new user when using PHP 7.2
  • Loading branch information
orgito authored and LarsMichelsen committed Sep 7, 2018
1 parent 4a2ec62 commit 42c69f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions share/server/core/classes/ViewManageUsers.php
Expand Up @@ -35,7 +35,7 @@ private function addForm() {
if (!$name)
throw new FieldInputError('name', l('Please specify a name.'));

if (count($name) > AUTH_MAX_USERNAME_LENGTH)
if (mb_strlen($name) > AUTH_MAX_USERNAME_LENGTH)
throw new FieldInputError('name', l('This name is too long.'));

if (!preg_match(MATCH_USER_NAME, $name))
Expand All @@ -49,7 +49,7 @@ private function addForm() {
if (!$password1)
throw new FieldInputError('password1', l('Please specify a password.'));

if (count($password1) > AUTH_MAX_PASSWORD_LENGTH)
if (mb_strlen($password1) > AUTH_MAX_PASSWORD_LENGTH)
throw new FieldInputError('password1', l('This password is too long.'));

$password2 = post('password2');
Expand Down Expand Up @@ -254,7 +254,7 @@ private function resetPwForm() {
if (!$password1)
throw new FieldInputError('password1', l('Please specify a password.'));

if (count($password1) > AUTH_MAX_PASSWORD_LENGTH)
if (mb_strlen($password1) > AUTH_MAX_PASSWORD_LENGTH)
throw new FieldInputError('password1', l('This password is too long.'));

$password2 = post('password2');
Expand Down

0 comments on commit 42c69f9

Please sign in to comment.