php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #59035 missing Memcached::SERIALIZER_NONE
Submitted: 2010-01-19 06:34 UTC Modified: 2010-01-19 14:01 UTC
From: marc dot bennewitz at giata dot de Assigned:
Status: Not a bug Package: memcached (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2010-01-19 06:34 UTC] marc dot bennewitz at giata dot de
Description:
------------
I miss a serializer option to disable serializing.

If I only have string to serialize or would like to use an own serializer, a serializing by memcached isn't needed and makes stored data inconsistent.

This needs to throw an excaption if someone wonts to store a non-string on a serializer disabled memcached object.

Reproduce code:
---------------
Example: usign same cache with PHP & Python

$pythonSerializer = new PythonPickleSerializer();
$memcached->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_NONE):
$memcached->set('id', $pythonSerializer->serialize($data));

Expected result:
----------------
Reading data with python.

Actual result:
--------------
Can't disable memcached build-in serializer and data will be serialized using one of the available serializer options.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-19 13:34 UTC] andrei@php.net
Thank you for taking the time to write to us, but this is not
a bug.

Only arrays and objects are serialized automatically. Everything else is not serialized, so you're free to use your own serializer and store it as a string.
 [2010-01-19 13:50 UTC] marc dot bennewitz at giata dot de
Thanks for you fast answer.

But how does it work to store different php datatypes (like float, int etc.) and on reading detect what datatype it is ?
 [2010-01-19 14:01 UTC] andrei@php.net
It stores the data type in the flags portion of the memcache item.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 03:01:32 2024 UTC