xref: /PHP-8.0/ext/date/tests/bug78984.phpt (revision 4aeff60f)
1--TEST--
2Bug #78984: DateTimeZone accepting invalid UTC timezones
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7$tests = [ '-3', '+3', '+1345', '+30157' ];
8
9foreach ($tests as $test)
10{
11	echo "Testing for '{$test}': ";
12	try {
13		new \DateTimeZone($test);
14		echo "OK\n";
15	} catch (Exception $e)	{
16		echo $e->getMessage(), "\n";
17	}
18}
19?>
20--EXPECT--
21Testing for '-3': OK
22Testing for '+3': OK
23Testing for '+1345': OK
24Testing for '+30157': DateTimeZone::__construct(): Unknown or bad timezone (+30157)
25