|  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
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:
Solve the problem:
9 + 47 = ?
Subscribe to this entry?

 [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: Sat Jul 20 23:01:28 2024 UTC