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() {
23
23
) ;
24
24
}
25
25
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
+
26
36
[ Fact ]
27
37
public void SerializesToSpecificClass ( ) {
28
38
var testObject = new NamedClass ( ) {
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ private object MakeClass(in PhpToken token) {
297
297
var result = new PhpObjectDictionary ( token . Length , typeName ) ;
298
298
result . SetClassName ( typeName ) ;
299
299
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 ( ) ) ;
301
301
}
302
302
303
303
return result ;
You can’t perform that action at this time.
0 commit comments