Releases: StringEpsilon/PhpSerializerNET
0.10.0
Breaking:
- Trying to set the classname on PhpDateTime will throw an exception now instead of doing nothing.
- Behavior of the option
EmptyStringToDefault
changed:- And empty string will now result in
default(string)
(which is null) instead of an empty string. - For some target types, the return value might have changed due to better checks for the proper default value.
- And empty string will now result in
Beware: The option EmptyStringToDefault is enabled by default.
Regular changes:
Deserialization:
- Added support for
Nullable<>
- Added
PhpSerializerNET.ClearTypeCache()
- Added
TypeCache
deserialization option- Allows to disable the classname type cache. (enabled by default)
- Allows to enable a property information cache. (disabled by default)
- Added
PhpSerializerNET.ClearPropertyInfoCache()
- When converting to an enum member that is not known a better exception is thrown instead of a nullref (because the fieldinfo cannot be found)
- Added support for arrays
Serialization:
- Added support for serializing
PhpDynamicObject
andExpandoObject
. - Always serialize implementations of
IPhpObject
using object notation.
This is technically a breaking change, but it was always intended to work that way.
Thanks
Thank you very much @sommmen for helping out with this version and for patching up the EmptyStringToDefault and option adding Nullable support.
Plan for 1.0
Plan is to release this version as 1.0 before the new year with no added features or breaking changes. Just bugfixes, should they be needed. Will also need to finish the documentation.
0.9.0
Breaking:
- Targeting net6.0
Semi breaking:
- Type lookup: Now negative lookup results are also cached.
- This may also lead to undeseriable results when adding classes and structs at runtime.
- May increase the memory footprint over time faster than before.
- On the upside: It is significantly faster when dealing with objects where automapping doesn't work without having to disable the feature entirely.
- Different exception (System.ArgumentException) on empty input for
PhpSerialization.Deserialize<T>()
Regular changes:
- Rewrote the parsing and validation logic, which results in different exception messages in many cases.
- Parsing: A very slight performance gain for some deserialization workloads.
- Object / struct creation: Improved performance.
- General: Reduced amount of memory allocated while deserializing.
- Fixed exception message for non-integer keys in lists.
- Fixed exception message for failed field / property assignments / binding.
0.8.0
- Improved performance of the validation step of deserialization.
- Speed up deserializing into explicit types (particularly structs and classes) significantly.
- Speed up serialization, especially when using attribute annotated classes and structs.
- Improved exception messages on malformed inputs when deserializing.
- Cleaner exception when trying to deserialize into incompatible types (i.e. "a" to int32.).
0.7.4
- Improved deserialization performance.
- Fixed invalid output when using PhpSerializiationOptions.NumericEnums = false
I did not extensively benchmark the performance improvements, but in a very simple test (de-serializing into dictionaries and lists) I saw execution times cut in half or better over 10000 iterations on a 500 byte input.
# 0.7.3:
0.7.2
- Added
EmptyStringToDefault
deserialization option, defaults to true.- When true, empty strings will be deserialized into the default value of the target IConvertible.
For examples:0:"";
deserialized to an integer yields0
.
See issue #13 for details.
- When true, empty strings will be deserialized into the default value of the target IConvertible.
- Fixed a regression introduced in 0.7.1 where some data would no longer parse correctly (#12) due to improper handling of array brackets.
# 0.7.1
0.7.0
- Support de/serialization of enums
- Added serialization option
NumericEnums
:
Whether or not to serialize enums as integer values
Defaults to true. If set to false, the enum.ToString() representation will be used.
Note: I forgot to actually add the release on GitHub. 0.7.0 was published on Nuget.org 2021-10-11. Sorry about that.
0.6.0
- Allow more (valid) characters in object class names.
- Added public interface IPhpObject
- Added public class PhpObjectDictionary (implementing IPhpObject).
- This replaces
IDictionary<string, object>
as the default deserialization target of objects.
- This replaces
- Added public class PhpDynamicObject (implementing IPhpObject)
- Added PhpDateTime to avoid conflicts with System.DateTime.
With IPhpObjects, you can get the class name specified in the serialized data via GetClassName()
.
0.5.1
0.5.1
- Fixed misleading exception message on malformed objects.
- Fixed valid classnames being rejected as malformed.
- Fixed type-lookup logic trying to deserialize with
null
Type information.
Known issues:
- Objects with classname
DateTime
will fail to deserialize, unless the optionEnableTypeLookup
is set tofalse
.