1--TEST--
2Reflection on closures: Segfault with getClosure() on closure itself
3--FILE--
4<?php
5$closure = function() { echo "Invoked!\n"; };
6
7$method = new ReflectionFunction ($closure);
8
9$closure2 = $method->getClosure ();
10
11$closure2 ();
12$closure2->__invoke ();
13
14unset ($closure);
15
16$closure2 ();
17$closure2->__invoke ();
18
19$closure = function() { echo "Invoked!\n"; };
20
21$method = new ReflectionMethod ($closure, '__invoke');
22$closure2 = $method->getClosure ($closure);
23
24$closure2 ();
25$closure2->__invoke ();
26
27unset ($closure);
28
29$closure2 ();
30$closure2->__invoke ();
31
32?>
33===DONE===
34--EXPECTF--
35Invoked!
36Invoked!
37Invoked!
38Invoked!
39Invoked!
40Invoked!
41Invoked!
42Invoked!
43===DONE===
44