xref: /PHP-8.0/ext/date/tests/bug67118_2.phpt (revision ded3d984)
1--TEST--
2Regression introduce in fix for Bug #67118 - Invalid code
3--INI--
4date.timezone=Europe/Paris
5--FILE--
6<?php
7class Foo extends DateTime {
8    public function __construct($time = null) {
9        $tz = new DateTimeZone('UTC');
10        try {
11            echo "First try\n";
12            parent::__construct($time, $tz);
13            return;
14        } catch (Exception $e) {
15            echo "Second try\n";
16            parent::__construct($time.'C', $tz);
17        }
18    }
19}
20$date = '12 Sep 2007 15:49:12 UT';
21var_dump(new Foo($date));
22?>
23Done
24--EXPECT--
25First try
26Second try
27object(Foo)#1 (3) {
28  ["date"]=>
29  string(26) "2007-09-12 15:49:12.000000"
30  ["timezone_type"]=>
31  int(3)
32  ["timezone"]=>
33  string(3) "UTC"
34}
35Done
36