xref: /PHP-8.2/ext/opcache/tests/bug75556.phpt (revision e9f783fc)
1--TEST--
2Bug #75556 (Invalid opcode 138/1/1)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7--EXTENSIONS--
8opcache
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