summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/closures_004.phpt
blob: 479c7c3e67eeaa4deb2864ac4a533a8c0929c083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--TEST--
Reflection on closures: Segfault with getClosure() on closure itself
--FILE--
<?php
$closure = function() { echo "Invoked!\n"; };

$method = new ReflectionFunction ($closure);

$closure2 = $method->getClosure ();

$closure2 ();
$closure2->__invoke ();

unset ($closure);

$closure2 ();
$closure2->__invoke ();

$closure = function() { echo "Invoked!\n"; };

$method = new ReflectionMethod ($closure, '__invoke');
$closure2 = $method->getClosure ($closure);

$closure2 ();
$closure2->__invoke ();

unset ($closure);

$closure2 ();
$closure2->__invoke ();

?>
--EXPECT--
Invoked!
Invoked!
Invoked!
Invoked!
Invoked!
Invoked!
Invoked!
Invoked!