我正在遵循https://xdebug.org/docs/install准则
当我运行sudo make test
时,根据项目需要,在我的MAC 2中安装了PHP5和PHP7。
PHP : /usr/local/php5/bin/php
PHP_SAPI : cli
PHP_VERSION : 7.2.7
它给出了以下错误
=====================================================================
EXPECTED FAILED TEST SUMMARY
---------------------------------------------------------------------
Test for bug #1530: Code coverage incorrect for last code line in a loop [tests/bug01530.phpt] XFAIL REASON: PHP bug #76046: PHP generates "FE_FREE" opcode on the wrong line.
=====================================================================
You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it. You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]:
我尝试了2-3次,但是发生了同样的问题。
答案 0 :(得分:1)
测试失败的原因很明显:
XFAIL原因:PHP错误#76046:PHP在错误的行上生成了“ FE_FREE”操作码。
您需要在PHP源代码中修补zend_compile.c
(或等待固定版本)。没有修补zend_compile.c
的测试覆盖率结果可能是不准确的-但是,常见的调试应该可以工作。 make test
不会检查它,而xdebug
不会部分依赖它(测试的标题甚至明确说明了为什么要检查错误)。这是diff,其中添加了CG(zend_lineno) = ast->lineno;
。这“ 100%解决了问题”,不仅是症状:
index f1dd49a..9c0893b 100644 (file)
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4807,6 +4807,7 @@ void zend_compile_foreach(zend_ast *ast) /* {{{ */
zend_end_loop(opnum_fetch, &reset_node);
+ CG(zend_lineno) = ast->lineno;
opline = zend_emit_op(NULL, ZEND_FE_FREE, &reset_node, NULL);
}
/* }}} */
此错误影响PHP 7.0、7.1、7.2-至少未报告PHP5.x。
由于这不是xdebug
的错误,因此即使测试失败也无法进行安装,应该不会比现在更糟。要安装xdebug
,不是sudo make test
,而是make && sudo make install
(仅make install
需要sudo
)。