Repository navigation
v0.2.0
What's Changed
Bug Fix: Array/Object Reference Resolution
The igbinary decoder previously discarded TypeArrayRef and TypeObjectRef back-reference IDs, always returning nil. This caused PHP values that share the same underlying zval (via copy-on-write semantics) to decode as nil in Go.
Root cause: When PHP assigns the same array to multiple keys without modification, igbinary serializes the first occurrence as a full array and subsequent occurrences as back-references (TypeArrayRef). The Go decoder was reading but discarding these reference IDs.
Changes
- Added a compound value reference table (
values []any) to the decoder's reader struct - Arrays and objects are registered in the table before populating their contents (supports circular references)
decodeRefnow resolves references by looking up the table index instead of returningnil- Added
ErrValueRefOutOfRangesentinel error for invalid reference IDs - Updated and added comprehensive tests for reference resolution scenarios
- Bumped Go version to 1.26.0
Impact
This fix affects any PHP data where the same array or object is assigned to multiple locations within a single igbinary-serialized blob. All such cases are now correctly resolved.