![]() |
Validation variables missing - 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: Validation variables missing (/showthread.php?tid=5002) |
Validation variables missing - El Forum - 12-30-2007 [eluser]Wohlstand Applications[/eluser] I am using CI validation class in my app. It works on my development server (XAMPP PHP5) but when I put it on my host server (PHP4) the variables for fields set do not get passed through. The page loads, and I get a warning variable not initialized variable. In my controller I have: Code: //set validation fields And in the view (no method used) I have: Code: <input name="username" id="username" type="text" value="<?php echo $this->validation->username; ?>" /> The resulting page is this, and I've added var_dump($this->validation) to it: http://smartgoals.net/index.php/users The first line of the var_dump seems to tell the whole story: ON DEV SERVER: object(CI_Validation)#14 (14) { ON HOST SERVER: object(ci_validation)(10) { The var_dump is so long its hard to find what is missing, I believe it is the "output" array or something of that sort. I tend to think the problem is with PHP INI settings on the server? Any ideas? Validation variables missing - El Forum - 12-30-2007 [eluser]tonanbarbarian[/eluser] rather than doing a vardump, which will be very long and confusing because of the back reference to the controller do the following code instead Code: $properties = get_object_vars($this->validation); This will display all of the properties of the validation class (or any other with modification) and it will ignore any objects that exist in the class, thereby reducing the output because it will not show the controller which has a lot of stuff in it if dumped Hmmm In fact I think I might make a helper or plugin for this that I can use when debugging Validation variables missing - El Forum - 12-30-2007 [eluser]Wohlstand Applications[/eluser] Thanks. I have updated the page using your code and its a lot simple to read now. Now I will try to compare to the working development server output and see what is missing. Validation variables missing - El Forum - 12-30-2007 [eluser]Wohlstand Applications[/eluser] Anyone have ideas on what server configs might cause CI to have problems? Validation variables missing - El Forum - 12-30-2007 [eluser]Wohlstand Applications[/eluser] The property "_fields" is empty on the Live server while it reads as below on the Dev server: Code: _fields=> Here is a link to phpinfo for my live server: http://smartgoals.net/phpinfo.php Validation variables missing - El Forum - 12-31-2007 [eluser]Wohlstand Applications[/eluser] I have not been able to find a solution to this *yet*. For anyone with similar issues, two work around options are either to use isset() to test for the variable in the View page, or to reduce the error reporting level. I've chosen to use the isset() method for now. Anyone with insight into why this may occur, please let me know! Validation variables missing - El Forum - 01-06-2008 [eluser]t'mo[/eluser] I noticed a similar problem with the Validation's error messages. When I do: Code: print_r($this->validation); from within the Controller class, all the error messages are present. However, when I attempt to do the same thing from within the View, the messages are an empy Array. I actually need the error messages to show up in the view, so the suggested workaround to check for "isset(...)" won't be very useful. Update This (http://ellislab.com/forums/viewthread/67539/) looks like the same issue... Update 2 Works: load Validation class in the Controller method(s) where required, *do not* load Validation class in either the constructor or autoload.php Code: class MyClass extends Controller Doesn't work (2 examples): #1: load Validation class in Controller constructor Code: class MyClass extends Controller #2: autoload Validation Code: // in autoload.php... And a few further details: running CodeIgniter 1.5.4, Apache 1.3.31 and... Code: $ php -v Validation variables missing - El Forum - 01-07-2008 [eluser]t'mo[/eluser] See updates in my previous post (...new post, just so it floats to the top of the list...) Validation variables missing - El Forum - 01-10-2008 [eluser]scott9s[/eluser] I Had the same issue. CodeIgniter worked great on my PHP5 dev box, but when I go to deploy, I get all sorts of errors. I come to find out my production box is PHP4. After a few hours or wringing CodeIgniter's neck, I found this post. This worked for me: ==== *do not* load Validation class in either the constructor or autoload.php ==== In fact, I was not able to load the database class either in autoload either for PHP4, but I was not too worried about that. I had to adjust a few items in code regarding string manipulation, but that was my code specific. Thanks for your post. Validation variables missing - El Forum - 01-12-2008 [eluser]Wohlstand Applications[/eluser] Absolutely fantastic! Thank you so much! That solved the problem instantly! |