Error silenced by the at sign (@) 3

More information: https://insight.symfony.com/what-we-analyse/php.silenced_error

Updated rule! We've recently tweaked this rule. This may explain the disappearance of false positives, or new suggestions not linked to any activity in the code.
  1. if (!array_key_exists($key, $this->store)) {
  2. throw new KeyNotFoundException();
  3. }
  4. $getResult = $this->store[$key];
  5. $unserialized = @unserialize($getResult);

    Adding "@" before unserialize($getResult) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Adam Balogh
  6. if (!Util::hasInternalExpireTime($unserialized)) {
  7. throw new \Exception('Cannot retrieve ttl');
  8. }
  1. if (!array_key_exists($key, $this->store)) {
  2. return false;
  3. }
  4. $getResult = $this->store[$key];
  5. $unserialized = @unserialize($getResult);

    Adding "@" before unserialize($getResult) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Adam Balogh
  6. if (!Util::hasInternalExpireTime($unserialized)) {
  7. return false;
  8. }
  1. if (!array_key_exists($key, $this->store)) {
  2. throw new KeyNotFoundException();
  3. }
  4. $getResult = $this->store[$key];
  5. $unserialized = @unserialize($getResult);

    Adding "@" before unserialize($getResult) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Adam Balogh
  6. if (Util::hasInternalExpireTime($unserialized)) {
  7. $this->handleTtl($key, $unserialized['ts'], $unserialized['s']);
  8. $getResult = $unserialized['v'];