1--TEST--
2DatePeriod: Test cannot modify read only properties
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7
8$period = new DatePeriod(new DateTime, new DateInterval('P1D'), new DateTime);
9
10$properties = [
11    "recurrences",
12    "include_start_date",
13    "start",
14    "current",
15    "end",
16    "interval",
17];
18
19foreach ($properties as $property) {
20    try {
21        $period->$property = "new";
22    } catch (Error $e) {
23        echo $e::class, ': ', $e->getMessage(), "\n";
24    }
25
26    try {
27        $period->$property[] = "extra";
28    } catch (Error $e) {
29        echo $e::class, ': ', $e->getMessage(), "\n";
30    }
31}
32
33try {
34    $period->start->modify("+1 hour");
35} catch (Error $e) {
36    echo $e::class, ': ', $e->getMessage(), "\n";
37}
38
39?>
40--EXPECT--
41Error: Cannot modify readonly property DatePeriod::$recurrences
42Error: Cannot modify readonly property DatePeriod::$recurrences
43Error: Cannot modify readonly property DatePeriod::$include_start_date
44Error: Cannot modify readonly property DatePeriod::$include_start_date
45Error: Cannot modify readonly property DatePeriod::$start
46Error: Cannot modify readonly property DatePeriod::$start
47Error: Cannot modify readonly property DatePeriod::$current
48Error: Cannot modify readonly property DatePeriod::$current
49Error: Cannot modify readonly property DatePeriod::$end
50Error: Cannot modify readonly property DatePeriod::$end
51Error: Cannot modify readonly property DatePeriod::$interval
52Error: Cannot modify readonly property DatePeriod::$interval
53