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

$driverName to be a string got "boolean" #456

Closed
nikmauro opened this issue May 12, 2017 · 10 comments
Closed

$driverName to be a string got "boolean" #456

nikmauro opened this issue May 12, 2017 · 10 comments
Assignees
Projects
Milestone

Comments

@nikmauro
Copy link
Contributor

###Configuration:

PhpFastCache version: dev-final
PHP version: 7.1
Operating system: centos 6

####Issue description:

$this->cache = CacheManager::getInstance('predis');

Fatal error: Uncaught phpFastCache\Exceptions\phpFastCacheInvalidArgumentException: Expected $driverName to be a string got "boolean" instead in /vendor/phpfastcache/phpfastcache/src/phpFastCache/CacheManager.php:379 Stack trace: #0 /vendor/phpfastcache/phpfastcache/src/phpFastCache/CacheManager.php(200): phpFastCache\CacheManager::standardizeDriverName(false) #1 //vendor/phpfastcache/phpfastcache/src/phpFastCache/CacheManager.php(258): phpFastCache\CacheManager::getInstance('Apc', Array) #2 //vendor/phpfastcache/phpfastcache/src/phpFastCache/CacheManager.php(186): phpFastCache\CacheManager::getAutoClass(Array) #3 /library/cache.php(106): phpFastCache\CacheManager::getInstance() #4 /library/cache.php(12): cms39_cache->__construct() #5 /home/domainpn/public_html/pc- in /vendor/phpfastcache/phpfastcache/src/phpFastCache/CacheManager.php on line 379

@Geolim4
Copy link
Member

Geolim4 commented May 12, 2017

Hello,

I will have a look, but it's because predis driver seem to be unavailable (missing config?) therefore no fallback driver has been found, throwing that error.

Cheers,
Georges

@Geolim4
Copy link
Member

Geolim4 commented May 12, 2017

I got it:
https://github.com/PHPSocialNetwork/phpfastcache/blob/final/src/phpFastCache/CacheManager.php#L200

There's a wrong exception thrown due to the new driverName check introduced in v6.
I'll fix it tonight, in the meantime please setup the Predis driver using a relevant config (see Example folder).

Cheers,
Georges

@nikmauro
Copy link
Contributor Author

hello @Geolim4 , i have the same code with this example https://github.com/PHPSocialNetwork/phpfastcache/blob/final/docs/examples/predis.php

@nikmauro
Copy link
Contributor Author

i have install in composer the predis driver "composer require predis/predis" and now working

@Geolim4
Copy link
Member

Geolim4 commented May 12, 2017

Ohhh you right, indeed in v6 external dependencies were moved to "suggested" (except Psr ones) :)

Don't close this issue immediately, I still have to correct the Exception side effect bug.

@nikmauro
Copy link
Contributor Author

Now i have this problem

Notice: Undefined index: e in /var/www/vhosts/8.com/httpdocs/vendor/phpfastcache/phpfastcache/src/phpFastCache/Core/Pool/DriverBaseTrait.php on line 186

Fatal error: Uncaught phpFastCache\Exceptions\phpFastCacheInvalidArgumentException: $expiration must be an object implementing the DateTimeInterface in /var/www/vhosts/8.com/httpdocs/vendor/phpfastcache/phpfastcache/src/phpFastCache/Core/Item/ItemBaseTrait.php:158 Stack trace: #0 /var/www/vhosts/8.com/httpdocs/vendor/phpfastcache/phpfastcache/src/phpFastCache/Core/Pool/CacheItemPoolTrait.php(122): phpFastCache\Drivers\Redis\Item->expiresAt(NULL) #1 /var/www/vhosts/8.com/httpdocs/library/cache.php(130): phpFastCache\Drivers\Redis\Driver->getItem('497aae29104bc7f...') #2 /var/www/vhosts/8.com/httpdocs/library/cache.php(59): cms39_cache->get('497aae29104bc7f...') #3 /var/www/vhosts/8.com/httpdocs/library/plugins.php(1034): cms39_cache_fetch('siteurl') #4 /var/www/vhosts/8.com/httpdocs/library/cms39_validate.php(98): get_option('siteurl') #5 /var/www/vhosts/8.com/httpdocs/library/settings.php(21): cms39_has_subdomain() #6 /var/www/vhosts/8.com/httpdocs/library/shared.php in /var/www/vhosts/8.com/httpdocs/vendor/phpfastcache/phpfastcache/src/phpFastCache/Core/Item/ItemBaseTrait.php on line 158

@Geolim4
Copy link
Member

Geolim4 commented May 12, 2017

Can you show me the context of this error please ??

@Geolim4
Copy link
Member

Geolim4 commented May 12, 2017

Ahhhh I got it.
Please purge your cache, from V5 to V6 it's necessary x)

I forget to mention that.

Geolim4 added a commit that referenced this issue May 12, 2017
Fixed #456 + Fixed ambiguous `$badPracticeOmeter` counter
@Geolim4 Geolim4 reopened this May 12, 2017
Geolim4 added a commit to Geolim4/phpfastcache that referenced this issue May 12, 2017
Geolim4 added a commit that referenced this issue May 13, 2017
Issue #456 // Updated migration guide from v5 to v6
@Geolim4
Copy link
Member

Geolim4 commented May 13, 2017

It is working as expected now ?

@nikmauro
Copy link
Contributor Author

Perfect, thanks @Geolim4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
V6 Roadmap
  
Done
Development

No branches or pull requests

2 participants