PHP Memcache::get modifies his second argument

Timo Ewalds timo at tzc.com
Fri Dec 1 02:38:44 UTC 2006


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