我是HipHop的新手,我正在尝试使用自定义PHP应用程序进行编译和运行,编译错误日志文件包含数百个与$ this变量相关的错误“Undeclared”..这是一个简化的示例: -
文件bar.php:
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/hphp_rC60VL/CodeError.js - 包含: -
[1,{"UseUndeclaredVariable":[{"c1":["bar.php",11,8,11,12]
,"d":"$this"}
]
}
]
我错过了一些明显的东西吗?
TIA
答案 0 :(得分:2)
自从我发布了我的问题后,我在GitHub上提出了一个问题,并且我被告知他们已经修复了导致该问题的错误 - > https://github.com/facebook/hiphop-php/issues/698 - 我被转用于其他事情,所以我还没有机会对此进行验证,但现在认为它还可以。
答案 1 :(得分:0)
这是在HHVM上吗?尝试你的例子对我来说在HHVM上完全正常。