Arquivos
hhvm/hphp/test/quick/destruct_segfault.php
T
Paul Tarjan b2de6fb9da fix segfault for wikimedia
If you call a static method on a instance, we decRef the object before running the method. If that is the last reference to the object, then its destructor will be called right in the middle of setting up the ActRec for the static method. Currently, the top of the stack will be off by 2 Cells because we have already popped off one Cell (the object) and an ActRec takes up 3 Cells.

Instead, we have to have the top of the stack to be after the ActRec that we are building for the next method call.
2013-05-21 11:12:05 -07:00

20 linhas
233 B
PHP

<?php
class A {
public static function factory() {
return new A;
}
public static function b() {
return 'no segfault';
}
public function __destruct() {
}
}
function main() {
echo A::factory()->b();
}
main();