php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60049 Memcached does not handle invalid keys
Submitted: 2011-10-13 08:18 UTC Modified: 2021-06-09 11:27 UTC
Votes:9
Avg. Score:4.7 ± 0.7
Reproduced:8 of 8 (100.0%)
Same Version:2 (25.0%)
Same OS:2 (25.0%)
From: foehr at lotum dot de Assigned: cmb (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.3.8 OS: Linux (Debian 5)
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: foehr at lotum dot de
New email:
PHP Version: OS:

 

 [2011-10-13 08:18 UTC] foehr at lotum dot de
Description:
------------
Calling Memcached with invalid keys (too long, invalid characters) leads to 
strange behavior.
Calling get with an invalid key and after that getMulti with a valid key does not 
work (see below).


Versions:
memcached support => enabled
libmemcached version => 0.52

PECL:
memcached 1.0.2   stable


Test script:
---------------
<?php

class MemcachedTest extends \PHPUnit_Framework_TestCase
{
    public function testSet()
    {
        $mc = new Memcached();
        $mc->addServer('127.0.0.1', 11211);

        $mc->get(str_pad('', 300, 'x'));
        // it is "NOT FOUND"
        $this->assertEquals(Memcached::RES_BAD_KEY_PROVIDED, $mc->getResultCode());

        $mc->getMulti(array('foo'));
        // it is "SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY"
        $this->assertEquals(Memcached::RES_BAD_KEY_PROVIDED, $mc->getResultCode());
    }
}


Expected result:
----------------
The first $mc->get should lead to a result code "BAD KEY PROVIDED".
The second $mc->getMulti be "NOT FOUND" or "SUCCESS" depending on the cache 
content.

Actual result:
--------------
The first $mc->get sets the result code to "NOT FOUND".
The second $mc->getMulti sets the result code to "SERVER HAS FAILED AND IS 
DISABLED UNTIL TIMED RETRY".

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-09 11:27 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-09 11:27 UTC] cmb@php.net
The memcached bug tracker is now on Github[1].  If this is still
an issue with the current memcached version, please report there.

[1] <https://github.com/php-memcached-dev/php-memcached/issues>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 17:01:31 2024 UTC