xref: /PHP-8.2/ext/date/tests/bug70277.phpt (revision 95f4ee38)
1--TEST--
2Bug #70277 (new DateTimeZone($foo) is ignoring text after null byte)
3--FILE--
4<?php
5$timezone = "Europe/Zurich\0Foo";
6try {
7    var_dump(timezone_open($timezone));
8} catch (\ValueError $e) {
9    echo $e->getMessage() . \PHP_EOL;
10}
11try {
12    var_dump(new DateTimeZone($timezone));
13} catch (\ValueError $e) {
14    echo $e->getMessage() . \PHP_EOL;
15}
16?>
17--EXPECT--
18timezone_open(): Argument #1 ($timezone) must not contain any null bytes
19DateTimeZone::__construct(): Argument #1 ($timezone) must not contain any null bytes
20