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 4
4
- Added public interface IPhpObject
5
5
- Added public class PhpObjectDictionary (implementing IPhpObject).
6
6
- Added public class PhpDynamicObject (implementing IPhpObject)
7
+ - Added PhpDateTime to avoid conflicts with System.DateTime.
7
8
8
9
With IPhpObjects, you can get the class name specified in the serialized data via ` GetClassName() ` .
9
10
11
+ ** Known issues:**
12
+ - Can not deserialize dynamic objects.
13
+
10
14
# 0.5.1
11
15
12
16
- Fixed misleading exception message on malformed objects.
13
17
- Fixed valid classnames being rejected as malformed.
14
18
- Fixed type-lookup logic trying to deserialize with ` null ` Type information.
15
19
16
20
Known 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)
18
22
19
23
# 0.5.0
20
24
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ namespace PhpSerializerNET {
15
15
internal class PhpDeserializer {
16
16
private PhpDeserializationOptions _options ;
17
17
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
+ } ;
19
21
20
22
public PhpDeserializer ( string input , PhpDeserializationOptions options ) {
21
23
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