以下代碼正在製作我的apache web服務器。當我從parse_service_rows()
刪除數據庫查詢,然後apache不會崩潰。array_map導致服務器崩潰
我也試圖從查詢中刪除WHERE子句,沒有任何幫助。
我的代碼如下所示:
public function tab($tab_name = '') {
/*
* CODE TO GET ROWS
*/
$service['rows'] = array_map(array($this, 'parse_service_rows'), $service['rows']);
}
private function parse_service_rows($row) {
// This query causes apache to crash
$order = $this->db->get_where('services', array(
'service_user_id' => $this->user->get('user_id'),
'service_firm_id' => $this->firm->id,
'service_type' => $row['type'],
'service_object_id' => $row['object_id']
), 1)->row_array();
return $row;
}
但是,它工作時,我試圖用foreach
代替array_map
:
foreach ($service['rows'] as $key => $row) {
$service['rows'][$key] = $this->parse_service_rows($row);
}
Windows錯誤窗口,給了以下信息:
Problem Event Name: APPCRASH
Application Name: httpd.exe
Application Version: 2.4.2.0
Application Timestamp: 4fafa3e6
Fault Module Name: php5ts.dll
Fault Module Version: 5.4.4.0
Fault Module Timestamp: 4fd8f85c
Exception Code: c0000005
Exception Offset: 000713cd
OS Version: 6.1.7600.2.0.0.256.1
Locale ID: 1061
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
這是怎麼發生的?
我建議的第一個建議是確保您使用的是PHP的最新版本。崩潰消息說你在5.4.4上。嘗試升級到最新版本(5.4.10);有可能有一個已知的bug已被修復。如果這不能解決它,你可能需要向PHP開發人員報告崩潰。創建一個最小的測試用例,以儘可能少的代碼展示問題將有助於解決這種情況。 – SDC