【问题标题】:HipHop compiler doesn't recognise object $this variableHipHop 编译器无法识别对象 $this 变量
【发布时间】:2013-02-20 13:25:20
【问题描述】:

我是 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 编译器...

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

【问题讨论】:

    标签: php object compiler-errors this hiphop


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      这是在 HHVM 上吗?对我来说,尝试您的示例在 HHVM 上效果很好。

      【讨论】:

        猜你喜欢
        • 2015-05-14
        • 1970-01-01
        • 2022-06-28
        • 2017-04-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多