xref: /PHP-7.1/ext/date/tests/bug67118.phpt (revision 113213f0)
1--TEST--
2Bug #67118 crashes in DateTime when this used after failed __construct
3--INI--
4date.timezone=Europe/Berlin
5--FILE--
6<?php
7class mydt extends datetime
8{
9	public function __construct($time = 'now', $tz = NULL, $format = NULL)
10	{
11		if (!empty($tz) && !is_object($tz)) {
12			$tz = new DateTimeZone($tz);
13		}
14		try {
15			@parent::__construct($time, $tz);
16		} catch (Exception $e) {
17			echo "Bad date" . $this->format("Y") . "\n";
18		}
19	}
20
21};
22
23new mydt("Funktionsansvarig rådgivning och juridik", "UTC");
24?>
25--EXPECTF--
26Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %s on line %d
27Bad date
28