xref: /PHP-8.0/ext/opcache/tests/bug75556.phpt (revision f8d79582)
1--TEST--
2Bug #75556 (Invalid opcode 138/1/1)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7--SKIPIF--
8<?php require_once('skipif.inc'); ?>
9--FILE--
10<?php
11 function createFromFormat($format, $date, ?\DateTimeZone $tz = null): ?\DateTimeInterface
12 {
13     if ($tz !== null
14             || ($tz instanceof \DateTimeZone && !in_array($tz->getName(), ['UTC', 'Z'], true))
15        ) {
16         $msg = 'Date objects must have UTC as their timezone';
17         throw new \UnexpectedValueException($msg);
18     }
19
20    return null;
21}
22
23var_dump(createFromFormat('m/d/Y', '12/07/2017', null));
24?>
25--EXPECT--
26NULL
27