Skip to content

Commit 6da1456

Browse files
committed
Merge branch '3.0'
* 3.0: fixed previous merge [2.7] Fixed flatten exception recursion with errors Embedded identifier support Also transform inline mappings to objects Change the ExtensionInterface load method definition to bo identical to the documentation. add and correct armenian translations [Config] Fix array sort on normalization in edge case [Security] Run tests on all PHP versions [DomCrawler] Revert previous restriction, allow selection of every DOMNode object [Serializer] Make metadata interfaces internal [Yaml] fix indented line handling in folded blocks improve BrowserKit test coverage p1
2 parents 09752a8 + 7ba87ea commit 6da1456

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Definition/ArrayNode.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,17 @@ protected function preNormalize($value)
5656
return $value;
5757
}
5858

59+
$normalized = array();
60+
5961
foreach ($value as $k => $v) {
6062
if (false !== strpos($k, '-') && false === strpos($k, '_') && !array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) {
61-
$value[$normalizedKey] = $v;
62-
unset($value[$k]);
63+
$normalized[$normalizedKey] = $v;
64+
} else {
65+
$normalized[$k] = $v;
6366
}
6467
}
6568

66-
return $value;
69+
return $normalized;
6770
}
6871

6972
/**

Tests/Definition/ArrayNodeTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public function getPreNormalizationTests()
8686
array('foo-bar_moo' => 'foo'),
8787
array('foo-bar_moo' => 'foo'),
8888
),
89+
array(
90+
array('anything-with-dash-and-no-underscore' => 'first', 'no_dash' => 'second'),
91+
array('anything_with_dash_and_no_underscore' => 'first', 'no_dash' => 'second'),
92+
),
8993
array(
9094
array('foo-bar' => null, 'foo_bar' => 'foo'),
9195
array('foo-bar' => null, 'foo_bar' => 'foo'),

0 commit comments

Comments
 (0)