[wp-hackers] How do you store multiple plugin options

Otto otto at ottodestruct.com
Wed Mar 24 19:43:48 UTC 2010


On Wed, Mar 24, 2010 at 2:34 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> ...it will corrupt the data from PHP's unserialize perspective because the string lengths will no longer be correct.
>
> Is there some other way to update PHP Serialized arrays directly in MySQL that I do not know about?

No, you just don't have to care about that. Unserializing an array
with a wrong string length generates a Notice error, but the
unserialize is still successful. And the maybe_unserialize() function
suppresses errors on the call to unserialize. So it'll still work and
the string size will get fixed the next time the option is updated.

-Otto


More information about the wp-hackers mailing list