我使用 Ubuntu 12.04(64 位)。
我使用本手册从源代码编译 hiphop:https ://github.com/facebook/hiphop-php/wiki/Building-and-installing-HHVM-on-Ubuntu-12.04
hphp 运行良好,但我总是看到我的 CodeError.js 是这样的:
[0,{}
]
为了了解发生了什么,我创建了一个“errors.php”文件:
<?php
// just in case
error_reporting(E_ALL);
// undefined variable
$a = $b;
// wrong optional params order
function test($x=false, $y)
{
// undefined variable
return $value;
}
// wrong function call
test();
// undefined function call, etc...
test_bad_function();
echo $undefined_variable;
?>
之后,我让 HipHop 使用命令分析文件:
$HPHP_HOME/src/hphp/hphp /home/frost/errors.php --output-dir=$OUTPUT_DIR --log=4 --force=1 --keep-tempdir=1 --target=analyze
控制台输出:
running hphp...
Analyzing Includes
Analyzing All
Corrected function return type Boolean -> Variant
Corrected function return type [0x1] -> Variant
Corrected function return type [0x1] -> Object - iterator
Analyzing Includes
Analyzing All
Analyzing Includes
Analyzing All
parsing inputs...
parsing /home/frost/errors.php ...
Analyzing Includes
Analyzing All
parsing inputs took 0'00" (5 ms) wall time
pre-optimizing...
pre-optimizing took 0'00" (4 ms) wall time
analyze includes...
analyze includes took 0'00" (0 ms) wall time
inferring types...
inferring types took 0'00" (3 ms) wall time
post-optimizing...
post-optimizing took 0'00" (7 ms) wall time
saving code errors and stats...
saving stats...
saving stats took 0'00" (9 ms) wall time
all files saved in /home/frost/hiphop/reports ...
running hphp took 0'00" (195 ms) wall time
HipHop 创建了 2 个文件:Stats.js 和 CodeError.js
Stats.js 内容:
{
"FileCount":1,
"LineCount":21,
"CharCount":363,
"FunctionCount":2,
"ClassCount":0,
"TotalTime":0,
"AvgCharPerLine":17,
"AvgLinePerFunc":10,
"SymbolTypes":
{
"Array":20,
"Boolean":8,
"Double":19,
"Int64":2248,
"Object":3,
"Object - Specific":20,
"Primitive":13,
"String":134,
"Variant":306,
"_all":2771,
"_strong":2452,
"_weak":319
}
,"VariableTableFunctions":[]
}
CodeError.js 内容:
[0,{}
]
怎么会这样?我错过了什么?
有趣的事实:Stats.js 每次都会创建,即使我设置了 --gen-stats=0