Edit report at https://bugs.php.net/bug.php?id=64325&edit=1
ID: 64325 Updated by: larue...@php.net Reported by: php at sygmoral dot com Summary: Issue in automatic $_POST array handling Status: 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: 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["[]"]); Previous Comments: ------------------------------------------------------------------------ [2013-03-03 14:10:48] re...@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] larue...@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] larue...@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 ------------------------------------------------------------------------ [2013-02-28 19:45:57] php at sygmoral dot com Thank you for your reaction! But no: I did in fact mean what I wrote. I realise it's a strange data structure, so here's a short explanation for it: the 'save' array holds a collection of html form elements that are not yet to be submitted, but should be saved temporarily into some other set of memory, so that upon the next visit, those temporary values can be easily inserted into the displayed form, without having been submitted. In other words, it's for a form that remembers its state throughout visits. So I send an object containing the name-value pairs in the form, and send that over POST. In the example used here, this results in one or more name-value pairs that are saved into the save array, as save['line[]'] = value. And that is the situation that triggers this bug, as in my original post. I'm sure there are other ways to achieve what I want, but I figured I'd report it since this does not look as if it's intended. Note that the example is a simplification of my application, where multiple 'single' and 'array' values are saved. ------------------------------------------------------------------------ [2013-02-28 18:22:57] re...@php.net "post_data = {'save[line[]]':'A line with text'}â do you mean post_data = {'save[line][]':'A line with text'} ? ^^ is this you intention? array( 'save' => ['line' => ['A line with text', 'maybe more lines'] ] ); ? ------------------------------------------------------------------------ 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