![]() |
non object issue - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: non object issue (/showthread.php?tid=26480) Pages:
1
2
|
non object issue - El Forum - 01-14-2010 [eluser]megabyte[/eluser] Here's my code, Ican't see a need for more than this part of it: Code: function math_captcha($str, $field) I'm getting the error for this line Code: $field = $this->math_captcha->decrypt_answer($field); Here's the library Code: class Math_captcha { Also I have extended the form_validation library and tried putting this rule in there but it doesn't seem to work. non object issue - El Forum - 01-14-2010 [eluser]jedd[/eluser] Is there a reason you're ignoring the User Guide? Quote:from the user guide: You might also be having problems calling a library with the same name as the function you're currently in (but that's just wild speculation here). non object issue - El Forum - 01-14-2010 [eluser]megabyte[/eluser] I know you're trying to help. but am I missing something? Is the class not a capital name? I changed the name of the validation function, and still the same error. Any tips on how to debug this issue? I know you like to help and not give answers, so I am willing to put in the work. non object issue - El Forum - 01-14-2010 [eluser]megabyte[/eluser] Trying to debug I auto loaded the math_captcha library and no non object error. Any ideas? non object issue - El Forum - 01-14-2010 [eluser]Kosonome[/eluser] Not sure, but I guess you need Code: $this->CI->load->library('encrypt'); non object issue - El Forum - 01-14-2010 [eluser]megabyte[/eluser] I think I solved it. It's the php4 issue they talk about in the user guide. non object issue - El Forum - 01-14-2010 [eluser]Kosonome[/eluser] I'm curious, please, share it. ![]() non object issue - El Forum - 01-14-2010 [eluser]megabyte[/eluser] My next issue is trying to move my callback function into MY_Form_validation I put it in there, change my rule and nothing happens. Code: $this->form_validation->set_rules('math_captcha_response', '', 'captcha[math_captcha_answer]'); non object issue - El Forum - 01-14-2010 [eluser]megabyte[/eluser] In the user guide it states for libraries: Quote:Also, please note: If you are running PHP 4 it's usually best to avoid calling get_instance() from within your class constructors. PHP 4 has trouble referencing the CI super object within application constructors since objects do not exist until the class is fully instantiated. which also means it will affect controllers. So loading a library from inside the function being called I guess does not work. I created an init() function which I added to my controllers constructor and it loaded the library. non object issue - El Forum - 01-14-2010 [eluser]jedd[/eluser] [quote author="megabyte" date="1263528248"] Code: function math_captcha($str, $field) [quote author="megabyte" date="1263530326"] but am I missing something? Is the class not a capital name? [/quote] No - it's not. Quote:I changed the name of the validation function, and still the same error. You mean away from math_captcha ? [quote author="jedd" date="1263530010"] You might also be having problems calling a library with the same name as the function you're currently in (but that's just wild speculation here). [/quote] |