Doc #77172 [Opn->Ver]: convert error on receiving variables from external sources
| From: | cmb@php.net | Date: | Mon, 19 Nov 2018 12:49:04 +0000 |
| Subject: | Doc #77172 [Opn->Ver]: convert error on receiving variables from external sources | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16161@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77172&edit=1
ID: 77172
Updated by: cmb@php.net
Reported by: zhoumengkang@php.net
Summary: convert error on receiving variables from external
sources
-Status: Open
+Status: Verified
Type: Documentation Problem
Package: Documentation problem
Operating System: Linux
PHP Version: master-Git-2018-11-18 (Git)
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I think that an external variable
foo[]boo should not be treated
as array at all, but be registered verbatim. However, this would
likely be a rather severe BC break, so we should document it for
now. For PHP 8 we may be able to implement feature request #34882
(and also to cater to cases like reported in this ticket).
Previous Comments:
------------------------------------------------------------------------
[2018-11-18 04:43:18] zhoumengkang@php.net
Description:
------------
when php receivie the data from external sources, a variables named foo[]boo will be saved into
$_POST['foo'][];
doc has noted dots and spaces in variable names are converted to underscores.
@see http://php.net/manual/en/language.variables.external.php
but there no info tell developers variables can't be named foo[]boo, otherwise the
variable foo[]boo should be remove ?
Test script:
---------------
<form method="post">
<input type="text" name="id[]" value="1">
<input type="text" name="id[]_text" value="a">
<input type="submit">
</form>
Expected result:
----------------
array (
'id' =>
array (
0 => '1',
),
)
Actual result:
--------------
array (
'id' =>
array (
0 => '1',
1 => 'a',
),
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77172&edit=1