Skip to content

Commit

Permalink
Merge pull request #85 from MichalSkoula/api_constructor_mb_strlen
Browse files Browse the repository at this point in the history
fixes mb_strlen(): Passing null to parameter #1 ($string) of type str…
  • Loading branch information
Salamek authored Jun 29, 2024
2 parents 85c8b45 + 22901ee commit 7f93ae7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ class Api
*/
public function __construct($username = null, $password = null, $customerId = null, $storage = null, $trace = true)
{
if (mb_strlen($username) > 32) {
if ($username !== null && mb_strlen($username) > 32) {
throw new SecurityException('$username is longer than 32 characters');
}

if (mb_strlen($password) > 32) {
if ($password !== null && mb_strlen($password) > 32) {
throw new SecurityException('$password is longer than 32 characters');
}

Expand Down

0 comments on commit 7f93ae7

Please sign in to comment.