【发布时间】:2015-08-09 18:46:47
【问题描述】:
这是一个特定于我们已接管的自定义编写的 CMS 的问题。我们移动了服务器,PHP 版本从 5.3.8 更改为 5.4.1。 从那以后,我们无法让 CMS 正常工作,并且出现此错误:
Strict Standards: Non-static method Vox_Model_Setting::getMapper() should not be called statically, assuming $this from incompatible context in /var/www/vhosts/ds8760.dedicated.turbodns.co.uk/eera-bioenergy.com/application/modules/users/models/Role.php on line 71
第 71 行说:
$settings = new Vox_Model_Setting(Vox_Model_Setting::getMapper()->findOne(array('module' => 'users')));
谁能告诉我可能出了什么问题?
谢谢:)
编辑:添加 getMapper()
public function getMapper()
{
if (null === self::$__mapper) {
self::setMapper(new Vox_Model_Setting_Mapper());
}
return self::$__mapper;
}
【问题讨论】:
-
检查你
getMapper()函数类型。错误说它不是static,你称之为静态时尚。在调用其非静态方法之前,您必须创建一个Vox_Model_Setting类的object -
嗨,这是 getMapper() public function getMapper() { if (null === self::$__mapper) { self::setMapper(new Vox_Model_Setting_Mapper()); } 返回自我::$__mapper; }
标签: php static standards strict non-static