6.0.0-git
2021-01-18

[#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 2009-03-31 (4311 days ago)
Due
Updated 2009-11-18 (4079 days ago)
Assigned 2009-04-16 (4295 days ago)
Resolved 2009-11-18 (4079 days ago)
Milestone
Patch No

History
2009-11-18 22:57:59 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.
2009-04-21 06:28:58 CVS Commit Comment #10 Reply to this comment
2009-04-17 06:39:18 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.
2009-04-17 04:44:02 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.
2009-04-16 22:35:36 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.
2009-04-16 22:29:13 Jan Schneider Comment #6
Assigned to Michael Slusarz
Taken from Horde DevelopersHorde Developers
State ⇒ Feedback
Reply to this comment
Is this fixed now with your commits?
2009-04-13 20:27:49 CVS Commit Comment #5 Reply to this comment
2009-04-09 20:24:56 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');
2009-03-31 03:15:00 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.
2009-03-31 01:18:40 Michael Slusarz Comment #1
Type ⇒ Bug
State ⇒ Assigned
Priority ⇒ 3. High
Summary ⇒ Serialization issues with PHP 5 objects
Queue ⇒ Horde Base
Assigned to Horde DevelopersHorde Developers
Milestone ⇒
Patch ⇒ No
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