PHPUnit分段错误 [英] PHPUnit Segmentation fault

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

问题描述

当PHPUnit测试在我的开发箱(Linux Mint)上正常失败时,它将在我的Continuous Integration箱(Centos)上导致分段错误".两台机器都运行相同版本的PHPUnit.我的开发箱正在运行PHP 5.3.2-1ubuntu4.9,配置项是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天全站免登陆