note 84275 modified in function.memcache-get by danbrown

From: Date: Sat, 19 Jun 2010 14:34:58 +0000
Subject: note 84275 modified in function.memcache-get by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-170315@lists.php.net to get a copy of this message
If deserialization fails for some reason, that is when memcache server returned flag 1 set, but the value was not a correctly serialized PHP data, then Memcache::get acts in a following way: If it was called with a single key to retrieve, then a warning is raised, but since it was not actually a bug of a server, the warning says something confusing like "Memcached Server Error: null" and the function returns bool(false). If it was called by passing an array (even with a single element in it), then the warning is not raised and the resulting array contains a value bool(false). Since there are some buffer overrun bugs present in Memcached Server, which from time to time cause overwriting of [part of] data and therefore rendering it impossible to deserialize, make sure to check if the result of Memcache::get contains only string, or deserialized structure. If the result is bool,dobule or long, then something went wrong. --was-- If deserialization fails for some reason, that is when memcache server returned flag 1 set, but the value was not a correctly serialized PHP data, then Memcache::get acts in a following way: If it was called with a single key to retrieve, then a warning is raised, but since it was not actually a bug of a server, the warning says something confusing like "Memcached Server Error: null" and the function returns bool(false). If it was called by passing an array (even with a single element in it), then the warning is not raised and the resulting array contains a value bool(false). Since there are some buffer overrun bugs present in Memcached Server, which from time to time cause overwriting of [part of] data and therefore rendering it impossible to deserialize, make sure to check if the result of Memcache::get contains only string, or deserialized structure. If the result is bool,dobule or long, then something went wrong. http://php.net/manual/en/function.memcache-get.php

« previous php.notes (#170315) next »