|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-03-18 11:05 UTC] r at roze dot lv
Description:
------------
Keys of returned array (in multiget) are type-casted to string. This behaviour has changed since 2.2.2 (version 2.2.1 still works fine).
I undestand this is a very special case (when using integers as keys and then relaying on the data type), but to clarify if this is supposed to be like that reporting this issue.
Reproduce code:
---------------
<?
$mc = new Memcache;
$mc->addServer('127.0.0.1',11212,0,1,2,1,1);
$ids = array(322,22);
$data = $mc->get($ids);
var_dump(array_keys($data));
?>
Expected result:
----------------
array(2) {
[0]=>
int(322)
[1]=>
int(22)
}
Actual result:
--------------
array(2) {
[0]=>
string(3) "322"
[1]=>
string(2) "22"
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
Actually, in my setup this works as expected both with PHP4 and PHP5 and with pecl/memcache 2.2.3 and 3.0.1, I don't even think it's possible to add numeric string keys to a PHP array and have them represented as anything other than ints, try for example var_dump(array_keys(array('123'=>'test'))); If the problem persists in your setup please re-open the bug and post PHP and pecl/memcache versions and how to reproduce the problem. My test script: $memcache->set(123, 'test1'); $memcache->set(456, 'test2'); $result = $memcache->get(array(123, 456)); var_dump(array_keys($result)); ?> --EXPECT-- array(2) { [0]=> int(123) [1]=> int(456) }