我一直在我的 Ubuntu 机器上愉快地编写代码.这是一台具有大量 RAM 的强大机器.我正在研究 4 个新课程,边写边写和运行单元测试.在某些时候我注意到,虽然单元测试完成得很好,但代码覆盖率却没有.
I have been happily coding away on my Ubuntu machine. It's a beefy machine with plenty of RAM. I was working on 4 new classes, writing and running unit tests as I go. At some point I noticed that, while the unit tests were completing fine, code coverage was not.
在正在生成代码覆盖率报告……等等"消息之后,我会收到一条消息说 zend_mm_heap 已损坏.我尝试了一些修复,包括:在我的 php.ini(apache2 和 cli)中设置 output_buffering = On
,并从我的代码中删除对 unset()
的调用.(我阅读了这些可能需要修复的内容).
After the message "Generating code coverage report...etc.." I would get a message saying zend_mm_heap corrupted. I tried a few fixes including: setting output_buffering = On
in my php.ini (both apache2 and cli), and removing calls to unset()
from my code. (I read on SO these fixed might be required).
现在,无论我做什么,我似乎都在 zend_mm... 错误和分段错误(核心转储)错误之间交替出现.我注释掉测试,直到我缩小我认为导致问题的那个,并在那里进行一些更改,直到我得到一个干净的运行.然后我将取消所有测试的注释,只是发现仍然出现该故障.
Now, I seem to alternate between the zend_mm... error, and a Segmentation fault (core dump) error, no matter what I do. I comment out tests until I narrow down the one that I think causes the problem, and make some changes there until I get a clean run. Then I'll uncomment all the test only to find the that fault still occurs.
有什么想法吗?我可以使用哪些工具或方法来收集更多信息?
Any ideas? What tools or method could I use to gather more info?
我正在使用 PHP_CodeCoverage 1.2.6、PHP 5.3.10-1ubuntu3.5、PHPUnit 3.7.9.
I am using PHP_CodeCoverage 1.2.6, PHP 5.3.10-1ubuntu3.5, PHPUnit 3.7.9.
顺便说一句,我找不到任何核心转储文件.从我的两个物理磁盘的根目录中搜索,但没有运气.我已阅读有关核心的 man 条目,包括核心转储未创建文件的可能原因,但我认为这些都不适用.
As an aside, I can't find any core dump files. Have searched from the root of both my physical disks with no luck. I have read the man entry on core, including the possible reasons for core dumps not creating a file, but I don't think any of those apply.
我最近遇到了同样的问题.这似乎是 PHP 垃圾收集的问题.在 phpunit 运行期间禁用垃圾收集解决了我的问题.
I had the same issue recently. It appears to be an issue with PHP garbage collection. Disabling garbage collection during phpunit runs solved the problem to me.
添加:
zend.enable_gc=0
到您的 php.ini
文件或从命令行使用:
to your php.ini
file or from the command line with:
phpunit -d zend.enable_gc=0
这篇关于如何诊断这些 PHP-Code-Coverage 分段和 zend_mm_heap 损坏的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!