File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / reflection / tests / bug52057.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #52057 (ReflectionClass fails on Closure class)
--FILE--
<?php

$closure = function($a) { echo $a; };

$reflection = new ReflectionClass('closure');
var_dump($reflection->hasMethod('__invoke')); // true

$reflection = new ReflectionClass($closure);
var_dump($reflection->hasMethod('__invoke')); // true

$reflection = new ReflectionObject($closure);
var_dump($reflection->hasMethod('__invoke')); // true

$reflection = new ReflectionClass('closure');
var_dump($h = $reflection->getMethod('__invoke')); // true
var_dump($h->class.'::'.$h->getName());

$reflection = new ReflectionClass($closure);
var_dump($h = $reflection->getMethod('__invoke')); // true
var_dump($h->class.'::'.$h->getName());

$reflection = new ReflectionObject($closure);
var_dump($h = $reflection->getMethod('__invoke')); // true
var_dump($h->class.'::'.$h->getName());

?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
object(ReflectionMethod)#%d (2) {
  ["name"]=>
  string(8) "__invoke"
  ["class"]=>
  string(7) "Closure"
}
string(17) "Closure::__invoke"
object(ReflectionMethod)#%d (2) {
  ["name"]=>
  string(8) "__invoke"
  ["class"]=>
  string(7) "Closure"
}
string(17) "Closure::__invoke"
object(ReflectionMethod)#%d (2) {
  ["name"]=>
  string(8) "__invoke"
  ["class"]=>
  string(7) "Closure"
}
string(17) "Closure::__invoke"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>