[dev] RFC: array values for preferences

Mike Cochrane mike at graftonhall.co.nz
Sun Feb 9 04:35:23 PST 2003


Is there a way that you can get horde_serialize character set friendly?

This way the code that allready uses Horde_Serialize::serialize() doesn't have
to be changed and the rest of the code just needs serialize() changed to
Horde_Serialize::serialize(). And it seems pointless to have a serialization
class that we can't use.

- Mike :-)

> ----- Message from jan at horde.org ---------
>     Date: Sat,  8 Feb 2003 15:37:45 +0100
>     From: Jan Schneider <jan at horde.org>
> Reply-To: Jan Schneider <jan at horde.org>
>  Subject: [dev] RFC: array values for preferences
>       To: "dev at lists.horde.org" <dev at lists.horde.org>
> 
> I'm currently trying to fix the problem that serialized arrays getting
> stored in an sql backend may contain invalid characters for the charset that
> the backend use. This problem mainly exists in the category and the
> preferences system.
> 
> But only in the prefs I've found a real problem. To change the least amount
> of code possible I convert the prefs values' charsets in
> retrieve/store/get/set. This doesn't work with serialized arrays because the
> string lenghts might change during a charset conversion, corrupting the
> serialized array.
> 
> The easiest workaround would be to allow the preference system to not only
> accept scalar values but also (unserialized) arrays that get serialized
> automatically.
> 
> This had two consequences:
> 
> - As we don't know the possible structure of the array (it might even be a
> multidimensional one) we had to walk through the array's values and convert
> each them separately. This works fine as long as the value is either in
> ascii (the case with all enum/true-false/numeric preferences we provide) or
> from a user input (where we know the charset he uses). It might get
> problematic if we have preference values from a third source. Do we?
> 
> - We need to automatically unserialize preferences if they match
> /^a:\d:\{.+\}$/ in hope that we don't catch any strange preferences that
> match it too but aren't serialized arrays (unlikely).
> 
> - We need to change every piece of code that deals with serialized arrays as
> a preference and _might_ contain non-ascii characters. Looking at my
> personal prefs this currently seem to be filters, identities, prefbooks,
> rules and eventually portal_layout.
> 
> Btw, noone responded so far to my question how we should deal with login
> data (user names and passwords). Do we have to assume that non-ascii
> characters are allowed and actually used?
> 
> Jan.
> 
> --
> http://www.horde.org - The Horde Project
> http://www.ammma.de - discover your knowledge
> http://www.tip4all.de - Deine private Tippgemeinschaft
> 
> --
> Horde developers mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
> 
> 
> 
> ----- End message from jan at horde.org -----






More information about the dev mailing list