File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
PhpSerializerNET.Test/Serialize
PhpSerializerNET/Deserialization Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,16 @@ public void SerializesToStdClass() {
2323 ) ;
2424 }
2525
26+ [ Fact ]
27+ public void HandlesIntegerKeys ( ) {
28+ // https://github.com/StringEpsilon/PhpSerializerNET/issues/43
29+ var result = ( PhpObjectDictionary ) PhpSerialization . Deserialize (
30+ """O:3:"foo":1:{i:0;s:7:"QG3GHPX";}""" ,
31+ new ( ) { EnableTypeLookup = false }
32+ ) ;
33+ Assert . Equal ( "QG3GHPX" , result [ "0" ] ) ;
34+ }
35+
2636 [ Fact ]
2737 public void SerializesToSpecificClass ( ) {
2838 var testObject = new NamedClass ( ) {
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ private object MakeClass(in PhpToken token) {
297297 var result = new PhpObjectDictionary ( token . Length , typeName ) ;
298298 result . SetClassName ( typeName ) ;
299299 for ( int i = 0 ; i < token . Length ; i ++ ) {
300- result . TryAdd ( ( string ) this . Next ( ) , this . Next ( ) ) ;
300+ result . TryAdd ( ( string ) this . Next ( typeof ( string ) ) , this . Next ( ) ) ;
301301 }
302302
303303 return result ;
You can’t perform that action at this time.
0 commit comments