Welcome Guest, Not a member yet? Register   Sign In
Post variable named protected generates error
#1

[eluser]Xollef[/eluser]
It seems I stumbled upon a bug when I created a form checkbox in a view file with the name protected. I am using codeigniter version 1.6

The input:
<input type="checkbox" name="protected" value="true" <?php echo $this->validation->set_checkbox('protected', 'true'); ?> tabindex="9" />

The error:
A PHP Error was encountered
Severity: Warning

Message: in_array() [function.in-array]: Wrong datatype for second argument
Filename: libraries/Input.php
Line Number: 91


When submitting the form with that checkbox checked the error always appeared. Renaming the checkbox solves the problem.

Maybe the name protected should be on a reserved names list or some such.
#2

[eluser]Seppo[/eluser]
Yep, you are right... the same thing happens with 'key' variable.
I suggest to change Input class, lines 93 & 94
Code:
global $$global;
$$global = NULL;
//instead
$GLOBALS[$global] = NULL;

and lines 94 & 95
Code:
global $$key;
$$key = NULL;
//instead
$GLOBALS[$key] = NULL;
#3

[eluser]Seppo[/eluser]
Bug reported #3396
#4

[eluser]Paul Burdick[/eluser]
You know, we had a talk about making the change to GLOBALS in 1.6, but it seems it never happened. Will get that put into SVN today.




Theme © iAndrew 2016 - Forum software by © MyBB