1--TEST-- 2Test bad ISO date formats passed to DatePeriod constructor 3--FILE-- 4<?php 5 6try { 7 new DatePeriod("R4"); 8} catch (Exception $e) { 9 echo $e::class, ': ', $e->getMessage(), "\n"; 10} 11 12try { 13 DatePeriod::createFromISO8601String("R4"); 14} catch (Exception $e) { 15 echo $e::class, ': ', $e->getMessage(), "\n"; 16} 17 18try { 19 new DatePeriod("R4/2012-07-01T00:00:00Z"); 20} catch (Exception $e) { 21 echo $e::class, ': ', $e->getMessage(), "\n"; 22} 23 24try { 25 DatePeriod::createFromISO8601String("R4/2012-07-01T00:00:00Z"); 26} catch (Exception $e) { 27 echo $e::class, ': ', $e->getMessage(), "\n"; 28} 29 30try { 31 new DatePeriod("2012-07-01T00:00:00Z/P7D"); 32} catch (Exception $e) { 33 echo $e::class, ': ', $e->getMessage(), "\n"; 34} 35 36try { 37 DatePeriod::createFromISO8601String("2012-07-01T00:00:00Z/P7D"); 38} catch (Exception $e) { 39 echo $e::class, ': ', $e->getMessage(), "\n"; 40} 41 42?> 43--EXPECT-- 44DateMalformedPeriodStringException: DatePeriod::__construct(): ISO interval must contain a start date, "R4" given 45DateMalformedPeriodStringException: DatePeriod::createFromISO8601String(): ISO interval must contain a start date, "R4" given 46DateMalformedPeriodStringException: DatePeriod::__construct(): ISO interval must contain an interval, "R4/2012-07-01T00:00:00Z" given 47DateMalformedPeriodStringException: DatePeriod::createFromISO8601String(): ISO interval must contain an interval, "R4/2012-07-01T00:00:00Z" given 48DateMalformedPeriodStringException: DatePeriod::__construct(): Recurrence count must be greater than 0 49DateMalformedPeriodStringException: DatePeriod::createFromISO8601String(): Recurrence count must be greater than 0 50