Skip to content

Fix #101: Rename UserAuth to WebAuth, mark UserAuth as deprecated, add ApiAuth authentication method #481

Fix #101: Rename UserAuth to WebAuth, mark UserAuth as deprecated, add ApiAuth authentication method

Fix #101: Rename UserAuth to WebAuth, mark UserAuth as deprecated, add ApiAuth authentication method #481

Triggered via pull request October 24, 2024 06:02
Status Success
Total duration 51s
Artifacts

mutation.yml

on: pull_request
Matrix: mutation / roave-infection
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
mutation / PHP 8.3-ubuntu-latest: src/CurrentUser.php#L313
Escaped Mutant for Mutator "LogicalOrAllSubExprNegation": --- Original +++ New @@ @@ } /** @var mixed $id */ $id = $this->session->get(self::SESSION_AUTH_ID); - if ($id !== null && ($this->authTimeout !== null || $this->absoluteAuthTimeout !== null)) { + if ($id !== null && (!($this->authTimeout !== null) || !($this->absoluteAuthTimeout !== null))) { $expire = $this->getExpire(); $expireAbsolute = $this->getExpireAbsolute(); if ($expire !== null && $expire < time() || $expireAbsolute !== null && $expireAbsolute < time()) {
mutation / PHP 8.3-ubuntu-latest: src/Login/Cookie/CookieLogin.php#L40
Escaped Mutant for Mutator "CloneRemoval": --- Original +++ New @@ @@ */ public function withCookieName(string $name) : self { - $new = clone $this; + $new = $this; $new->cookieName = $name; return $new; }
mutation / PHP 8.3-ubuntu-latest: src/Login/Cookie/CookieLogin.php#L76
Escaped Mutant for Mutator "BitwiseOr": --- Original +++ New @@ @@ $expires = null; $data[] = 0; } - $cookieValue = json_encode($data, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + $cookieValue = json_encode($data, JSON_THROW_ON_ERROR & JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); return (new Cookie(name: $this->cookieName, value: $cookieValue, expires: $expires))->addToResponse($response); } /**
mutation / PHP 8.3-ubuntu-latest: src/Login/Cookie/CookieLogin.php#L76
Escaped Mutant for Mutator "BitwiseOr": --- Original +++ New @@ @@ $expires = null; $data[] = 0; } - $cookieValue = json_encode($data, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + $cookieValue = json_encode($data, (JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES) & JSON_UNESCAPED_UNICODE); return (new Cookie(name: $this->cookieName, value: $cookieValue, expires: $expires))->addToResponse($response); } /**
mutation / PHP 8.3-ubuntu-latest: src/Login/Cookie/CookieLoginMiddleware.php#L42
Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ * @param CookieLogin $cookieLogin The cookie login instance. * @param bool $forceAddCookie Whether to force add a cookie. */ - public function __construct(private CurrentUser $currentUser, private IdentityRepositoryInterface $identityRepository, private LoggerInterface $logger, private CookieLogin $cookieLogin, private bool $forceAddCookie = false) + public function __construct(private CurrentUser $currentUser, private IdentityRepositoryInterface $identityRepository, private LoggerInterface $logger, private CookieLogin $cookieLogin, private bool $forceAddCookie = true) { } /**
mutation / PHP 8.3-ubuntu-latest: src/Login/Cookie/CookieLoginMiddleware.php#L96
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ return; } try { - $data = json_decode((string) $cookies[$cookieName], true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $cookies[$cookieName], true, 511, JSON_THROW_ON_ERROR); } catch (Throwable) { $this->logger->warning('Unable to authenticate user by cookie. Invalid cookie.'); return;
mutation / PHP 8.3-ubuntu-latest: src/Login/Cookie/CookieLoginMiddleware.php#L96
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ return; } try { - $data = json_decode((string) $cookies[$cookieName], true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $cookies[$cookieName], true, 513, JSON_THROW_ON_ERROR); } catch (Throwable) { $this->logger->warning('Unable to authenticate user by cookie. Invalid cookie.'); return;
mutation / PHP 8.3-ubuntu-latest: src/Login/Cookie/CookieLoginMiddleware.php#L134
Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ $this->logger->warning('Unable to authenticate user by cookie. Invalid key.'); return; } - if ($expires !== 0 && $expires < time()) { + if ($expires !== 0 && $expires <= time()) { $this->logger->warning('Unable to authenticate user by cookie. Lifetime has expired.'); return; }
mutation / PHP 8.3-ubuntu-latest: src/Login/LoginMiddleware.php#L52
Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ if ($identity instanceof IdentityInterface) { $this->currentUser->login($identity); } else { - $this->logger->debug(sprintf('Unable to authenticate user by token %s. Identity not found.', is_scalar($identity) ? '"' . $identity . '"' : 'of type ' . get_debug_type($identity))); + $this->logger->debug(sprintf('Unable to authenticate user by token %s. Identity not found.', is_scalar($identity) ? $identity . '"' . '"' : 'of type ' . get_debug_type($identity))); } return $handler->handle($request); } }
mutation / PHP 8.3-ubuntu-latest: src/Login/LoginMiddleware.php#L52
Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ if ($identity instanceof IdentityInterface) { $this->currentUser->login($identity); } else { - $this->logger->debug(sprintf('Unable to authenticate user by token %s. Identity not found.', is_scalar($identity) ? '"' . $identity . '"' : 'of type ' . get_debug_type($identity))); + $this->logger->debug(sprintf('Unable to authenticate user by token %s. Identity not found.', is_scalar($identity) ? $identity . '"' : 'of type ' . get_debug_type($identity))); } return $handler->handle($request); } }