PHP Memcache::get modifies his second argument

Evert|Rooftop evertpot at gmail.com
Fri Dec 1 02:45:21 UTC 2006


Changing it is one thing.. it should however change a copy of the 
string, and not the original..

This is definitely a bug, I will log it..

Evert

Timo Ewalds wrote:
> It seems the reason is because he's using spaces in the key. Spaces 
> aren't valid in keys, so get replaced. The pecl library should 
> probably return an error instead of changing it though.
>
> Timo
>
> Brian Moon wrote:
>> You really should report this as a bug if you feel it is one.  At the 
>> minimum it should be documented.
>>
>> http://pecl.php.net/bugs/search.php?cmd=display&status=Open&package_name[]=memcache 
>>
>>
>> Veres Lajos wrote:
>>> Hello,
>>>
>>> print   "key:$key<br>";
>>> memcache_get($server,$key);
>>> print   "key:$key<br>";
>>>
>>> And it returns:
>>> key:sql/select field from table where xyz...
>>> key:sql/select_field_from_table_where_xyz...
>>>
>>> It seems memcache_get modifies his second argument.
>>>
>>> As I checked now, Im not the first experiencing this:
>>> http://www.php.net/manual/en/function.memcache-get.php
>>> (see notes)
>>>
>>> This is a feature or a bug?
>>>
>>> (After 2 hours debuging i choose bug... :-)
>>>
>>> I tried to workaround:
>>> $tmp=$key;
>>> print   "key:$key<br>";
>>> memcache_get($server,$tmp);
>>> print   "key:$key<br>";
>>>
>>> Same response:
>>> key:sql/select field from table where xyz...
>>> key:sql/select_field_from_table_where_xyz...
>>>
>>> $tmp=$key.'';
>>> worked finaly.
>>>
>>> It seems it changing only if argument can be usable as a reference.
>>> And handles well if not:
>>>
>>> memcache_get($server,$key.'');
>>> works fine.
>>>
>>> memcache_set seems to have the same behaviour.
>>> (probably other functions too)
>>>
>>
>>
>



More information about the memcached mailing list