Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML request payloads can't contain tags of the same name #3

Open
LukeCarrier opened this issue Jun 20, 2018 · 0 comments
Open

XML request payloads can't contain tags of the same name #3

LukeCarrier opened this issue Jun 20, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@LukeCarrier
Copy link
Contributor

LukeCarrier commented Jun 20, 2018

Because of the way SimpleXML places significance on the tag name and uses it as an index for elements, elements with the same name cause the parsed result's structure to not match up to the parameters.

For instance, the following structure:

<request>
  <multi>
    <single>0</single>
  </multi>
</single>

(correctly) gets interpreted as the following:

[
  'multi' => [
    'single' => 0,
  ],
]

With multiple single elements:

<request>
  <multi>
    <single>0</single>
    <single>1</single>
  </multi>
</single>

the generated output instead looks like:

[
  'multi' => [
    'single' => [
      0,
      1,
    ],
  ],
]

This causes parameter validation to fail.

For the time being, the mitigation is to use unique names for the single elements, e.g. single-0, single-1.

@LukeCarrier LukeCarrier added the bug Something isn't working label Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant