xref: /PHP-7.0/ext/date/tests/bug70277.phpt (revision 07c1b641)
1--TEST--
2Bug #70277 (new DateTimeZone($foo) is ignoring text after null byte)
3--FILE--
4<?php
5$timezone = "Europe/Zurich\0Foo";
6var_dump(timezone_open($timezone));
7var_dump(new DateTimeZone($timezone));
8?>
9--EXPECTF--
10Warning: timezone_open(): Timezone must not contain null bytes in %sbug70277.php on line %d
11bool(false)
12
13Fatal error: Uncaught Exception: DateTimeZone::__construct(): Timezone must not contain null bytes in %sbug70277.php:%d
14Stack trace:
15#0 %sbug70277.php(%d): DateTimeZone->__construct('Europe/Zurich\x00F...')
16#1 {main}
17  thrown in %sbug70277.php on line %d
18