Bug #78236 [Ver->Csd]: convert error on receiving variables when duplicate [
| From: | cmb@php.net | Date: | Thu, 23 Jul 2020 13:48:27 +0000 |
| Subject: | Bug #78236 [Ver->Csd]: convert error on receiving variables when duplicate [ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228199@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78236&edit=1
ID: 78236
Updated by: cmb@php.net
Reported by: hongweichen8888 at sina dot com
Summary: convert error on receiving variables when duplicate
[
-Status: Verified
+Status: Closed
Type: Bug
Package: Variables related
Operating System: Windows
PHP Version: 7.2.19
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fc4d462e947828fdbeac6020ac8f34704a218834
Log: Fix #78236: convert error on receiving variables when duplicate [
Previous Comments:
------------------------------------------------------------------------
[2020-07-23 09:16:39] cmb@php.net
This behavior is unintentional. According to a comment[1] in the
sources, all open brackets are supposed to be replaced, and
according to the PHP manual[2], dots and spaces in variable names
are converted to underscores.
I have some doubts that we should fix that in the stable branches
for BC reasons, though.
[1] <https://github.com/php/php-src/blob/php-7.3.20/main/php_variables.c#L192>
[2] <https://www.php.net/manual/en/language.variables.external.php>
------------------------------------------------------------------------
[2019-07-01 07:45:12] hongweichen8888 at sina dot com
Description:
------------
when php receivie the data from external sources, a variables named 'id[[name' will be
saved into $_REQUEST['id_[name'];
@see http://php.net/manual/en/language.variables.external.php
Will '[' only be replaced once?
Test script:
---------------
<form method="post">
<input type="text" name="id[name" value="1">
<input type="text" name="id[[name" value="a">
<input type="submit">
</form>
Expected result:
----------------
array (
'id_name' => '1',
'id__name' => 'a',
)
Actual result:
--------------
array (
'id_name' => '1',
'id_[name' => 'a',
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78236&edit=1