I am using PHP 5.3.8 with Apache 2.0. I am also using Symfony 2 but that's not where the script is failing. I have a form with array variables:
<form action="/app_dev.php/admin/position/create" method="post">
<input type="text" id="po_name" name="po[name]" required="required" maxlength="50">
<input type="text" id="po_role" name="po[role]" required="required" maxlength="20">
</form>
Directly in the app_dev.php file (to rule out Symfony from the problem) I do:
echo file_get_contents("php://input"); // outputs: po%5Bname%5D=Developer&po%5Brole%5D=ROLE_USER
var_dump($_POST); // outputs: array(1) { ["po"]=> array(1) { ["name"]=> string(9) "Developer" } }
die();
Basically it keeps only the first variable in the array. If I change the name of the variable from po[role] to ba[role] then $_POST outputs:
array(1) {
["po"]=> array(1) { ["name"]=> string(9) "Developer" },
["ba"]=> array(1) { ["role"]=> string(9) "ROLE_USER" }
}
Typical problems I have found that can cause this issue are due to the following php.ini configuration, I also give you what are my values:
max_execution_time = 30
max_input_time = 60
max_input_nesting_level = 64
max_input_vars = 1000
post_max_size = 8M
upload_max_filesize = 2M
memory_limit = 128M
These values seems reasonable and I think don't cause the problem, but cannot be 100% sure.
I do not have suhosin installed as I've read it can cause similar problems too.
It is also similar to this problem but the solution given would require me to rewrite the HttpFoundation Symfony component.
Also I don't want to have to rewrite the form variable without and array (e.g. po[name] to po_name) as the form are automatically generated by Symfony and this seems to be a basic feature that PHP should be able to handle.
Does someone have any idea about this problem ?
PS: this is similar to the problem described in here. Plus the problem happens on the same version of Suse (SUSE Linux Enterprise Server 11 ).