php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77172 convert error on receiving variables from external sources
Submitted: 2018-11-18 04:43 UTC Modified: 2018-11-19 13:36 UTC
From: zhoumengkang@php.net Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: master-Git-2018-11-18 (Git) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
20 - 14 = ?
Subscribe to this entry?

 
 [2018-11-18 04:43 UTC] 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',
  ),
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-19 12:49 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2018-11-19 12:49 UTC] cmb@php.net
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).
 [2018-11-19 13:11 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=346017
Log: Fix #77172: convert error on receiving variables from external sources
 [2018-11-19 13:36 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2018-11-19 13:36 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:05 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=5c58791fed00a9d3b835b6dd80283255fc3004a3
Log: Fix #77172: convert error on receiving variables from external sources
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 04:01:30 2024 UTC