PHPUnit 分段错误 [英] PHPUnit Segmentation fault

查看:38
本文介绍了PHPUnit 分段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的开发盒 (Linux Mint) 上的 PHPUnit 测试正常失败时,它会在我的持续集成盒 (Centos) 上导致分段错误".两台机器都运行相同版本的 PHPUnit.我的开发箱运行 PHP 5.3.2-1ubuntu4.9,CI 是 PHP 5.2.17.不过,我宁愿把升级 PHP 作为最后的手段.

When a PHPUnit test fails normally on my dev box (Linux Mint), it causes a "Segmentation Fault" on my Continous Integration box (Centos). Both machines are running the same version of PHPUnit. My dev box is running PHP 5.3.2-1ubuntu4.9, and the CI is PHP 5.2.17. I'd rather leave upgrading the PHP as a last resort though.

根据这个线程:PHPUnit 得到分段错误我试过停用/重新安装 Xdebug.我没有安装 inclue.so.

As per this thread: PHPUnit gets segmentation fault I have tried deactivating / reinstalling Xdebug. I don't have inclue.so installed.

在 CI 框上,我目前只有两个处于活动状态的扩展:来自 php-xml 的 dom(phpunit 需要)和 memcache(我的框架需要),所有其他的都已关闭.

On the CI box I currently only have two extensions active: dom from php-xml (required for phpunit) and memcache (required by my framework), all the others have been turned off.

推荐答案

在 cweiske 建议的旁边,如果升级 PHP 不是您的选择,并且您在定位 segfault 的来源时遇到问题,您可以使用调试器来了解更多.

Next to what cweiske suggested, if upgrading PHP is not an option for you and you have problems to locate the source of the segfault, you can use a debugger to find out more.

您可以通过这种方式启动 gdb 来调试 PHPUnit 会话:

You can launch gdb this way to debug a PHPUnit session:

gdb --args php /usr/bin/phpunit quiz_service_Test.php

然后输入 r 以运行程序和/或首先设置环境变量.

Then type in r to run the program and/or set environment variables first.

set env MALLOC_CHECK_=3
r

您也可以考虑在系统上安装 PHP 的调试符号以获得更好的调试结果.gdb 会在启动时为您检查这一点,并通知您如何执行此操作.

You might also consider to install the debugging symbols for PHP on the system to get better results for debugging. gdb checks this on startup for you and leaves a notice how you can do so.

这篇关于PHPUnit 分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆