PHP Memcache::get modifies his second argument

Veres Lajos vlajos at ludens.elte.hu
Thu Nov 30 22:13:10 UTC 2006


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)

-- 
Veres Lajos
vlajos at ludens.elte.hu
+36 20 438 5909


More information about the memcached mailing list