PHPUnit Segmentation Fault 11

风格不统一 提交于 2019-12-04 04:47:40

I solved this earlier this morning. The problem was that Yii was attempting to unregister an autoload function that didn't exist, it was likely removed in a later version of PHPUnit as I was a few minor versions ahead of my colleague. PHP throws a SIGSEGV when attempting to unregister a non-existant autoloader.

So I have changed these lines in Yii: framework/test/CTestCase.php

spl_autoload_unregister('phpunit_autoload');
Yii::registerAutoloader('phpunit_autoload');

to:

if (in_array('phpunit_autoload', spl_autoload_functions())) {
    spl_autoload_unregister('phpunit_autoload');
    Yii::registerAutoloader('phpunit_autoload');
}

This has fixed the issue. This change has already been implemented in Yii on the Git repository, but not released publicly yet. A bug report already exists on bugs.php.net too. I've answered this so it may help anyone else who has the same issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!