我遇到了一个有时会发生的严重问题。错误消息是“致命错误:在 /var/www/quantum-framework-0.9.1-ns-alpha/class/log/LogFacility.class.php 中的非对象上调用成员函数 elapsed()第 40 行
这是代码 - 第 40 行是 $this->timer->elapsed()-thing:
public function __construct() {
parent::__construct();
$this->timer = new \core\base\Timing();
print_r($this);
$this->timer_start = $this->timer->elapsed();
[...]
}
print_r($this) 的输出是:
core\log\LogFacility Object
(
[level:core\log\LogFacility:private] => TRACE
[file:core\log\LogFacility:private] =>
[filename:core\log\LogFacility:private] =>
[enabled:core\log\LogFacility:private] =>
[timer:core\log\LogFacility:private] => core\base\Timing Object
(
[start:core\base\Timing:private] => 1371141304.0793
[stop:core\base\Timing:private] => 0
[q:core\base\Quobject:private] =>
[supported_vars:protected] => Array
(
)
)
[timer_start:core\log\LogFacility:private] =>
[logs:core\log\LogFacility:private] => Array
(
)
[supported_vars:protected] => Array
(
[0] => level
[1] => filename
[2] => enabled
)
[q:core\base\Quobject:private] => core\log\LogFacility
)
那么,这怎么可能发生呢?请记住,该错误仅在有时发生 - 主要是当我更改与此计时测量功能无关的其他文件时,此外(如您所见)我在上面创建的对象存在。
哦,顺便说一句, elapsed() 方法存在并且是公开的。
谢谢你的回答!