Fix a bug in HHIR's emitParent
We actually grabbed the parent of the parent. This means things like parent::foo() were skipping the immediate parent.
Esse commit está contido em:
@@ -4035,9 +4035,10 @@ void CodeGenerator::emitGetCtxFwdCallWithThis(PhysReg ctxReg,
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is similar to emitGetCtxFwdCallWithThis above,
|
||||
* but whether or not the callee is a static method is uknown at JIT time,
|
||||
* and that is determined dynamically by looking up into the StaticMethodFCache.
|
||||
* This method is similar to emitGetCtxFwdCallWithThis above, but
|
||||
* whether or not the callee is a static method is unknown at JIT
|
||||
* time, and that is determined dynamically by looking up into the
|
||||
* StaticMethodFCache.
|
||||
*/
|
||||
void CodeGenerator::emitGetCtxFwdCallWithThisDyn(PhysReg destCtxReg,
|
||||
PhysReg thisReg,
|
||||
|
||||
@@ -550,7 +550,7 @@ void HhbcTranslator::emitLateBoundCls() {
|
||||
|
||||
void HhbcTranslator::emitSelf() {
|
||||
Class* clss = getCurClass();
|
||||
if (clss == NULL) {
|
||||
if (clss == nullptr) {
|
||||
emitInterpOne(Type::Cls, 0);
|
||||
} else {
|
||||
push(m_tb->genDefConst(clss));
|
||||
@@ -558,8 +558,8 @@ void HhbcTranslator::emitSelf() {
|
||||
}
|
||||
|
||||
void HhbcTranslator::emitParent() {
|
||||
const Class* clss = getCurClass()->parent();
|
||||
if (clss == NULL || clss->parent() == NULL) {
|
||||
auto const clss = getCurClass();
|
||||
if (clss == nullptr || clss->parent() == nullptr) {
|
||||
emitInterpOne(Type::Cls, 0);
|
||||
} else {
|
||||
push(m_tb->genDefConst(clss->parent()));
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
class B {
|
||||
public static function bar() {
|
||||
echo "B\n";
|
||||
}
|
||||
}
|
||||
|
||||
class D extends B {
|
||||
public static function bar() {
|
||||
echo "D\n";
|
||||
}
|
||||
}
|
||||
|
||||
trait Yeah {
|
||||
public function foo() {
|
||||
// Bug #2339698. Parent was skipping one.
|
||||
parent::bar();
|
||||
}
|
||||
}
|
||||
|
||||
class C extends D {
|
||||
use Yeah;
|
||||
}
|
||||
|
||||
function foo() {
|
||||
$k = new C();
|
||||
$k->foo();
|
||||
}
|
||||
|
||||
foo();
|
||||
@@ -0,0 +1 @@
|
||||
D
|
||||
Referência em uma Nova Issue
Bloquear um usuário