xref: /PHP-8.1/ext/date/tests/bug54316.phpt (revision 7aacc705)
1--TEST--
2Bug #54316 (DateTime::createFromFormat does not handle trailing '|' correctly)
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7$dt = DateTime::createFromFormat('Y-m-d|', '2011-02-02');
8var_dump($dt);
9
10$dt = DateTime::createFromFormat('Y-m-d!', '2011-02-02');
11var_dump($dt);
12?>
13--EXPECT--
14object(DateTime)#1 (3) {
15  ["date"]=>
16  string(26) "2011-02-02 00:00:00.000000"
17  ["timezone_type"]=>
18  int(3)
19  ["timezone"]=>
20  string(3) "UTC"
21}
22object(DateTime)#2 (3) {
23  ["date"]=>
24  string(26) "1970-01-01 00:00:00.000000"
25  ["timezone_type"]=>
26  int(3)
27  ["timezone"]=>
28  string(3) "UTC"
29}
30