xref: /PHP-8.1/ext/date/tests/bug48678.phpt (revision 7aacc705)
1--TEST--
2Bug #48678 (DateInterval segfaults when unserialising)
3--FILE--
4<?php
5$x = new DateInterval("P3Y6M4DT12H30M5S");
6print_r($x);
7$y = unserialize(serialize($x));
8print_r($y);
9?>
10--EXPECT--
11DateInterval Object
12(
13    [y] => 3
14    [m] => 6
15    [d] => 4
16    [h] => 12
17    [i] => 30
18    [s] => 5
19    [f] => 0
20    [weekday] => 0
21    [weekday_behavior] => 0
22    [first_last_day_of] => 0
23    [invert] => 0
24    [days] =>
25    [special_type] => 0
26    [special_amount] => 0
27    [have_weekday_relative] => 0
28    [have_special_relative] => 0
29)
30DateInterval Object
31(
32    [y] => 3
33    [m] => 6
34    [d] => 4
35    [h] => 12
36    [i] => 30
37    [s] => 5
38    [f] => 0
39    [weekday] => 0
40    [weekday_behavior] => 0
41    [first_last_day_of] => 0
42    [invert] => 0
43    [days] =>
44    [special_type] => 0
45    [special_amount] => 0
46    [have_weekday_relative] => 0
47    [have_special_relative] => 0
48)
49