<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>Problems with serialized arrays stored in a MySQL DB</title> 
  <pubDate>Fri, 10 Apr 2026 01:05:01 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/9263</link> 
  <atom:link rel="self" type="application/rss+xml" title="Problems with serialized arrays stored in a MySQL DB" href="https://bugs.horde.org/ticket/9263/rss" /> 
  <description>Problems with serialized arrays stored in a MySQL DB</description> 
 
   
   
  <item> 
   <title>Our production horde system is running with PHP 5.2.13 with </title> 
   <description>Our production horde system is running with PHP 5.2.13 with MySQL 5.0.67 (OpenSUSE 11.1). The development system has PHP 5.3.3 and the MySQL on the DB server is 5.1.46 (both OpenSUSE 11.3). I&#039;ve created a utf8 dumpfile of the old database with phpmyadmin, changed the CHARSET to utf8 and imported it on the new DB server.

If I now login to the development horde, the identities aren&#039;t displayed at all. The reason for this is the php unserialize function, which reports an error at offset... It complains about the string length of &quot;Standardidentität&quot;, which was previously 17 and now with utf8 it is 18. In the manual of unserialize at php.net (http://www.php.net/manual/de/function.unserialize.php#75773) there are a couple of comments for this issue and I was able to fix to the wrong string length for the utf8 thing with php&#039;s preg_replace function.

But the identities are still not displayed for those users, which have a signature or some alias adresses, e.g. configured. There are several occurrences of &quot;\r\n&quot; in my dumpfilere. If I apply my preg_replace function on a serialized array returned by MySQL, the result differs from applying the function to the accordant line on my dumpfile. E.g. the strlen functions reports a string length of 495 for my signature fetched from the database, but according to my dumpfile, the string length of my signature is 527. This results again in an error at offset.. reported by unserialize.

Is there any documented way on how I could first migrate the db from latin1 to utf8 as well as having all these serialized arrays beeing transformed, so that they are still usable?</description> 
   <pubDate>Mon, 20 Sep 2010 16:24:19 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9263#t60064</link> 
  </item> 
   
  <item> 
   <title>Please use the mailing list to ask for support.

http://ww</title> 
   <description>Please use the mailing list to ask for support.

http://www.horde.org/mail/ contains a list of all available mailing lists.</description> 
   <pubDate>Tue, 21 Sep 2010 14:16:37 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9263#t60069</link> 
  </item> 
   
  <item> 
   <title>Dear Jan,

I&#039;ve added something like
$string = preg_repla</title> 
   <description>Dear Jan,

I&#039;ve added something like
$string = preg_replace(&#039;!s:(\d+):&quot;(.*?)&quot;;!se&#039;, &quot;&#039;s:&#039;.strlen(&#039;$2&#039;).&#039;:\&quot;$2\&quot;;&#039;&quot;, $string);

before each occurence of unseralize in Horde&#039;s code. Now each serialized array gets correctly unserialized.

Wouldn&#039;t it be possible to add a helper function horde_unserialize as a wrapper for the php unserialize function which does sanitize the returned serialized arrays from the database tables? I&#039;m wondering why no other people out there were running into this issue if they use opensuse.

Best regards,
Steffen</description> 
   <pubDate>Tue, 19 Oct 2010 10:39:45 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9263#t60435</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
