PHP Classes

Value disappearing

Recommend this page to a friend!

      Forms generation and validation  >  All threads  >  Value disappearing  >  (Un) Subscribe thread alerts  
Subject:Value disappearing
Summary:bug in LoadInputValues() ??
Date:2011-11-24 15:18:46
Update:2012-03-11 11:30:26

  1. Value disappearing   Reply   Report abuse  
Flip - 2011-11-24 15:18:46
While doing a LoadInputValues() function like so:

One of the values dissapeared. I have 3 inputs, 1 textarea, 1 text, 1 submit.

The properties of the textarea are like this:
[code]array(9) {
string(7) "feeling"
string(8) "textarea"
string(7) "gagadhg"
string(11) "Description"
string(0) ""

After LoadInputValues() function VALUE changes to this:
string(0) ""[/code]

I traced it back to forms.php Line 3793 where the LoadInputValue() function is being called.

Now i'm not sure if i have discovered a bug here or i am doing something wrong. No special error message is displayed by the form_class like usual when something is wrong.

  2. Re: Value disappearing   Reply   Report abuse  
Flip - 2011-11-24 16:14:47 - In reply to message 1 from Flip
Right ...
i traced the problem to forms.php Line 3032
$value=(IsSet($GLOBALS[$variable]) ? $GLOBALS[$variable] : "");

the thing is ... in my own script i had a variable called $feeling. And my input had the name feeling. Though $feeling is used to store some database result before the form script is executed.

renaming $feeling to $feeling_row (since it's a database row i picked this name) fixed the problem.

I just searched the manual and i couldn't find any warning about the script behaviour. I think this behaviour is undesirable. I can only see it being useful if register_globals is on, which is a known security risk for ages and shouldn't be used in the first place.

  3. Re: Value disappearing   Reply   Report abuse  
Manuel Lemos - 2012-03-11 11:30:26 - In reply to message 2 from Flip
Sorry for the delay. I hope the reply is still useful.

I finally made time to look into this. I changed the class to only look into global variables if the register_globals option is set.

I will upload a fixed version as soon as I am able to finish some documentation of other new features.