ID:               745
 Comment by:       C_C_ at C_C_ dot C_C_
 Reported By:      be at shonline dot de
 Status:           Analyzed
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      4.3.0-dev
 New Comment:

That is becuse the name $foo[123]_x and $foo[123]_y is not a proper
variable name in PHP. If you need to do stuf like that, you can use the
$_GET and $_POST aray variables, put number in and check for that stuf.
It is the web browser that is doing that, and that is properly. It is
not to fix that rite now.


Previous Comments:
------------------------------------------------------------------------

[2002-12-02 18:18:20] [EMAIL PROTECTED]

Given raw post data of: foo%5B123%5D.x=5&foo%5B123%5D.y=10

I disagree with having the script engine turn that into:
[foo] => Array ( 
  [123] => Array (
    [x] => 5
    [y] => 10
  )    
) 
as this would break backward compatability (though I doubt many scripts
are using this to be honest).

There are two sensical solution that pop into my head:
#1)
[foo] => Array ( 
  [123]   => 10    // For BC
  [123.x] => 5
  [123.y] => 10
) 

>From an engine stand point all this says is "if the ] is not at the end
of the varname, move it there."

However, I don't like this idea either.  While it makes the data
accessable without breaking anything, it's just plain ugly.

#2)
[foo] => Array ( 
  [123]   => 10    // For BC
) 
[foo_x] => Array ( 
  [123]   => 5
) 
[foo_y] => Array ( 
  [123]   => 10
) 

>From an engine stand point all this says is "if there is a [] block
which is not at the end of the varname, make one copy of the var with
the end truncated, then move the [] block to the end and export that
varname as well."
i.e.: foo[123]bar => foo[123] && foobar[123]

And come to that it would want to include cases where there is non []
text between [] blocks:
i.e.: foo[123]bar[456] => foo[123][456] && foobar[123][456]
or possibly...
foo[123]bar[456] => foo[123][456] && foo[123][bar][456]

I can get behind this approach... At least in principal... But I don't
believe in its need enough to work on it unless it gets a several +1s. 
It also has the disadvantage of allowing scripters to get used to
naming their form elements incorrectly. (Not that the image example is
incorrect, per se, but it's a special case as the browser modifies the
name beyond the control of the designer).

------------------------------------------------------------------------

[2002-07-01 08:49:43] [EMAIL PROTECTED]

Raw post data and resulting variables:

foo%5B123%5D.x=5&foo%5B123%5D.y=10
Array ( [foo] => Array ( [123] => 10 ) ) 


bar%5B%5D.x=5&bar%5B%5D.y=10
Array ( [bar] => Array ( [0] => 5 [1] => 10 ) )


foobar.x=5&foobar.y=10
Array ( [foobar_x] => 5 [foobar_y] => 10 ) 

Not very consistent..



------------------------------------------------------------------------

[2002-01-14 05:57:40] wank at wank dot com

what a load of wank

------------------------------------------------------------------------

[2001-12-12 15:02:08] [EMAIL PROTECTED]

Personally, I would rather avoid adding configuration 
directives for something as small as this! :)


------------------------------------------------------------------------

[2001-12-12 14:45:10] [EMAIL PROTECTED]

i'd like to have $whatever[...][...][x] and $whatever[...][...][y] in
all cases, maybe 
with ini switches for old, new or both ...

------------------------------------------------------------------------

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
    http://bugs.php.net/745

-- 
Edit this bug report at http://bugs.php.net/?id=745&edit=1

Reply via email to