FluxCP
FluxCP copied to clipboard
Missing Error
I was debugging an error in the module "item" and found out that no error if the sql query fails. Where: modules/items/index.php Line 267.
My code snippet when trying to get the sql error:
if(!$items){
echo "No items found!";
$msg = sprintf('Error info: %s', print_r($sth->errorInfo(), true));
echo $msg;
}
not found. the most what we have now
$sth->execute($bind);
$items = $sth->fetchAll();
$authorized = $auth->actionAllowed('item', 'view');
if ($items && count($items) === 1 && $authorized && Flux::config('SingleMatchRedirectItem')) {
$this->redirect($this->url('item', 'view', array('id' => $items[0]->item_id)));
}
I mean there is no check if the $sth->execute was successful. Would be nice to have an Error if it fails. I had to debug an error and it would have been a lot faster if that line would have thrown an error instead of just doing nothing and returning with no items.