Could you extend the callback method to pass in the flags too?  This would allow PHP memcached (and other) implementations to inspect the memcached flags for deserialization.