php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50612 Memcached::setMulti can't support pure digit key
Submitted: 2009-12-30 12:33 UTC Modified: 2009-12-30 12:48 UTC
From: gnujava at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.1 OS: Linux 64bit
Private report: No CVE-ID: None
 [2009-12-30 12:33 UTC] gnujava at gmail dot com
Description:
------------
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, 
&str_key_len, &num_key, 0, NULL) != HASH_KEY_IS_STRING) {
			continue;
		}
HASH_KEY_IS_STRING is not good ideal.



Reproduce code:
---------------
---
From manual page: memcached.setmulti#Description
---
$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.
);
$m->setMulti($items);
var_dump($m->get('123'));         // '123'=>'value1' not in memcached 


Expected result:
----------------
string(6) "value1"

Actual result:
--------------
bool(false)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-30 12:48 UTC] johannes@php.net
Please report this at the pecl site, pecl.php.net. Thank you.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Dec 07 02:00:01 2025 UTC