1--TEST--
2Reflection::getClosureThis()
3--SKIPIF--
4<?php
5if (!extension_loaded('reflection') || !defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300) {
6  print 'skip';
7}
8?>
9--FILE--
10<?php
11class StaticExample
12{
13	static function foo()
14	{
15		var_dump( "Static Example class, Hello World!" );
16	}
17}
18
19class Example
20{
21	public $bar = 42;
22	public function foo()
23	{
24		var_dump( "Example class, bar: " . $this->bar );
25	}
26}
27
28// Initialize classes
29$class = new ReflectionClass( 'Example' );
30$staticclass = new ReflectionClass( 'StaticExample' );
31$object = new Example();
32
33$method = $staticclass->getMethod( 'foo' );
34$closure = $method->getClosure();
35$rf = new ReflectionFunction($closure);
36
37var_dump($rf->getClosureThis());
38
39$method = $class->getMethod( 'foo' );
40
41$closure = $method->getClosure( $object );
42$rf = new ReflectionFunction($closure);
43
44var_dump($rf->getClosureThis());
45
46echo "Done!\n";
47--EXPECTF--
48NULL
49object(Example)#%d (1) {
50  ["bar"]=>
51  int(42)
52}
53Done!
54