Req #78584 [Opn->Sus]: Could you please populate $_FORMDATA?

From: Date: Sun, 22 Sep 2019 12:09:03 +0000
Subject: Req #78584 [Opn->Sus]: Could you please populate $_FORMDATA?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222863@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78584&edit=1 ID: 78584 Updated by: requinix@php.net Reported by: 6562680 at gmail dot com Summary: Could you please populate $_FORMDATA? -Status: Open +Status: Suspended Type: Feature/Change Request -Package: *Web Server problem +Package: *General Issues Operating System: Win10 PHP Version: 7.2.23RC1 Block user comment: N Private report: N New Comment: A feature like this requires going through the RFC process. https://wiki.php.net/rfc/howto Previous Comments: ------------------------------------------------------------------------ [2019-09-22 12:02:26] 6562680 at gmail dot com Description: ------------ When PHP parses url with parse_str() to populate $_POST/$_FILES on multipart/form-data,PHP merges same keys into one value, its known behavior. I tried to fill form fields after redirect from POST to GET with validation error. When merged - it's not possible. Would be great to have $_FORMDATA that should looks like this (opinion): [ ['hello[name][]', 123], ['hello[name][]', 123], ['hello[]', 123], ['hello[]', 123], ['hello', 123], ] because $_POST will looks like [ 'hello' => 123 ] Problem happened when we work with multifields (button '+ add field') or multiselects - where we should set "selected" for its options Test script: --------------- // get.php <form method="POST" type="multipart/form-data"> <select multiple="multiple" name="hello[name][]"> <option value="123">123</option> </select> <input type="text" name="hello[name][]" value="123" /> <input type="text" name="hello[name][]" value="123" /> <input type="text" name="hello[]" value="123" /> <input type="text" name="hello[]" value="123" /> <input type="text" name="hello" value="123" /> <button type="submit">Send</button> </form> // post.php var_dump($_POST); Expected result: ---------------- var_dump($_POST); [ 'hello' => '123' ] var_dump($_FORMDATA); [ ['hello[name][]', 123], // select(multiple) ['hello[name][]', 123], // input[] ['hello[name][]', 123], // input[] ['hello[]', 123], // input[] ['hello[]', 123], // input[] ['hello', 123], // input ] ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78584&edit=1

« previous php.bugs (#222863) next »