Skip to content

Fix reusage of reference for unknown nodes #18

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dgrothaus-ku
Copy link

The reference to $output was overwritten by nodes not covered by the switch construct.

Example to test:

<root>
  <Nodes>
    <Node One="1" Two="2" />
    <Node Two="2" Three="3" />
            <!-- Content omitted -->
    <Node Three="3" Four="4" />
  </Nodes>
</root>

Array without patch:

[
  'root' => [
    'Nodes' => [
      'Node' => [
        '@value'    => '',
        '@attributes' => [
          'Three' => '3',
          'Four'  => '4',
        ],
      ],
    ],
  ],
];

Array with patch:

[
  'root' => [
    'Nodes' => [
      'Node' => [
        0 => [
          '@value'    => '',
          '@attributes' => [
            'One' => '1',
            'Two' => '2',
          ],
        ],
        1 => [
          '@value'    => '',
          '@attributes' => [
            'Two'   => '2',
            'Three' => '3',
          ],
        ],
        2 => [
          '@value'    => '',
          '@attributes' => [
            'Three' => '3',
            'Four'  => '4',
          ],
        ],
      ],
    ],
  ],
];

The reference to $output was overwritten by nodes not covered by the switch construct.

Example to test:
```xml
<root>
  <Nodes>
    <Node One="1" Two="2" />
    <Node Two="2" Three="3" />
            <!-- Content omitted -->
    <Node Three="3" Four="4" />
  </Nodes>
</root>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant