You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the binary protocol is enabled and when passing the 3rd
parameter, Memcached::GET_PRESERVE_ORDER, to getMulti(), the
resulting array contains non-unique keys.
In other words, each key is represented twice in the result.
One is set to null and the other is set to the value of
whatever was stored in memcached.
getResultMessage() shows "SUCCESS".
I'm actually on php 5.3.8
Reproduce code:
$MC = new Memcached;
$MC->setOption(Memcached::OPT_BINARY_PROTOCOL, true); // Removing this
causes the code to work, but at the 'expense' of reverting to the ASCII
protocol
$MC->addServer('localhost', 11211);
array
'key1' => 'stored value for key1'
'key2' => 'stored value for key2'
'key3' => 'stored value for key3'
'key4' => 'stored value for key4'
Actual result:
var_dump shows:
array
'key1' => null
'key2' => null
'key3' => null
'key4' => null
'key1' => 'stored value for key1'
'key2' => 'stored value for key2'
'key3' => 'stored value for key3'
'key4' => 'stored value for key4'
The text was updated successfully, but these errors were encountered:
Note that this is not exclusive to the use of GET_PRESERVE_ORDER, I came across this bug without using that option. For the time being, just disable the use of the binary protocol, and the bug disappears.
Description:
When the binary protocol is enabled and when passing the 3rd
parameter, Memcached::GET_PRESERVE_ORDER, to getMulti(), the
resulting array contains non-unique keys.
In other words, each key is represented twice in the result.
One is set to null and the other is set to the value of
whatever was stored in memcached.
getResultMessage() shows "SUCCESS".
I'm actually on php 5.3.8
Reproduce code:
$MC = new Memcached;
$MC->setOption(Memcached::OPT_BINARY_PROTOCOL, true); // Removing this
causes the code to work, but at the 'expense' of reverting to the ASCII
protocol
$MC->addServer('localhost', 11211);
$KeyList = Array (
'key1'
,'key2'
,'key3'
,'key4'
);
$Test = Array();
foreach ($KeyList as $k) {
$Test[$k] = 'stored value for '.$k;
}
// This block uses the *Multi() functions
$MC->setMulti($Test, 3600);
sleep(1);
$null = null;
$theList = $MC->getMulti($KeyList, $null, Memcached::GET_PRESERVE_ORDER);
var_dump($theList);
Expected result:
var_dump should shows:
array
'key1' => 'stored value for key1'
'key2' => 'stored value for key2'
'key3' => 'stored value for key3'
'key4' => 'stored value for key4'
Actual result:
var_dump shows:
array
'key1' => null
'key2' => null
'key3' => null
'key4' => null
'key1' => 'stored value for key1'
'key2' => 'stored value for key2'
'key3' => 'stored value for key3'
'key4' => 'stored value for key4'
The text was updated successfully, but these errors were encountered: