TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Call to a member function _kohana_load_view() on a non-object
  • The following code:

    public function createAccount(){
    // Save As New Account
    $customer = new View('front/newcustacct');
    // Show Account Creation Form

    causes: Fatal error: Call to a member function _kohana_load_view() on a non-object in /home/wattwood/Zend/workspaces/DefaultWorkspace/client/system/libraries/View.php on line 209

    Any ideas? I'm using the latest SVN.
  • Your controller class declaration needs to have extends Controller.

  • It does:

    class Customer_Controller extends Controller{
  • I know this is an old thread, but I can answer it, you need to put parent:GDN__construct(); in your constructor if you have one.
  • oh man, you saved my day.

    I too was missing the parent:GDN__construct(); in the constructor.

    public function __construct(){
  • If your construct does nothing but call the parent constructor, remove. The requirement for having a constructor in every class is PHP4 crap that you should forget when working with PHP5.

  • Well, I have the same Fatal Error too. I tried to use the parent:GDN__construct() but it does weird things.

    public function __construct() {
    if (Auth::instance()->logged_in()) {


    It displays the form called with "displayForm" (two fields, login and password) . But below the form, I have a Kohana error "The page you requested, member/auth, could not be found.".
    Weird.... Can you help me? What am I doing wrong?

  • If you're trying to access a controller that's within a module make sure the module is enabled in your config file or you will see this error. Not saying this is it, but it's happened to me before until I realised what was going on. :)
  • also, may be caused by kohanadebugtoolbar

    "When a visitor visits a URI that fails to route to a valid controller, KDT prevents Kohana from showing the default 404 page, and instead raises a native PHP fatal error Fatal error: Call to a member function _kohana_load_view() on a non-object"

  • Thanks vlads.

    If you have the debug toolbar, add:

    if (empty(Router::$controller)) return '';

    in the render() method of Debug_Toolbar_Core in modules/debug_toolbar/libraries/Debug_Toolbar.php
  • I am getting the same error as this. I am trying to set a new user in library if one cannot be found by email address. I have the auth module active. Basically I'm just creating a new ORM object within my library and adding a few field values. When it comes to saving the user with $user->save(); I get this error:

    Fatal error: Call to a member function _kohana_load_view() on a non-object in /[path_to_kohana_installation]/system/libraries/View.php on line 272

    I've been trying to locate the the cause and have been all around the files (ORM, Database etc) debugging to get some information on why this is happening and I can't find anything. If anyone can help it would save the little hair I've got left. Thanks.
  • @Shadowhand
    Thank you for pointing out the __construct, I checked my controller and I wasn't calling the parent. That seems to have fixed it. For anyone else, if you are extending a controller, just check that in your controller you include in the __construct function the line parent:GDN__construct(); to make sure the parent controller is initialized properly, otherwise you'll spend hours running round in circles.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion