From e143f2b284571b87e9db90da07a3fc3aae2da46c Mon Sep 17 00:00:00 2001 From: Joby Elliott Date: Fri, 14 Sep 2018 10:39:12 -0600 Subject: [PATCH] case-insensitivity is pointless --- src/FlatArrayTrait.php | 4 ++-- tests/FlatArrayTest.php | 12 +++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/FlatArrayTrait.php b/src/FlatArrayTrait.php index 8108405..0dbfbd6 100644 --- a/src/FlatArrayTrait.php +++ b/src/FlatArrayTrait.php @@ -151,7 +151,7 @@ trait FlatArrayTrait { //normalize key names in $value, and also $name $value = $this->normalizeValue($value); - $name = strtolower($name); + $name = $name; //check for home strings if ($name == '' || $name === null) { if ($unset) { @@ -210,7 +210,7 @@ trait FlatArrayTrait } $norm = []; foreach ($value as $key => $value) { - $nKey = preg_replace('/\./', '', strtolower($key)); + $nKey = preg_replace('/\./', '', $key); if ($nKey == '') { throw new \Exception("Key \"$key\" can't be used inside a FlatArray"); } diff --git a/tests/FlatArrayTest.php b/tests/FlatArrayTest.php index 70d10ea..d46565b 100644 --- a/tests/FlatArrayTest.php +++ b/tests/FlatArrayTest.php @@ -89,19 +89,13 @@ class FlatArrayTest extends TestCase ); } - public function testCaseNormalizing() + public function testCaseSensitivity() { $h = new FlatArray([ 'ABC'=>['ABC'=>'ABC'] ]); - $this->assertEquals('ABC', $h['abc.abc']); - $this->assertEquals('ABC', $h['Abc.aBC']); - $h['Abc.aBC'] = 'abc'; - $this->assertEquals('abc', $h['abc.abc']); - $this->assertEquals('abc', $h['Abc.aBC']); - $h['ABC'] = ['ABC'=>'ABC']; - $this->assertEquals('ABC', $h['abc.abc']); - $this->assertEquals('ABC', $h['Abc.aBC']); + $this->assertNull($h['abc.abc']); + $this->assertNull($h['Abc.aBC']); } public function testAccidentalSubstrings()