xref: /php-src/ext/date/tests/bug70277.phpt (revision b7860cd5)
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::class, ': ', $e->getMessage(), "\n";
10}
11try {
12    var_dump(new DateTimeZone($timezone));
13} catch (\ValueError $e) {
14    echo $e::class, ': ', $e->getMessage(), "\n";
15}
16?>
17--EXPECT--
18ValueError: timezone_open(): Argument #1 ($timezone) must not contain any null bytes
19ValueError: DateTimeZone::__construct(): Argument #1 ($timezone) must not contain any null bytes
20