如何诊断这些 PHP-Code-Coverage 分段和 zend_mm_heap 损坏的错误

2024-04-13php开发问题
3

本文介绍了如何诊断这些 PHP-Code-Coverage 分段和 zend_mm_heap 损坏的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我一直在我的 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 损坏的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17