|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59016 Memcached::setMulti can't support pure digit key
Submitted: 2009-12-30 10:03 UTC Modified: 2021-06-09 11:22 UTC
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: gnujava at gmail dot com Assigned: cmb (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.3.0 OS: Linux 64bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: gnujava at gmail dot com
New email:
PHP Version: OS:


 [2009-12-30 10:03 UTC] gnujava at gmail dot com
Memcached::setMulti can't support pure digit key

file: php_memcached.c
fun:  php_memc_setMulti_impl
line: 1009

if (zend_hash_get_current_key_ex(Z_ARRVAL_P(entries), 
&str_key_len, &num_key, 0, NULL) != HASH_KEY_IS_STRING) {
HASH_KEY_IS_STRING is not good idea.

Reproduce code:
$m = new Memcached();
$m->addServer('localhost', 11211);

$items = array(
    '123' => 'value1'            // key is pure number but       that type is string, and php engine will turn string(123) to    int(123) key.
var_dump($m->get('123'));         // '123'=>'value1' not in memcached 

Expected result:
string(6) "value1"

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-04 22:40 UTC] tuyanozipek at gmail dot com
This should be fixed in my devel branch. Can you please test
and provide feedback?

 [2010-01-05 03:32 UTC] tricky dot pecl at luuseri dot com
Also, a fix to allow pure digit keys in deleteMulti and getMulti is in the works.
 [2010-01-05 04:11 UTC] gnujava at gmail dot com
Could you add the automatic type conversion in get/set method 
for pure digit key(integer type).

value = $mc->get((string)123);

value = $mc->get(123);
 [2013-04-25 18:56 UTC] kneeoh at yahoo dot com
I've observed the same behavior on PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) 
(built: Mar 11 2013 14:31:48)
 [2021-06-09 11:22 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-09 11:22 UTC]
The memcached bug tracker is now on Github[1].  If this is still
an issue with the current memcached version, please report there.

[1] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC