6.0.0-beta1
7/5/25

[#8130] Serialization issues with PHP 5 objects (Postgres)
Summary Serialization issues with PHP 5 objects (Postgres)
Queue Horde Base
Queue Version HEAD
Type Bug
State Resolved
Priority 3. High
Owners slusarz (at) horde (dot) org
Requester slusarz (at) horde (dot) org
Created 03/31/2009 (5940 days ago)
Due
Updated 11/18/2009 (5708 days ago)
Assigned 04/16/2009 (5924 days ago)
Resolved 11/18/2009 (5708 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
11/18/2009 10:57:59 PM Michael Slusarz Comment #12
State ⇒ Resolved
Reply to this comment
Closing.  I personally have not run into any issues since these 
changes have been made.
04/21/2009 06:28:58 AM CVS Commit Comment #10 Reply to this comment
04/17/2009 06:39:18 AM Michael Slusarz Comment #9 Reply to this comment
Should we be changing TEXT to BLOB for other databases? I see only
the postgres sql scripts were updated.
I have no idea.  Others will have to test on non-postgres DB's.



A simple test is to see if you can create Virtual Folders in IMP 5 and 
they are persistent between sessions.
04/17/2009 04:44:02 AM Chuck Hagenbuch Comment #8 Reply to this comment
Should we be changing TEXT to BLOB for other databases? I see only the 
postgres sql scripts were updated.
04/16/2009 10:35:36 PM Michael Slusarz Comment #7
Summary ⇒ Serialization issues with PHP 5 objects (Postgres)
State ⇒ Assigned
Reply to this comment
For horde_prefs - yes.  But not for other tables that use TEXT fields 
and may contain null chars.
04/16/2009 10:29:13 PM Jan Schneider Comment #6
State ⇒ Feedback
Taken from Horde DevelopersHorde Developers
Assigned to Michael Slusarz
Reply to this comment
Is this fixed now with your commits?
04/13/2009 08:27:49 PM CVS Commit Comment #5 Reply to this comment
04/09/2009 08:24:56 PM Michael Slusarz Comment #3
Summary ⇒ Serialization issues with PHP 5 objectss,
Reply to this comment
For Postgres (8.0+), this command will work to convert existing tables:

alter TABLE horde_prefs ALTER COLUMN pref_value TYPE BYTEA USING 
decode(replace(pref_value, E'\\', E'\\\\'), 'escape');
03/31/2009 03:15:00 AM Michael Slusarz Comment #2 Reply to this comment
Remembered that you can't use base64/json encoding if the data is an 
object.  Only can use serialize for that.



Verified that doing:

json_encode(serialize($foo))



will correctly save data with null characters.
03/31/2009 01:18:40 AM Michael Slusarz Comment #1
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Serialization issues with PHP 5 objects
Queue ⇒ Horde Base
Assigned to Horde DevelopersHorde Developers
Milestone ⇒
Patch ⇒ No
State ⇒ Assigned
Reply to this comment
Using serialize() on a PHP 5 object is troublesome, since the 
representation of objects containing private/protected member 
variables includes null characters.  These NULL characters will 
truncate database insertion - at least using Postgres 8.3 in TEXT 
data.  We use TEXT data for things like prefs, sessionhandler, cache, 
and vfs.



See:

http://bugs.php.net/bug.php?id=29865

and

http://bugs.php.net/bug.php?id=45244

where the PHP folks claim this isn't a bug.



Possible solutions: vfs, sessionhandler, and cache should probably use 
binary data (BYTEA on postgres).  Not so sure about prefs, so we might 
need a different storage solution there (base64/json).

Saved Queries