以下代码导致我的Apache Web服务器崩溃。当我从parse_service_rows()
中移除数据库查询时,Apache就不会崩溃。
我还尝试了从查询中删除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
为什么会发生这种情况?