|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
42 + 39 = ?
Subscribe to this entry?

 [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: Wed Feb 28 14:01:28 2024 UTC