xref: /PHP-7.3/ext/date/tests/bug54316.phpt (revision fdb2709d)
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--EXPECT--
13object(DateTime)#1 (3) {
14  ["date"]=>
15  string(26) "2011-02-02 00:00:00.000000"
16  ["timezone_type"]=>
17  int(3)
18  ["timezone"]=>
19  string(3) "UTC"
20}
21object(DateTime)#2 (3) {
22  ["date"]=>
23  string(26) "1970-01-01 00:00:00.000000"
24  ["timezone_type"]=>
25  int(3)
26  ["timezone"]=>
27  string(3) "UTC"
28}
29