From:             efbiaiinzinz at hotmail dot com
Operating system: Windows + Linux
PHP version:      5.2.4
PHP Bug Type:     Scripting Engine problem
Bug description:  form data gets lost: revisited

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

-- 
Edit bug report at http://bugs.php.net/?id=42962&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42962&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42962&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42962&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42962&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42962&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42962&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42962&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42962&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42962&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42962&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42962&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42962&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42962&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42962&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42962&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42962&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42962&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42962&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42962&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42962&r=mysqlcfg

Reply via email to