Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache info compatibility with APCu #37

Closed
damienalexandre opened this issue Jun 3, 2016 · 3 comments
Closed

Cache info compatibility with APCu #37

damienalexandre opened this issue Jun 3, 2016 · 3 comments

Comments

@damienalexandre
Copy link

From what I read in the code, this tool is not compatible with APCu.

Env

  • PHP Version 7.0.7
  • APC Compatibility 1.0.3
  • APCu Version 5.1.4
  • cachetool 2.0.6 (because I use Symfony 2) but master have the same issue

The issue

The apc:cache:info command fails:

$ ./bin/cachetool apc:cache:info --fcgi=/var/run/php-fpm.sock

Fatal error: Uncaught TypeError: Argument 1 passed to CacheTool\Command\ApcCacheInfoCommand::normalize() must be of the type array, null given, called in vendor/gordalina/cachetool/src/CacheTool/Command/ApcCacheInfoCommand.php on line 60 and defined in vendor/gordalina/cachetool/src/CacheTool/Command/ApcCacheInfoCommand.php:101

This is because this statement return null:

$this->getCacheTool()->apc_cache_info('system');

I'm not sure why exactly but the fact is that signatures for this method are different between APC and APCu, but the CacheTool always tries to call the old signature.

        $code->addStatement(sprintf(
            'return apc_cache_info(%s, %s);',
            var_export($cache_type, true),
            var_export($limited, true)
        ));

As the command expect both a "user" and a "system" cache infos from APC, maybe it should be fixed with a new command apcu:cache:info, because APCu only expose user cache. WDYT?

APCu

http://php.net/manual/fr/function.apcu-cache-info.php

array apcu_cache_info ([ bool $limited = false ] )

APC

http://php.net/manual/en/function.apc-cache-info.php

array apc_cache_info ([ string $cache_type = "" [, bool $limited = false ]] )

@damienalexandre
Copy link
Author

Ok blames on me, there is already a nice PR about this: #36

@vincentdesmares
Copy link

Someone should open again this PR as the fix of #36 did not solve the issue. I downloaded the 2.1.0 and the bug is still there.

Fatal error: Uncaught TypeError: Argument 1 passed to CacheTool\Command\ApcCacheInfoCommand::normalize() must be of the type array, null given, called in phar:///vagrant/cachetool.phar/src/CacheTool/Command/ApcCacheInfoCommand.php on line 61 and defined in phar:///vagrant/cachetool.phar/src/CacheTool/Command/ApcCacheInfoCommand.php on line 102
TypeError: Argument 1 passed to CacheTool\Command\ApcCacheInfoCommand::normalize() must be of the type array, null given, called in phar:///vagrant/cachetool.phar/src/CacheTool/Command/ApcCacheInfoCommand.php on line 61 in phar:///vagrant/cachetool.phar/src/CacheTool/Command/ApcCacheInfoCommand.php on line 102`

@damienalexandre
Copy link
Author

With the changes in #36 you have to call apcu:cache:info for it to work, and not apc:cache:info as I assume you did?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants