Don’t add a component twice

Last week I spent an annoyingly long time tracking down a bug caused by what was basically a simple typo.

I discovered that my controller redirects (e.g. $this->redirect(array('action'=>'index')); )were failing, but without generating any errors at all (that I could find).

Eventually I tracked down the cause by just taking the whole controller apart and rebuilding it one step at a time – I was including a component (PhpThumb) in my controller but the component was subsequently being included using App:import within a behaviour.