Skip to content

Refactor unserialize calls to use _unserializeState#25

Open
TDannhauer wants to merge 1 commit intoFRAMEWORK_6_0from
fix/erroneous_data_format_unserializing
Open

Refactor unserialize calls to use _unserializeState#25
TDannhauer wants to merge 1 commit intoFRAMEWORK_6_0from
fix/erroneous_data_format_unserializing

Conversation

@TDannhauer
Copy link
Copy Markdown
Contributor

Fixes erroneous data format for unserializing 'Horde_ActiveSync_Folder_Collection'

Fixes erroneous data format for unserializing 'Horde_ActiveSync_Folder_Collection'
@TDannhauer TDannhauer requested a review from ralflang March 31, 2026 21:50
@TDannhauer
Copy link
Copy Markdown
Contributor Author

What was going wrong
Those messages come from PHP’s unserialize() when it rejects the binary blob in horde_activesync_state (and related fields) before Horde’s own Horde_ActiveSync_Folder_*::unserialize() runs. Typical causes after an ActiveSync/Horde/PHP upgrade:

Stricter parsing in PHP 8.3+ (you’re on 8.4) — length/format checks are tighter.
Old state in the DB — blobs written with an older Horde or PHP serialization shape no longer match the current Serializable (C:) layout, so you get errors like “Erroneous data format for unserializing …” and “Error at offset …”.
Horde_ActiveSync_State_Sql::_loadStateFromResults() already treats unserialize() returning false as “no saved folder state” and rebuilds Horde_ActiveSync_Folder_Collection / Horde_ActiveSync_Folder_Imap as needed. So behaviour was mostly OK, but PHP still emitted warnings, and Horde logged them.

What we changed
A small helper _unserializeState() was added so those warnings are not passed through to Horde’s logger. All relevant unserialize() calls in that file now use it. Corrupt device rows in updateServerIdInState are skipped instead of fatalling. Device supported / properties fall back to [] if the blob is bad (same idea as an empty device).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant