title: codeigniter get current controller in post controller constructor hook
body: <p>I'm trying to get the name of the called controller in a "post controller constructor" hook:</p>
  
  <pre><code>&lt;?php
  function authenticate() {
      $CI =&amp; get_instance();
      $controller = $CI-&gt;router-&gt;class;
  }
  </code></pre>
  
  <p>But I get this error message:</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Notice</p>
    
    <p>Message: Trying to get property of non-object</p>
    
    <p>Filename: hooks/post_controller_constructor.php</p>
    
    <p>Line Number: 5</p>
    
    <p>Backtrace:</p>
    
    <p>File: / ... /CodeIgniter-3.0rc3/application/hooks/post_controller_constructor.php
    Line: 5
    Function: _error_handler</p>
    
    <p>File: / ... /index.php
    Line: 292
    Function: require_once</p>
  </blockquote>
  
  <p>Any ideas why?</p>