1--TEST--
2DateInterval with bad format should not leak period
3--FILE--
4<?php
5
6try {
7    new DateInterval('P3"D');
8} catch (Exception $e) {
9    echo $e::class, ': ', $e->getMessage(), "\n";
10}
11
12try {
13    new DatePeriod('P3"D');
14} catch (Exception $e) {
15    echo $e::class, ': ', $e->getMessage(), "\n";
16}
17
18try {
19    DatePeriod::createFromISO8601String('P3"D');
20} catch (Exception $e) {
21    echo $e::class, ': ', $e->getMessage(), "\n";
22}
23
24try {
25    new DatePeriod('2008-03-01T12:00:00Z1');
26} catch (Exception $e) {
27    echo $e::class, ': ', $e->getMessage(), "\n";
28}
29
30try {
31    DatePeriod::createFromISO8601String('2008-03-01T12:00:00Z1');
32} catch (Exception $e) {
33    echo $e::class, ': ', $e->getMessage(), "\n";
34}
35
36?>
37--EXPECTF--
38DateMalformedIntervalStringException: Unknown or bad format (P3"D)
39
40Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
41DateMalformedPeriodStringException: Unknown or bad format (P3"D)
42DateMalformedPeriodStringException: Unknown or bad format (P3"D)
43
44Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
45DateMalformedPeriodStringException: Unknown or bad format (2008-03-01T12:00:00Z1)
46DateMalformedPeriodStringException: Unknown or bad format (2008-03-01T12:00:00Z1)
47