php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58635 Issue a notice on invalid keys
Submitted: 2009-04-17 01:39 UTC Modified: 2021-06-09 11:17 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: brian at moonspot dot net Assigned: cmb (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.2.9 OS: Linux
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: brian at moonspot dot net
New email:
PHP Version: OS:

 

 [2009-04-17 01:39 UTC] brian at moonspot dot net
Description:
------------
Currently, when a key is invalid, the get method/function simply returns false.  It would be nice if either an E_WARNING or E_NOTICE was thrown when a key is not a valid memcached key

Reproduce code:
---------------
$m = new Memcached();

$res = $m->addServer("localhost", 11211);

$res = $m->set("this is a key with spaces", 1);


Expected result:
----------------
E_WARNING or E_NOTICE

Actual result:
--------------
No error is thrown.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-17 12:50 UTC] andrei@php.net
You can use getResultCode() to check the result of the operation. Currently it returns Memcached::RES_PROTOCOL_ERROR for bad keys. I can add an option Memcached::OPT_VERIFY_KEYS that would validate all keys on every operation and return Memcached::RES_BAD_KEY_PROVIDED in case one of the keys is bad.d
 [2009-06-26 18:41 UTC] marc dot bennewitz at giata dot de
The memcache extension allows all strings to use as key. Is it possible to handle this same with this memcached exception ?

What is a list of rules for it ?
 [2009-06-26 18:43 UTC] andrei@php.net
I don't understand what you mean by "is it possible to handle this same with this memcached exception". Can you try asking again?
 [2009-06-26 18:43 UTC] andrei@php.net
I don't understand what you mean by "is it possible to handle this same with this memcached exception". Can you try asking again?
 [2009-06-26 18:56 UTC] marc dot bennewitz at giata dot de
On memcache it works fine to use special chars for cache ids:

$memcache->set("id &% \/\$\x00\t\n\r\\", 'data', 0, 100);
var_dump($memcache->get("id &% \/\$\x00\t\n\r\\"));

But on memcached the same code generates a Memcached::RES_BAD_KEY_PROVIDED.
It would be very nice if memcached will handle all characters as keys in the future?
 [2009-09-12 06:34 UTC] Jared dot Williams1 at ntlworld dot com
"What is a list of rules for it ?"

Keys have made up of characters that satisfy C's isgraph().
 [2012-03-07 17:13 UTC] andrei@php.net
-Summary: brianlmoon +Summary: Issue a notice on invalid keys
 [2021-06-09 11:17 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-09 11:17 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: Sat Dec 21 15:01:29 2024 UTC