2013-02-20 47 views
0

我是HipHop的新手,我試圖讓自定義的PHP應用程序編譯並運行,編譯錯誤日誌文件包含數百個與$ this變量有關的錯誤「未申報的」 ..這裏是一個簡單的例子: -

文件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編譯器調用...

[email protected]:/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

這是在HHVM上?試用你的例子對我來說在HHVM上工作得很好。

2

由於我發佈了我的問題,我在GitHub上提出了一個問題,並且我被告知他們已修復導致問題的錯誤 - >https://github.com/facebook/hiphop-php/issues/698 - 我已被轉移到其他東西上,所以我沒有機會驗證這一點,但會認爲它現在好了。