lib-array2xml
lib-array2xml copied to clipboard
Fix reusage of reference for unknown nodes
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',
],
],
],
],
],
];