【问题标题】:xDebug installation issue on MacxDebug 在 Mac 上的安装问题
【发布时间】:2019-04-25 20:42:17
【问题描述】:

我正在关注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 次,但出现了同样的问题。

【问题讨论】:

  • 使用像 docker 或 vagrant 这样的虚拟机。
  • 已经在使用 VM docker & vagrant
  • 如果你的PHP_VERSION 是7.2.7,你为什么要使用路径/usr/local/php5/bin/php
  • 嗨 @G4Hu 在我的 apache 上,我为不同的项目设置了 2 个 PHP 版本 5 和 7。

标签: php macos xdebug


【解决方案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 - 至少没有报告 PHP 5.x。 因为这不是xdebug 错误,所以即使测试失败,安装也不应该比现在更糟。安装xdebug,不是sudo make test而是make && sudo make install(只有make install需要sudo)。

【讨论】:

  • 谢谢。这个补丁怎么打??
  • @AnkitShah open zend_compile.c 转至行 4807 并添加行 - 或应用 diff 文件 - 然后构建 PHP。稍后甚至还有一个稍微改进的补丁版本:git.php.net/… - 或者只是等待它在包管理器中,以防 OSX 有类似的东西。这个 make 测试失败一点也不严重——除非你现在迫切地依赖测试覆盖率数据;如果不是这种情况,只需运行make && sudo make install
  • @AnkitShah 如果您安装了7.2.137.3.0,它也可能与它们一起修复。 php.net/downloads.php ...它们都于 12 月 6 日发布 - 并且该错误修复已于 11 月 27 日提交。较新的版本可能比应用补丁更容易 - 当你必须询问如何做到这一点时。
  • 刚刚检查了更改日志;这些版本都没有修复错误 #76046... 但很有可能以下版本将修复它;这只是时间问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-03-30
  • 2015-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多