xref: /PHP-7.2/ext/date/tests/bug65672.phpt (revision 8b53c723)
1--TEST--
2Test for bug #65672: Broken classes inherited from DatePeriod
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7
8$interval = new DateInterval('P1D');
9$period = new class(new DateTime, $interval, new DateTime) extends DatePeriod {
10    public $extra = "stuff";
11};
12
13var_dump($period->extra);
14$period->extra = "modified";
15var_dump($period->extra);
16
17# Ensure we can modify properties (retrieve for write)
18$period->extra = [];
19$period->extra[] = "array";
20var_dump($period->extra);
21
22var_dump(isset($period->dynamic1));
23$period->dynamic1 = "dynamic";
24var_dump($period->dynamic1);
25
26# Ensure we can modify properties (retrieve for write)
27$period->dynamic2 = [];
28$period->dynamic2[] = "array";
29var_dump($period->dynamic2);
30
31?>
32--EXPECT--
33string(5) "stuff"
34string(8) "modified"
35array(1) {
36  [0]=>
37  string(5) "array"
38}
39bool(false)
40string(7) "dynamic"
41array(1) {
42  [0]=>
43  string(5) "array"
44}
45