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