xref: /PHP-7.0/ext/date/tests/bug67118.phpt (revision 96808293)
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--
26
27Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %s on line %d
28Bad date
29
30