Skip to content

Wrong handling of arrays in HTTP POST requests #93

Closed
@TobiasBg

Description

@TobiasBg

While testing my plugin in the Playground, I found that either the "webserver part" or the "PHP part" seems to be treating HTTP POST variables wrong that are an array.

In particular, in my plugin I have an HTML form with inputs like

<input type="text" name="table[name]" value="" />

Note the array-type name attribute.

In PHP, this should be available as $_POST['table']['name']. However, $_POST['table'] does not exist.

A var_dump( $_POST ); gives

array(9) {
  ...
  ["table[name]"]=>
  string(4) "test"
  ["table[description]"]=>
  string(4) "test"
  ["table[rows]"]=>
  string(1) "5"
  ["table[columns]"]=>
  string(1) "5"
  ...
}

here (unneeded info stripped).

On a "normal" setup, I however (correctly) get

array(6) {
  ...
  ["table"]=>
  array(4) {
    ["name"]=>
    string(4) "test"
    ["description"]=>
    string(5) "test"
    ["rows"]=>
    string(1) "5"
    ["columns"]=>
    string(1) "5"
  }
  ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions