Reputation: 5195
I have a situation where code that is wrapped in if(false) { /* code here */ }
stops a page from loading when it is uncommented. Browser says "the server reset the connection". The environment is:
Any pointers where even to start looking for the reason this happens are welcome!
Edit: the actual code
// 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
Upvotes: 1
Views: 36
Reputation: 6381
In PHP < 5.5, empty()
can only accept a variable as its parameter. This minor refactor will make your code a little cleaner anyways:
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']);
}
}
}
Upvotes: 1