I have memcache (installed on php5) and memcached (installed on php7.2 via libmemcached) both connecting to the same memcached daemon/server.
Memcache::get works perfectly fine and fetches the data as per my expectation. But when I do Memcached::get, it always returns 0.
I have checked that I have compression off when using both extensions. I also tried toggling between Memcached::OPT_BINARY_PROTOCOL for memcached and it still produces same null result.
Interestingly, when I add a key/value pair using memcached extension and retrieve using the same key, I get proper/correct value that I added.
I am now clueless what could be the reason that it's not working for data already stored in memcached server.
EDIT 1 : I did telnet to my memcached server, and checked that it actually has the value. Also, I checked the result code returned by Memcached::getResultCode is not any kind of failure.
EDIT 2 : I may have narrowed it down further. I noticed that when I save ["key1" => "value1"] from memcache-php5 script, it stores and retrieves data correctly. But when I try to retrieve that same data with memcached-php7.1 script, it returns 0.
After that I removed the data with key "key1" from memcached server using telnet. And then I saved ["key1" => "value1"] using memcached-php7.1 script and it can retrieve that data correctly. But when trying to retrieve it using memcache-php5 script, it returns kind of the serialized data "a:1:{s:4:\"key1\";s:6:\"value1\";}" (this is json_encoded output)
So in order to upgrade, I may have to delete/flush everything and recreate entries in memcached server using memcached extension.
P.S. : I know the differences between both these php extensions. I have read all the comments on this question and it's not a duplicate of mine.