Skip to content
Advertisement

PHP Memcached stores array, retrieves object. A bug?

Using MemcacheD v1.4.22

PECL MemcacheD library v2.2.0

PHP v5.3.19 (cli)

I am trying to store an array into cache

JavaScript

I am storing an array with mixed integer/string keys which should not be a problem for php but apparently it is for memcached? Is it documented anywhere? Any workaround or hint?

If I look at terminal output of the key:

JavaScript

we see that the array is actually saved as object and not as array meaning the output is correct but somehow storing converts this array into object…

Unfortunately I cannot get rid of string or int based array key elements so I will have to deal with them somehow.

Any help appreciated.

Advertisement

Answer

After two days of painful research it turns out that memcached configuration was set to serialize to objects in php.ini file:

JavaScript

changed it to

JavaScript

As always, thanks Stackoverflow – even if it does not give you the answer, it makes you think more constructive.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement