Class construct causes the same code to be executed multiple times
<p>let me introduce you first to the issue that I am experiencing. I've recently started working on my own MVC framework. I want some additional experience and to understand how exactly framework's like CodeIgniter work.</p>

<p>Anyway, everything was going great until I added a construct to my controller. The request was routed properly, the controller has been initialized - the issue is that is gets initialized time after time and continues until resource limit has been reached.</p>

<p>After doing a lot of debugging, I found out that one simple line causes everything, but I don't know how why. This is the line:</p>

<pre><code>$controller = &amp;FuturoContainer::getController();
</code></pre>

<p>To explain the above line. FuturoContainer is my implementation of dependency injection. It contains instances of all classes that should be initialized only once.</p>

<p>This is getController() method:</p>

<pre><code>private static $controller = null;
public static function &amp;getController()
{
    if (self::$controller === null) {
        /* Load controller file */
        require self::getParam('controllerFile');

        $controllerName = self::getParam('controllerName');

        self::$controller = new $controllerName;
    }

    return self::$controller;
}
</code></pre>

<p>$controller is null by default.</p>

<p>As I have already mentioned, even though $controller should be a class instance after this method has been executed for the first time, it seems to remain NULL. Not only that, but the method gets executed time after time after time. And the weirdest part: it only happens if I add __construct() to a controller like this:</p>

<pre><code>class Home extends Controller
{
    public function __construct()
    {
        parent::__construct();
    }
}
</code></pre>

<p>Any idea why might this happen? Thanks in advance.</p>
