sonata-project / cache

[Deprecated] Cache library
https://github.com/sonata-project/cache
MIT License
332 stars 29 forks source link

ApcCache - The count of exploded ipv4 should be 4 #14

Closed YanshuoH closed 9 years ago

YanshuoH commented 9 years ago

Hello,

I've recently got a problem of socket_create as follow:

ContextErrorException: Warning: socket_create(): Unable to create socket [97]: Address family not supported by protocol in .../vendor/sonata-project/cache/lib/Adapter/Cache/ApcCache.php line 84

It seems that this is due to the following line (line 80: Adapter/Cache/ApcCache.php):

if (count(explode('.', $server['ip'])) == 3) {
                $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
} else {
                $socket = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
}

It should be a count of 4 for ipv4?

YanshuoH commented 9 years ago

For anyone who get here in the future, this problem occurs when updating sonata-project/admin-bundle 2.1 to sonata-project/admin-bundle 2.3.