I have a module written for EE 2.0 which is based on the old Fresh Variables module. It saves a set of key / value pairs to be used in templates and elsewhere.
The module’s MCP form has fields like this:
echo form_input(array('name' => 'var_name[]', 'value' => $val['var_name'],
'maxlength' => 75, 'size' => 10, 'style' => 'width:90%'));
echo form_textarea(array('name' => 'var_value[]', 'value' => $val['var_value'],
'rows' => 4, 'cols' => 25, 'style' => 'width:90%'));These field names are being blocked by the Input class with the familiar message “Disallowed Key Characters.”
This can be fixed by modifying this line:
In manager/codeigniter/system/core/Input.php change line 536 to:
if ( ! preg_match("/^[a-z0-9:_\/-\[\]]+$/i", $str))So my questions are:
1) is this really the intended behavior? This seems to be very odd behavior according to what I know of the HTTP spec.
and
2) is there a different way to get post arrays to work?
Moved to Development and Programming by Moderator
This code appears in a table. The fields are named var_name[] and var_value[]. Every time a row is added, a new occurrence of each field is added.
My original code is representative because showing the table code doesn’t have much to do with what’s going on. Here’s some output code:
This is perfectly valid HTML, and you guys wrote it anyway, so it’s odd that it doesn’t work now.
So this now becoming even more of an issue. Going to a URL like this:
http://dev.local/~iraway/TEEL/teel/manager/index.php?S=c9b9d67cb9cf099283fd1a478b69fc576667bf41&D=cp&index;.php?S=c9b9d67cb9cf099283fd1a478b69fc576667bf41&D=cp&C=addons_modules&M=show_module_cp&module=fresha&method=save_variables
I get this error:
index_php?S
Disallowed Key Characters.The value before the error is the “key” that the script is complaining about. How is the index file being interpreted as a key?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.