Today I came across the strange behaviour with PHP _POST array. When submitting form fields named as multidimensional array PHP supports, the POST is filled with only the first value from array. Found this on PHP 5.3.8 (SLES 11 SP2). The same code works normally on all other systems I have access to including PHP 5.2, 5.3.18, and 5.4. Here is a test case:
<form method="POST" action="test.php">
<input type="text" name="single" value="sss"/><br>
<input type="text" name="multi[a]" value="AAA"/><br>
<input type="text" name="multi[b]" value="BBB"/><br>
<input type="text" name="single2" value="CCC"/><br>
<input type="submit">
</form>
<?php
$raw_post = file_get_contents('php://input');
print $raw_post;
phpinfo(INFO_VARIABLES);
After submitting this I get the following in raw data:
single=sss&multi%5Ba%5D=AAA&multi%5Bb%5D=BBB&single2=CCC
But $_POST array is filled only with first value from "multi", $_POST['multi'] provides:
Array
(
[a] => AAA
)
Does anybody know why this can happen?