未定义的变量:$_SESSION
我在核心 CakePHP 文件中遇到错误,当它尝试引用从未设置或未设置的会话时():E_NOTICE
cake/libs/cake_session.php line 372
function read($name = null) {
if (is_null($name)) {
return $this->__returnSessionVars();
}
if (empty($name)) {
return false;
}
$result = Set::classicExtract($_SESSION, $name);
}
我已经搜索了我的代码(在app/目录中),但我找不到对或的引用。我错过了什么吗?$_SESSION
session_destroy
当我尝试运行任何单元测试时,会出现此错误。这是...正常?我已经清除了该目录并将其替换为另一个(相同版本),以确保我没有无意中修改核心文件中的任何内容,但我仍然收到相同的错误。我不确定这是否只是框架中的缺陷还是其他原因。cake/
编辑
以下是在命令行上运行测试的结果:
Welcome to CakePHP v1.3.11 Console
---------------------------------------------------------------
App : app
Path: /var/www/program/app
---------------------------------------------------------------
CakePHP Test Shell
---------------------------------------------------------------
Running app case models/owners_equity
E_NOTICE: Undefined variable: _SESSION in /var/www/program/cake/libs/cake_session.php on line 372
E_NOTICE: Undefined variable: _SESSION in /var/www/program/cake/libs/cake_session.php on line 372
ERROR->Unexpected PHP error [Undefined variable: _SESSION] severity [E_NOTICE] in [/var/www/program/cake/libs/cake_session.php line 372]
in testGenerateOwnerWithdrawals
in BalanceTestCase
in /var/www/program/app/tests/cases/models/owners_equity.test.php
ERROR->Unexpected PHP error [Undefined variable: _SESSION] severity [E_NOTICE] in [/var/www/program/cake/libs/cake_session.php line 372]
in testGenerateOwnerWithdrawals
in BalanceTestCase
in /var/www/program/app/tests/cases/models/owners_equity.test.php