HipHop编译器无法识别对象$this变量



我是HipHop的新手,我正在尝试编译和运行一个自定义的PHP应用程序,编译错误日志文件包含数百个与$this变量"未声明"有关的错误。。这里有一个简化的例子:-

file-bar.hp:

class Bar {
     private $_baz = 'Hello';
     public function __construct() {
         echo 'Constructed';
     }
     public function foo() {
         echo $this->_baz;
     }
}
$bah = new Bar();
$bah->foo();

该文件被列为列表文本文件f.lst中的唯一条目,并且HipHop编译器被调用。。。

root@hiphop:/home/rich/www# hhvm --hphp --input-list=f.lst -k 1 --log=3
running hphp...
creating temporary directory /tmp/hphp_rC6OVL ...
parsing inputs...
parsing inputs took 0'00" (3605 us) wall time
pre-optimizing...
pre-optimizing took 0'00" (1757 us) wall time
analyze includes...
analyze includes took 0'00" (4 us) wall time
inferring types...
inferring types took 0'00" (1503 us) wall time
post-optimizing...
post-optimizing took 0'00" (2870 us) wall time
creating binary HHBC files...
creating binary HHBC files took 0'00" (254854 us) wall time
saving code errors...
all files saved in /tmp/hphp_rC6OVL ...
running hphp took 0'00" (357323 us) wall time

生成的JSON错误日志/tmp/hhp_rC60VL/CodeError.js-包含以下内容:-

[1,{"UseUndeclaredVariable":[{"c1":["bar.php",11,8,11,12]
 ,"d":"$this"}
]
}
]

我是不是遗漏了一些显而易见的东西?

TIA

自从我发布问题后,我在GitHub上提出了一个问题,并被告知他们已经修复了导致该问题的错误->https://github.com/facebook/hiphop-php/issues/698-我被转移到了其他事情上,所以我还没有机会验证这一点,但我认为现在一切都好了。

这是在HHVM上吗?尝试你的例子对我来说在HHVM上运行得很好。

最新更新