Arquivos
hhvm/hphp/test/vm/actrec.php
T
mwilliams b387d70e70 RetC needs to zero ActRec::m_this before destroying it
In the case where m_this was already in a register,
and known to be non-zero, we would fail to zero the ActRec's
m_this field, which could result in a dangling reference
to $this being captured by debug_backtrace.

Put the store on the presumably cold path. Fix DecRefThis to
do the same.
2013-03-25 13:31:16 -07:00

43 linhas
655 B
PHP

<?php
class X {
private $bar=1;
function __destruct() {
var_dump(__METHOD__);
global $e;
$e = debug_backtrace(true);
}
function foo($ids) {
return array($this->bar,
$ids,
$this->bar,
$this->bar,
$this->bar,
$this->bar);
}
}
function test() {
$a = new X;
yield 1;
yield $a;
global $g;
$g = null;
yield 2;
}
function main() {
global $g;
$g = test();
for ($g->next(); $g && $g->valid(); $g->next())
var_dump($g->current());
var_dump($g);
global $e;
$e = null;
}
main();
$a = new X;
var_dump($a->foo(1));
$a = null;