StringEpsilon / PhpSerializerNET

A .NET library for working with the PHP serialization format

Repository from Github https://github.comStringEpsilon/PhpSerializerNETRepository from Github https://github.comStringEpsilon/PhpSerializerNET

Enhancement: Better target type validation

sommmen opened this issue · comments

Hiya,

I just ran into an issue where i tried to assign an array of strings to a string. This caused a weird error in MakeObject() because it was trying to construct a string.

a:1:{i:0;s:1:"a";}

To string.

Anyhow i spent some time what the issue was (from a lib consumer pov) and then found out the target type was just wrong. I feel like we can improve the validation a bit in this regard, where if i get a php array string and try to assign it to a string or int or w/e i get a specialized exception rather than something vague. (in this case it tried to construct the string in .MakeObject() which it can't.