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.

One Response to “Don’t add a component twice”

  1. ajmacaro

    Ive wasted to hours of my time.
    dont add a “non-exists” components.

    var $helpers = array(‘Html’,’Form’,’Session’);
    var $components = array(‘NoExists’);