php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16369 parse_str renames keys
Submitted: 2002-03-31 21:27 UTC Modified: 2002-03-31 21:29 UTC
From: admin at internettech dot ca Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.0.6 OS: win2000 adv server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: admin at internettech dot ca
New email:
PHP Version: OS:

 

 [2002-03-31 21:27 UTC] admin at internettech dot ca
When returning the results of parse_str() to an array,
the key will be renamed if it contains a period.

$str = "first=value&second[]=this+works&per.iod[]=another";
parse_str($str, $newArray);

echo $newArray;
/* prints "Array" */

echo $newArray['second']['0'];
/* prints "this works" */

echo $newArray['per.iod']['0'];
/* "Undefined index: per.iod " */

/* however...*/
echo $newArray['per_iod']['0']; /* prints "another" */

/* notice the array key has been renamed from per.iod to per_iod */

Glen

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-31 21:29 UTC] rasmus@php.net
That's on purpose since a . is not a legal character in a variable name.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 13:01:29 2024 UTC