6.0.0-beta1
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
11/7/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#10245] Identities values disappear after an upgrade from H3
*
Your Email Address
*
Spam protection
Enter the letters below:
.___.___.. . . __ [__ | |_/ |/ ` | | | \\__|\__.
Comment
> In fact, i have a problem with encoding. Before migration, as > recommended, i'm converting the database from latin1 to utf8 like > this : > > iconv -f LATIN1 -t UTF-8 horde3.sql > horde3_UTF8.sql > sed -e 's/CHARSET=latin1/CHARSET=utf8/g' -i horde3_UTF8.sql > mysql --user=root -p --execute="DROP DATABASE horde; CREATE DATABASE > horde CHARACTER SET utf8 COLLATE utf8_general_ci;" > mysql --user=root --max_allowed_packet=16M -p > --default-character-set=utf8 horde < horde3_UTF8.sql > > horde-db-migrate .... > > I put some hooks in > /usr/share/php/Horde/Core/Prefs/Storage/Upgrade.php for debugging. > The systemlogintask is running and i get this error : > > HORDE [imp] PHP ERROR: unserialize() [<a > href='function.unserialize'>function.unserialize</a>]: Error at > offset 49 of 935 bytes [pid 17296 on line 64 of > "/usr/share/php/Horde/Core/Prefs/Storage/Upgrade.php"] > > corresponding to the code : > > if (($data = unserialize($data)) !== false) { ..... > > Apply this code (not all shown) : > > mysql_query("SET NAMES 'utf8'"); > $query = "SELECT pref_uid, pref_value FROM horde_prefs WHERE > pref_scope LIKE 'horde' AND `pref_name` LIKE 'identities'"; > > while ($row = mysql_fetch_array($result)) { > echo $row['pref_value']; > echo "\n--------------\n"; > $unserialized = preg_replace('!s:(\d+):"(.*?)";!se', > "'s:'.strlen('$2').':\"$2\";'", $row['pref_value'] ); > $data = unserialize($unserialized); > $pref_uid = $row['pref_uid']; > > $new_data=array(); > foreach ($data as $key => $val) > { > foreach ($data[$key] as $id => $value) { > $new_data[$key][$id] = $value ; > } > } > > $new_data_serial = serialize($new_data); > > $query = sprintf("UPDATE horde_prefs SET > `horde_prefs`.`pref_value` = '%s' WHERE `horde_prefs`.`pref_uid` LIKE > '$pref_uid' AND `horde_prefs`.`pref_scope` LIKE 'horde' AND > `horde_prefs`.`pref_name` LIKE 'identities'", > mysql_real_escape_string($new_data_serial)); > > $result2 = mysql_query($query); > } > > And it works. > > I don't know where is the mistake. > > Thanks.
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers