com php-src: Added a test case for (docs) bug #74652: ext/date/tests/bug74652.phpt
[email protected] (Derick Rethans)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: fc87715950be84564a8778fefb0b4b7aa7cefd5e Author: Derick Rethans <[email protected]> Thu, 25 May 2017 10:57:09 -0400 Parents: e7a706502475872928848f6606390eb77d274fdf Branches: PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fc87715950be84564a8778fefb0b4b7aa7cefd5e Log: Added a test case for (docs) bug #74652 Bugs: https://bugs.php.net/74652 Changed paths: A ext/date/tests/bug74652.phpt Diff: diff --git a/ext/date/tests/bug74652.phpt b/ext/date/tests/bug74652.phpt new file mode 100644 index 0000000..029464b --- /dev/null +++ b/ext/date/tests/bug74652.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test for bug #74652: Incomplete dates +--INI-- +date.timezone=UTC +--FILE-- +<?php +$formats = [ + '2017-03-25 10:52:09', + '2017-03-25 10:52', + '2017-03-25 10am', + '2017-03-25', + '2017-03', + '2017.042', + '2017043', +]; + +foreach ( $formats as $format ) +{ + $dt = new DateTimeImmutable( $format ); + echo $dt->format( 'Y-m-d H:i:s' ), "\n"; +} +?> +--EXPECT-- +2017-03-25 10:52:09 +2017-03-25 10:52:00 +2017-03-25 10:00:00 +2017-03-25 00:00:00 +2017-03-01 00:00:00 +2017-02-11 00:00:00 +2017-02-12 00:00:00