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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
Referência em uma Nova Issue
Bloquear um usuário