php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78236 convert error on receiving variables when duplicate [
Submitted: 2019-07-01 07:45 UTC Modified: 2020-07-23 09:16 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: hongweichen8888 at sina dot com Assigned: cmb (profile)
Status: Closed Package: Variables related
PHP Version: 7.2.19 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hongweichen8888 at sina dot com
New email:
PHP Version: OS:

 

 [2019-07-01 07:45 UTC] 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',
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-23 09:16 UTC] cmb@php.net
-Status: Open +Status: Verified -Type: Documentation Problem +Type: Bug -Package: Documentation problem +Package: Variables related -Assigned To: +Assigned To: cmb
 [2020-07-23 09:16 UTC] 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>
 [2020-07-23 13:48 UTC] cmb@php.net
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 [
 [2020-07-23 13:48 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 19:01:30 2024 UTC