|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58107 Changed type of returned array keys
Submitted: 2008-03-18 11:05 UTC Modified: 2008-04-16 14:46 UTC
From: r at roze dot lv Assigned:
Status: Not a bug Package: memcache (PECL)
PHP Version: Irrelevant OS: OpenSuse 10.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: r at roze dot lv
New email:
PHP Version: OS:


 [2008-03-18 11:05 UTC] r at roze dot lv
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;

$ids = array(322,22);
$data = $mc->get($ids);

Expected result:
array(2) {

Actual result:
array(2) {
  string(3) "322"
  string(2) "22"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-16 14:46 UTC] mikael at synd dot info
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


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));

array(2) {
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Feb 26 23:01:26 2024 UTC