030.phpt 596 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Test string match with undefined variable
  3. --FILE--
  4. <?php
  5. set_error_handler(function ($errno, $message) {
  6. throw new Exception("Custom error handler: $message");
  7. });
  8. echo match ($undefVar) {
  9. default => "This should not get printed with or without opcache\n",
  10. '1', '2', '3', '4', '5' => "Also should not be printed\n",
  11. };
  12. echo "unreachable\n";
  13. ?>
  14. --EXPECTF--
  15. Fatal error: Uncaught Exception: Custom error handler: Undefined variable $undefVar in %s030.php:4
  16. Stack trace:
  17. #0 %s030.php(7): {closure}(%d, 'Undefined varia...', '%s', %d)
  18. #1 {main}
  19. thrown in %s030.php on line 4