1--TEST--
2Test new DateTime(): error conditions
3--FILE--
4<?php
5// Set the default time zone
6date_default_timezone_set('UTC');
7
8echo "*** Testing date_create() : error conditions ***\n";
9
10echo "\n-- Testing new DateTime() with more than expected no. of arguments --\n";
11$time = "GMT";
12$timezone  = timezone_open("GMT");
13$extra_arg = 99;
14try {
15    var_dump(new DateTime($time, $timezone, $extra_arg));
16} catch (TypeError $e) {
17    echo $e::class, ': ', $e->getMessage(), "\n";
18}
19
20?>
21--EXPECT--
22*** Testing date_create() : error conditions ***
23
24-- Testing new DateTime() with more than expected no. of arguments --
25ArgumentCountError: DateTime::__construct() expects at most 2 arguments, 3 given
26