Mac 上的 xDebug 安装问题

xDebug installation issue on Mac

我正在遵循 https://xdebug.org/docs/install 指南

当我 运行 sudo make test 在我的 MAC 2 PHP 版本中安装 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 次,但出现了同样的问题。

测试失败的原因显而易见:

XFAIL REASON: PHP bug #76046: PHP generates "FE_FREE" opcode on the wrong line.

您需要在 PHP 源代码中修补 zend_compile.c(或等待固定版本)。如果不修补 zend_compile.c test-coverage,结果可能不准确——但是,普通调试应该可以。 make test 不会检查它,而 xdebug 不会部分依赖它(测试的标题甚至明确说明了为什么要检查错误)。这是 diff,它添加了 CG(zend_lineno) = ast->lineno;。这 "fixes the issue 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 - PHP 5.x 至少没有报告。 因为这不是一个 xdebug 错误,所以即使在测试失败的情况下安装也不会比现在更糟。要安装 xdebug,它不是 sudo make test,而是 make && sudo make install(只有 make install 需要 sudo)。