Login   Register  
PHP Classes
elePHPant
Icontem

Value disappearing

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

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

  1. Value disappearing   Reply   Report abuse  
Picture of Flip
Flip
2011-11-24 15:18:46
While doing a LoadInputValues() function like so:
$form->LoadInputValues($form->WasSubmitted('button_submit'));

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) {
["NAME"]=>
string(7) "feeling"
["TYPE"]=>
string(8) "textarea"
["ROWS"]=>
int(3)
["COLS"]=>
int(50)
["VALUE"]=>
string(7) "gagadhg"
["LABEL"]=>
string(11) "Description"
["SubForm"]=>
string(0) ""
["ClientValidate"]=>
int(0)
["ServerValidate"]=>
int(0)
}[/code]

After LoadInputValues() function VALUE changes to this:
[code]["VALUE"]=>
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  
Picture of Flip
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  
Picture of Manuel Lemos
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.