|  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
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.
Bug Type:
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 */



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-31 21:29 UTC]
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: Wed Jul 24 15:01:29 2024 UTC