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->getMessage() . "\n"; 24 } 25 26 try { 27 $period->$property[] = "extra"; 28 } catch (Error $e) { 29 echo $e->getMessage() . "\n"; 30 } 31} 32 33try { 34 $period->start->modify("+1 hour"); 35} catch (Error $e) { 36 echo $e->getMessage() . "\n"; 37} 38 39?> 40--EXPECT-- 41Cannot modify readonly property DatePeriod::$recurrences 42Cannot modify readonly property DatePeriod::$recurrences 43Cannot modify readonly property DatePeriod::$include_start_date 44Cannot modify readonly property DatePeriod::$include_start_date 45Cannot modify readonly property DatePeriod::$start 46Cannot modify readonly property DatePeriod::$start 47Cannot modify readonly property DatePeriod::$current 48Cannot modify readonly property DatePeriod::$current 49Cannot modify readonly property DatePeriod::$end 50Cannot modify readonly property DatePeriod::$end 51Cannot modify readonly property DatePeriod::$interval 52Cannot modify readonly property DatePeriod::$interval 53