Part of the EllisLab Network
   
 
[URGENT] Call to a member function load() in Form Validation
Posted: 30 January 2010 12:32 PM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  286
Joined  06-18-2009

How to fix this error?

Fatal error: Call to a member function load() on a non-object in /home/admin/domains/1ms.in/public_html/*****/core/libraries/Form_validation.php on line 316

Form validation is autoloaded

Profile
 
 
Posted: 30 January 2010 02:49 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
RankRank
Total Posts:  286
Joined  06-18-2009

I can’t even do this:
$this->output->enable_profiler(TRUE);

I get same error in Loader.php

What the hell is wrong?

Profile
 
 
Posted: 01 February 2010 01:53 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  11
Joined  01-25-2010

Hi,

It looks that you are trying to call the function on an invalid object name. Did you modify the form validation library? This usually happens when you try to call methods in libraries, models, controllers, views, and so on if you try to access those with an invalid instance or probably give incorrect parameters within…

Can you post the entire error message? As in the box above your current error that denotes the severity of the error. You will find information on the invalid object in that box.

Also, what does line 316 of your form validation library contain? If I’m not wrong it is the part that loads the language ....??

rolleyes

Profile
 
 
Posted: 01 February 2010 01:57 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
RankRank
Total Posts:  286
Joined  06-18-2009

$CI =& get_instance();

this is at line 316. Anyway, I’ve fixed that by downloading latest ci from svn. I don’t know what was the mistake. Usually when that kind of error comes form my script I can solve it, but that was annoying. I spent 5 hours debugging and nothing…

Profile
 
 
Posted: 01 February 2010 02:29 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  11
Joined  01-25-2010

OK,

I think it should have been:

$this->CI =& get_instance();

I am not really sure about it though…But anyways, you have got your code working…

enjoy!

Profile
 
 
Posted: 01 February 2010 02:32 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
RankRank
Total Posts:  286
Joined  06-18-2009

I had 1.7.2 in that error. But the other thing that was annoying me is that my own site is built on ci 1.7.2 without issues

Profile
 
 
Posted: 01 February 2010 02:46 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  11
Joined  01-25-2010

I get your point buddy! Well but as you know, CI errors are very informative…so I am yet pretty sure that it would have been about some instantiation problem…

Did you try adding $this-> to your code while debugging? Or probably, if you still have a backup somewhere…just try…

Profile
 
 
Posted: 01 February 2010 02:55 PM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  11
Joined  01-25-2010

Alternatively, it would be worth checking it in the fresh copy…

Profile
 
 
Posted: 02 February 2010 06:04 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
RankRank
Total Posts:  286
Joined  06-18-2009
Mareshal - 01 February 2010 06:57 PM

$CI =& get_instance();

My bad,

line 316 is this:

$this->CI->lang->load('form_validation'); 

and for no reason today when I checked again I get same error :|

Profile
 
 
Posted: 02 February 2010 06:12 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
RankRank
Total Posts:  286
Joined  06-18-2009

OK, I am coming with the solution.

I was using $lang as $this->lang which is a conflict with line 316. whatever, $lang is not a reserved word, can’t find it here: http://codeigniter.com/user_guide/general/reserved_names.html

Profile
 
 
Posted: 03 February 2010 11:28 AM   [ Ignore ]   [ # 10 ]  
Summer Student
Total Posts:  11
Joined  01-25-2010

Ahh…so you had a local variable with the same name and that caused the confusion it seems…

Profile
 
 
Posted: 03 February 2010 12:11 PM   [ Ignore ]   [ # 11 ]  
Lab Assistant
RankRank
Total Posts:  286
Joined  06-18-2009

yes, but now CI user_guide has been modified due to my post here: http://codeigniter.com/forums/viewthread/144236/ and my bug report here: http://codeigniter.com/bug_tracker/bug/11344/

Variables

    
$config
    
$mimes
    
$lang 
Profile
 
 
Posted: 03 February 2010 02:50 PM   [ Ignore ]   [ # 12 ]  
Summer Student
Total Posts:  11
Joined  01-25-2010

Well, strangely there was one more post on the same today, and I realized the conflict between the public variable and $lang in the library there…Never knew it was a bug though…

Great work, Thanks

Profile