Arquivos
hhvm/hphp/test/vm/closure_clone_2.php
T
mwilliams ec4e62d602 Fix closure dispatch when there's more than one Func*
We need to make sure that we execute the code
corresponding to the actual Func*. This re-uses the
prolog array to hold the entry points for the cloned
Func*.
2013-04-01 13:47:50 -07:00

34 linhas
345 B
PHP

<?php
trait T {
function f() {
return function ($a) {
if ($a) {
return $this->foo;
}
};
}
}
class X {
private $foo = 1;
use T;
}
class Y {
private $foo = 2;
use T;
}
function test() {
$x = new X;
$c = $x->f();
var_dump($c(true));
$y = new Y;
$c = $y->f();
var_dump($c("foo"));
}
test();