我有同樣的問題,可以釘下來,我試着寫這是不definied類變量:
我的類(這是一個CakePHP的類)造成分段錯誤:
class MyClass extends AppModel {
protected $classVariableOne;
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->classVariableOne =& ClassRegistry::init('ClassVariableOne');
// This line caused the segmentation fault as the variable doesn't exists
$this->classVariableTwo =& ClassRegistry::init('ClassVariableTwo');
}
}
我固定它通過添加第二個變量:
class MyClass extends AppModel {
protected $classVariableOne;
protected $classVariableTwo; // Added this line
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->classVariableOne =& ClassRegistry::init('ClassVariableOne');
$this->classVariableTwo =& ClassRegistry::init('ClassVariableTwo');
}
}
請你展示如何調用PHPUnit的。你有沒有嘗試過程隔離? – hakre 2011-06-14 12:52:53
內存不足? – powtac 2011-06-14 12:53:22
@hakre - 是的,我已經嘗試過程隔離,我得到的所有錯誤都是由於我的框架未正確實例化。我只是簡單地從命令行調用它:phpunit quiz_service_Test.php – 2011-06-14 12:55:35