Fix a crash if an exception is thrown in a constructor's surprise check

The unwinder assumed that if the actrec's constructor flag
was set, then there must be a $this. But the $this is cleared during
the return sequence.
Esse commit está contido em:
Mark Williams
2013-04-19 14:25:49 -07:00
commit de Sara Golemon
commit b28254c8f2
3 arquivos alterados com 23 adições e 2 exclusões
+1 -2
Ver Arquivo
@@ -982,8 +982,7 @@ UnwindStatus Stack::unwindFrag(ActRec* fp, int offset,
// count starts over for the caller frame.
fault.m_handledCount = 0;
if (fp->isFromFPushCtor()) {
assert(fp->hasThis());
if (fp->isFromFPushCtor() && fp->hasThis()) {
fp->getThis()->setNoDestruct();
}
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?php
class X {
function __construct() {
}
}
function handler($kind, $name) {
if ($kind == 'exit' && $name == 'X::__construct') throw new Exception;
}
function test() {
fb_setprofile('handler');
try {
new X;
} catch (Exception $e) {
echo "ok\n";
}
}
test();
@@ -0,0 +1 @@
ok