Skip to content

merge algorithm output depends on input key order #37

@sheppard

Description

@sheppard

It looks like the algorithm for merging conflicting usages will produce different results depending on key order:

<form enctype='application/json'>
  <input name='mix' value='scalar'>
  <input name='mix[0]' value='array 1'>
  <input name='mix[key]' value='key key'>
</form>

produces

{
    "mix":  {
        "":     "scalar"
    ,   "0":    "array 1"
    ,   "key":  "key key"
    }
}

But:

<form enctype='application/json'>
  <input name='mix[0]' value='array 1'>
  <input name='mix' value='scalar'>
  <input name='mix[key]' value='key key'>
</form>

produces

{
    "mix":  {
        "0":    "array 1"
    ,   "1":     "scalar"
    ,   "key":  "key key"
    }
}

This is probably fine when relying on the DOM order on the client, but on the server it can produce seemingly random inconsistencies when using dictionary / hash structures with arbitrary key ordering.

Should the spec be updated to handle this situation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions