peachpie
peachpie copied to clipboard
PHP serializer to serialize IDictionary and IList
IDictionary and IList are well-known CLR types that should be handled by PHP serialization (php, and json) in order to provide better interoperability with CLR languages.
<?php
$obj = new \System\Collections\Generic\Dictionary<int, string>(); // passed from C# code usually
echo serialize( $obj );
Currently, it serializes the dictionary as any other PHP-like object; which fails sooner or later (weird properties, weird fields, cannot deserialize properly).
Expected: serialize IDictionary and IList as a PHP array.
- [ ] json_encode() for IList
- [x] json_encode() for IDictionary
- [ ] serialize() for IList
- [ ] serialize() for IDictionary