Edit report at http://bugs.php.net/bug.php?id=52548&edit=1
ID: 52548
Comment by: qrstuv+php at gmail dot com
Reported by: qrstuv+php at gmail dot com
Summary: multiple $_POST array values not being assigned
correctly
Status: Bogus
Type: Bug
Package: HTTP related
Operating System: Ubuntu 10.04
PHP Version: Irrelevant
Block user comment: N
New Comment:
Ah, I understand. Thank you for your prompt response. Sorry for the
bogus report.
Previous Comments:
------------------------------------------------------------------------
[2010-08-06 02:05:53] [email protected]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
In your example $_POST['step4']['edit'] will be set to "Continue without
changes", the offset ['change'] will be used as string index, 'change'
is being casted to an integer value, 0, so the first character is
returned.
------------------------------------------------------------------------
[2010-08-06 01:48:10] qrstuv+php at gmail dot com
Description:
------------
The value of a $_POST array item is not being assigned properly
Test script:
---------------
<form method="post">
<input type="submit" name="step4[edit][change]" value="Submit and
continue">
<input type="submit" name="step4[edit]" value="Continue without
changes">
</form>
<?
//After form submission
var_dump($_POST['step4']['edit']['change']);
?>
Expected result:
----------------
//When "Continue without changes" is pressed, expected value:
NULL
Actual result:
--------------
//When "Continue without changes" is pressed...
//Actual value:
string(1) "C"
//The "C" is taken from the first character of the value of
$_POST['step4']
['edit']
//A var_dump of $_POST['step4']['edit'] returns the value as expected as
does a
var_dump of $_POST['step4']['edit']['change'] when that is actually
pressed.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52548&edit=1