sleep() should not be used

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

  1. if (intval(time() - $lockTime) > 20) { // Wait for 10 seconds
  2. $log->info("[Filesystem cache] Gave up to wait unlock. Release lock for '$key'");
  3. $this->unlock($key);
  4. return null;
  5. }
  6. sleep(1); // 1 second

    sleep() may create timeouts without even protecting your application.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by João Gilberto Magalhães
  7. }
  8. }
  9. // Check if file exists
  10. if (file_exists($fileKey)) {
  • byjg

    Ignored on Thu, 10 Sep 2015 15:37:33 GMT

Error silenced by the at sign (@)

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

  1. }
  2. $fileKey = $this->getKeyId($key);
  3. // Opened
  4. $shm_id = @shmop_open($fileKey, "a", 0, 0);

    Adding "@" before shmop_open($fileKey, 'a', 0, 0) 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 João Gilberto Magalhães
  5. if (!$shm_id) {
  6. $log->info("[Shmop Cache] '$key' not exists");
  7. return null;
  8. }
  • byjg

    Unfortunately the shmop_open causes an warn if the segment does not exists and there is no function for check if exists.
  • byjg

    Ignored on Thu, 10 Sep 2015 15:38:53 GMT

User specific files should not appear in .gitignore

More information: https://insight.symfony.com/what-we-analyse/git.user_specific_ignored_file

in .gitignore, line 6
  1. nbproject/private
  2. *~
  3. composer.lock
  4. vendor
  5. config/cacheconfig.php
  6. .idea

    .idea is user-specific and should not appear in a project .gitignore. Consider adding it to the user global .gitignore instead.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Joao Gilberto Magalhaes
  • byjg

    d on Wed, 10 Aug 2016 21:53:34 GMT

Unused method, property, variable or parameter

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

in src/CacheContext.php, line 81
  1. public static function psrFactory($key = "default")
  2. {
  3. return new CachePool(self::getInstance()->factoryInternal($key), self::getInstance()->getPoolBuffer($key));
  4. }
  5. private function factoryInternal($key)

    This factoryInternal method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Joao Gilberto Magalhaes
  6. {
  7. if (!isset(self::$instances[$key])) {
  8. $result = $this->config->getCacheconfig("$key.instance");
  9. if (is_null($result)) {
  10. throw new \Exception("The cache config '$key' was not found");
  • byjg

    Yes, it is used. Check at line 64. There a method to get the instance from the singleton object.
  • byjg

    Ignored on Thu, 10 Sep 2015 15:40:07 GMT