我笨3.0網站,該網站已經啓動並運行,直到今天早上,已經停止了工作,突然,呈現在所有頁面上出現以下錯誤信息:如何調試笨致命錯誤
Fatal error: Call to a member function row() on a non-object in /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php on line 160
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php:160)
Filename: core/Common.php
Line Number: 569
A PHP Error was encounteredSeverity: Error
Message: Call to a member function row() on a non-object
Filename: drivers/Session_database_driver.php
Line Number: 160
而且,在error_log
中顯示以下錯誤消息:兩天前兩個&的內存耗盡消息(不知道它們是否相關,因爲網站在這些之後運行良好,並且它們只出現兩次),然後很多的相同的PHP致命錯誤(我只複製了三個,但有很多很多相同的錯誤):
[10-Oct-2015 06:04:04 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 12 bytes) in /home/[mysite]/public_html/system/database/DB_driver.php on line 919
[11-Oct-2015 02:52:43 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes) in /home/[mysite]/public_html/system/database/drivers/mysqli/mysqli_result.php on line 168
[13-Oct-2015 08:25:51 UTC] PHP Fatal error: Call to a member function row() on a non-object in /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php on line 160
[13-Oct-2015 08:26:08 UTC] PHP Fatal error: Call to a member function row() on a non-object in /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php on line 160
[13-Oct-2015 08:26:17 UTC] PHP Fatal error: Call to a member function row() on a non-object in /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php on line 160
在Session_database_driver.php
160行是這樣的:
if (($result = $this->_db->get()->row()) === NULL)
和線569在core/Common.php
是這樣的:
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
這是包含臭名昭著線160的功能:
public function read($session_id)
{
if ($this->_get_lock($session_id) !== FALSE)
{
// Needed by write() to detect session_regenerate_id() calls
$this->_session_id = $session_id;
$this->_db
->select('data')
->from($this->_config['save_path'])
->where('id', $session_id);
if ($this->_config['match_ip'])
{
$this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']);
}
if (($result = $this->_db->get()->row()) === NULL)
{
$this->_fingerprint = md5('');
return '';
}
// PostgreSQL's variant of a BLOB datatype is Bytea, which is a PITA to work with, so we use base64-encoded data in a TEXT field instead.
$result = ($this->_platform === 'postgre')
? base64_decode(rtrim($result->data))
: $result->data;
$this->_fingerprint = md5($result);
$this->_row_exists = TRUE;
return $result;
}
$this->_fingerprint = md5('');
return '';
}
但他們都是原始的CI文件。我沒有改變任何東西。
我不知道什麼地方出了問題,是什麼導致了這一點,我不知道如何開始調試它,因爲錯誤信息都指向CI文件,而不是我寫的代碼。
任何指針如何開始調試,將不勝感激!
添加與此相關的 –
完整的代碼這正是問題 - 我不知道有什麼相關的代碼做,因爲錯誤消息不指向我的代碼中的任何特定行,只在線路框架的原始文件。 – einav
添加此代碼的地方'if(($ result = $ this - > _ db-> get() - > row())=== NULL)' –