@@ -5,6 +5,7 @@ date.timezone=UTC
5
5
--FILE--
6
6
<?php
7
7
$ now = new DateTimeImmutable ();
8
+ $ simpleInterval = new DateInterval ("P2D " );
8
9
9
10
$ date = (new ReflectionClass (DateTime::class))->newInstanceWithoutConstructor ();
10
11
try {
20
21
echo get_class ($ e ), ': ' , $ e ->getMessage (), "\n" ;
21
22
}
22
23
24
+ $ date = (new ReflectionClass (DateTime::class))->newInstanceWithoutConstructor ();
25
+ $ dateperiod = (new ReflectionClass (DatePeriod::class))->newInstanceWithoutConstructor ();
26
+ $ dateinterval = (new ReflectionClass (DateInterval::class))->newInstanceWithoutConstructor ();
27
+ try {
28
+ $ dateperiod ->__unserialize (['start ' => $ date ]);
29
+ } catch (Error $ e ) {
30
+ echo get_class ($ e ), ': ' , $ e ->getMessage (), "\n" ;
31
+ }
32
+
33
+ try {
34
+ $ dateperiod ->__unserialize (['start ' => $ now , 'end ' => $ date ]);
35
+ } catch (Error $ e ) {
36
+ echo get_class ($ e ), ': ' , $ e ->getMessage (), "\n" ;
37
+ }
38
+
39
+ try {
40
+ $ dateperiod ->__unserialize (['start ' => $ now , 'end ' => $ now , 'current ' => $ date ]);
41
+ } catch (Error $ e ) {
42
+ echo get_class ($ e ), ': ' , $ e ->getMessage (), "\n" ;
43
+ }
44
+
45
+ try {
46
+ $ dateperiod ->__unserialize (['start ' => $ now , 'end ' => $ now , 'current ' => $ now , 'interval ' => $ dateinterval ]);
47
+ } catch (Error $ e ) {
48
+ echo get_class ($ e ), ': ' , $ e ->getMessage (), "\n" ;
49
+ }
50
+
51
+ try {
52
+ $ dateperiod ->__unserialize ([
53
+ 'start ' => $ now , 'end ' => $ now , 'current ' => $ now , 'interval ' => $ simpleInterval ,
54
+ 'recurrences ' => 2 , 'include_start_date ' => true , 'include_end_date ' => true ,
55
+ ]);
56
+ echo "DatePeriod::__unserialize: SUCCESS \n" ;
57
+ } catch (Error $ e ) {
58
+ echo get_class ($ e ), ': ' , $ e ->getMessage (), "\n" ;
59
+ }
23
60
echo "OK \n" ;
24
61
?>
25
62
--EXPECT--
26
63
Error: The DateTimeInterface object has not been correctly initialized by its constructor
27
64
Error: The DateTimeInterface object has not been correctly initialized by its constructor
65
+ Error: Invalid serialization data for DatePeriod object
66
+ Error: Invalid serialization data for DatePeriod object
67
+ Error: Invalid serialization data for DatePeriod object
68
+ Error: Invalid serialization data for DatePeriod object
69
+ DatePeriod::__unserialize: SUCCESS
28
70
OK
0 commit comments