File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 44- Added public interface IPhpObject
55- Added public class PhpObjectDictionary (implementing IPhpObject).
66- Added public class PhpDynamicObject (implementing IPhpObject)
7+ - Added PhpDateTime to avoid conflicts with System.DateTime.
78
89With IPhpObjects, you can get the class name specified in the serialized data via ` GetClassName() ` .
910
11+ ** Known issues:**
12+ - Can not deserialize dynamic objects.
13+
1014# 0.5.1
1115
1216- Fixed misleading exception message on malformed objects.
1317- Fixed valid classnames being rejected as malformed.
1418- Fixed type-lookup logic trying to deserialize with ` null ` Type information.
1519
1620Known issues:
17- - Objects with classname ` DateTime ` will fail to deserialize, unless the option ` EnableTypeLookup ` is set to ` false ` .
21+ - ~~ Objects with classname ` DateTime ` will fail to deserialize, unless the option ` EnableTypeLookup ` is set to ` false ` .~~ (fixed since)
1822
1923# 0.5.0
2024
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ namespace PhpSerializerNET {
1515 internal class PhpDeserializer {
1616 private PhpDeserializationOptions _options ;
1717 private List < PhpSerializeToken > _tokens ;
18- private static Dictionary < string , Type > TypeLookupCache = new ( ) ;
18+ private static Dictionary < string , Type > TypeLookupCache = new ( ) {
19+ { "DateTime" , typeof ( PhpDateTime ) }
20+ } ;
1921
2022 public PhpDeserializer ( string input , PhpDeserializationOptions options ) {
2123 this . _options = options ;
Original file line number Diff line number Diff line change 1+ /**
2+ This Source Code Form is subject to the terms of the Mozilla Public
3+ License, v. 2.0. If a copy of the MPL was not distributed with this
4+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
5+ **/
6+
7+ namespace PhpSerializerNET {
8+
9+ [ PhpClass ( "DateTime" ) ]
10+ public class PhpDateTime : IPhpObject {
11+ [ PhpProperty ( "date" ) ]
12+ public string Date { get ; set ; }
13+
14+ [ PhpProperty ( "timezone_type" ) ]
15+ public int TimezoneType { get ; set ; }
16+
17+ [ PhpProperty ( "timezone" ) ]
18+ public string Timezone { get ; set ; }
19+
20+ public string GetClassName ( ) {
21+ return "DateTime" ;
22+ }
23+
24+ public void SetClassName ( string className ) {
25+ // Nothing to do.
26+ }
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments