php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42962 form data gets lost: revisited
Submitted: 2007-10-14 15:03 UTC Modified: 2007-10-15 09:52 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: efbiaiinzinz at hotmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.4 OS: Windows + Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: efbiaiinzinz at hotmail dot com
New email:
PHP Version: OS:

 

 [2007-10-14 15:03 UTC] efbiaiinzinz at hotmail dot com
Description:
------------
reposting http://bugs.php.net/?id=42960 since it was marked falsely as bogus and referring to another bug which is also marked as bogus, where actually PHP form variable importing is incorrect and data gets lost(more accurately, submitting image x coordinate gets lost)
it could be parsed by hand from HTTP_RAW_POST_DATA, bt it does not get populated in case of file uploads, so not much help

quick fix for all those problems listed in previously mentioned bugreport

image[field].x=1
image[field].y=2
insert into POST/GET array "image" => array() if not exists, insert into it "field_x" => 1 and "field_y" => 2

image[field][].x=1
image[field][].y=2
image[field][].x=3
image[field][].y=4

find first input from raw post data
insert into POST/GET array "image" => array() if not exists, into it insert "field" => array() if not exists
now the tricky part
find the [] part
see that it has .x
create new entry into "field" => array()
"0_x" => 1
find [] in next line, see that it's .y, use same index as before and create "0_y" => 2
find [] in next line, see that it has .x, increment index and insert "1_x" => 3
and after that with same index 1 "1_y" => 4

so in the end array would be
"image" => array(
  "field" => array(
    "0_x" => 1,
    "0_y" => 2,
    "1_x" => 3,
    "1_y" => 4
  )
)


It would help to actually think about the problem that seems to be quite severe (variables get lost which could actually be retrieved quite normally with some better logic) before setting status to bogus and referring to manual and some other similar bug report which is resolved with hack instead of actual fix

easist fix of all would be to make code accept
image[field].x=1
image[field].y=2
and convert to
"image" => array(
  "field_x" => 1,
  "field_y" => 2,
)

Quoting: 'PHP has no idea what to do with "image[key].x" so the ".x" is stripped away and the "image" array created with the index "key".'

Are you or are you not the ones responsible for fixing bugs and odd behavuiours in PHP instead of just saying that it currently acts buggy and that you have no intention about fixing it ????

Sorry for the big comment, but when I tried shorter before, the bug got reported as bogus without any further investigation.

Reproduce code:
---------------
same as in http://bugs.php.net/?id=42960

Expected result:
----------------
same as in http://bugs.php.net/?id=42960

Actual result:
--------------
same as in http://bugs.php.net/?id=42960

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-15 09:52 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Feb 12 18:00:02 2026 UTC