php 包含在 if(false) 中的代码如何产生错误?

How can php code wrapped in if(false) produce an error?

我有一种情况,if(false) { /* code here */ } 中包含的代码在取消注释时会阻止页面加载。浏览器显示 "the server reset the connection"。环境是:

欢迎任何开始寻找发生这种情况的原因的指示!

编辑:实际代码

// code above

 exit();
 if(false) {
 /*
    foreach($all_item_types as $ait) {
    $id = $ait['ItemType']['id'];
    $ItemSubtypeVersionView->find('first', array('conditions' => array('item_type_id'=>$id)));
    if(empty($ItemSubtypeVersionView->find('first', array('conditions' => array('item_type_id'=>$id))))) {
        $empty_file_types[$id]= array('n'=>$ait['ItemType']['name']); 
    }
  }
  */
}

// code below

在PHP < 5.5中,empty()只能接受一个变量作为它的参数。这个小的重构无论如何都会让你的代码更干净一些:

if (false) {
    foreach ($all_item_types as $ait) {
        $id = $ait['ItemType']['id'];
        $result = $ItemSubtypeVersionView->find('first', array('conditions' => array('item_type_id' => $id)));
        if (empty($result)) {
            $empty_file_types[$id]= array('n' => $ait['ItemType']['name']); 
        }
    }
}