bug75556.phpt 603 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. Bug #75556 (Invalid opcode 138/1/1)
  3. --INI--
  4. opcache.enable=1
  5. opcache.enable_cli=1
  6. opcache.optimization_level=-1
  7. --EXTENSIONS--
  8. opcache
  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. return null;
  20. }
  21. var_dump(createFromFormat('m/d/Y', '12/07/2017', null));
  22. ?>
  23. --EXPECT--
  24. NULL