1--TEST--
2Closures cannot be instantiated directly
3--CREDITS--
4Mark Baker mark@lange.demon.co.uk at the PHPNW2017 Conference for PHP Testfest 2017
5--FILE--
6<?php
7
8try {
9    // Closures should be instantiatable using new
10    $x = new Closure();
11} catch (Exception $e) {
12    // Instantiating a closure is an error, not an exception, so we shouldn't see this
13    echo 'EXCEPTION: ', $e->getMessage();
14} catch (Throwable $e) {
15    // This is the message that we should see for a caught error
16    echo 'ERROR: ', $e->getMessage();
17}
18
19?>
20--EXPECT--
21ERROR: Instantiation of class Closure is not allowed
22