Bug #64325 [Com]: Issue in automatic $_POST array handling

From: Date: Sat, 04 Jan 2014 17:16:02 +0000
Subject: Bug #64325 [Com]: Issue in automatic $_POST array handling
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183588@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64325&edit=1 ID: 64325 Comment by: php at sygmoral dot com Reported by: php at sygmoral dot com Summary: Issue in automatic $_POST array handling Status: No Feedback Type: Bug Package: *General Issues Operating System: Debian PHP Version: 5.4.12 Assigned To: laruence Block user comment: N Private report: N New Comment: So far I've actually circumvented the bug (or feature), but that makes my code look a bit weird as I'm accessing data like $arr["somkey["]. Here's a short case that shows exactly what happens: $str = "arr[weirdkey[]]=foo&arr[otherkey[]]=bar"; parse_str($str, $output); var_dump($output); I'll probably end up changing how my application works, but still, I feel like something is amiss in how it currently works. I feel like it should either keep track of the brackets and so use -everything- inside the outer brackets as the key for the array; or otherwise, if the parser simply stops at the first ] (which is fine), I feel like I should get a notice or warning or... something somewhere, since there's another ] before the =. It's like arr[key]]=foo, isn't that supposed to fail? Previous Comments: ------------------------------------------------------------------------ [2013-10-15 11:54:38] php-bugs at lists dot php dot net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. ------------------------------------------------------------------------ [2013-03-03 14:28:14] laruence@php.net I noticed, that's why I didn't going further, and I don't think it related to documented or not: <?php $array ["[]"] = "xxxx"; var_dump($array["[]"]); ------------------------------------------------------------------------ [2013-03-03 14:10:48] reeze@php.net The attached patch may break form like: foo[bar][index]=test after some research, this seems a undocumented behavior but not a bug. only the field name save can not have '[' and other special chars. the subkeys didn't required to be a legal variable name but '[]' are special chars. ------------------------------------------------------------------------ [2013-03-01 03:29:43] laruence@php.net The following patch has been added/updated: Patch Name: bug64325.patch Revision: 1362108583 URL: https://bugs.php.net/patch-display.php?bug=64325&patch=bug64325.patch&revision=1362108583 ------------------------------------------------------------------------ [2013-03-01 03:29:02] laruence@php.net PHP won't allow variables name to contains "[", "." etc , so I think this is really a narrow usage. but, however I do believe there is a bug. a patch will be attached. but I need to ask someone else's opinion before commit it. thanks ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=64325 -- Edit this bug report at https://bugs.php.net/bug.php?id=64325&edit=1

« previous php.bugs (#183588) next »