FluxCP icon indicating copy to clipboard operation
FluxCP copied to clipboard

Missing Error

Open Normynator opened this issue 7 years ago • 2 comments

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;
}

Normynator avatar Sep 05 '18 23:09 Normynator

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)));
	}

cydh avatar Sep 12 '18 06:09 cydh

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.

Normynator avatar Sep 12 '18 10:09 Normynator