1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00
Files
archived-php-src/ext/date/tests/date_interval_bad_format_leak.phpt
T
Nikita Popov 472fc3a2a9 Fix leak in DatePeriod construction with invalid format
Same issue as I fixed in DateInterval construction before.
2020-01-30 11:13:04 +01:00

22 lines
418 B
PHP

--TEST--
DateInterval with bad format should not leak period
--FILE--
<?php
try {
$interval = new DateInterval('P3"D');
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
try {
$perid = new DatePeriod('P3"D');
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
DateInterval::__construct(): Unknown or bad format (P3"D)
DatePeriod::__construct(): Unknown or bad format (P3"D)