Skip to content

Commit 698afe7

Browse files
committed
test(Helpers): cover non-array wildcard items, zero keys, and add changelog
1 parent ecb5919 commit 698afe7

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎docs/changelogs/v4.7.7.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Release Date: Unreleased
2020
- **Database:** Fixed a bug where `SQLSRV\Builder::_upsertBatch()` concatenated `$table` unescaped into `Object_ID()`, causing syntax errors for table names with quotes or special characters.
2121
- **Database:** Fixed a bug where `SQLSRV\Forge::_alterTable()` interpolated table and column names without escaping in default constraint lookups.
2222
- **Database:** Fixed a bug where `SQLite3\Table::dropIndexes()` used single-quoted string literals instead of escaped identifiers in `DROP INDEX IF EXISTS`, causing syntax errors on index names containing quotes or special characters.
23+
- **Helpers:** Fixed a bug in `ArrayHelper::dotKeyExists()` where `'0'` path segments caused early loop termination and returned `true`, and non-array intermediate values threw a `TypeError`.
2324
- **HTTP:** Fixed a bug where `UploadedFile::move()` and `UploadedFile::store()` on Windows could store a file under a different name than `getName()` reported, or write its contents to an NTFS alternate data stream. Filenames ending in a period or space or containing a colon are now rejected, including explicitly supplied names.
2425
- **Images:** Fixed a bug in `ImageMagickHandler::save()` where saving without an extension or with an unsupported extension threw an `ImagickException` instead of falling back to the image's format.
2526
- **Security:** Fixed a bug where `Security::__construct()` threw a `TypeError` when the CSRF cookie was an array, causing an HTTP 500 response for affected requests.

‎tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public function testDotKeyExists(): void
4646
$this->assertFalse(ArrayHelper::dotKeyExists('contacts.friends.0.nonexistent', $this->array));
4747
$this->assertFalse(ArrayHelper::dotKeyExists('contacts.friends.1.name', $this->array));
4848
$this->assertFalse(ArrayHelper::dotKeyExists('0', []));
49+
$this->assertTrue(ArrayHelper::dotKeyExists('0', ['0' => 'value']));
50+
$this->assertTrue(ArrayHelper::dotKeyExists('0', ['0' => null]));
4951
$this->assertFalse(ArrayHelper::dotKeyExists('contacts.friends.0.name.sub', $this->array));
5052
$this->assertFalse(ArrayHelper::dotKeyExists('contacts.friends.1.age.sub', $this->array));
5153
}
@@ -80,5 +82,6 @@ public function testDotKeyExistsWithWildCard(): void
8082
$this->assertFalse(ArrayHelper::dotKeyExists('contacts.*.1.name', $this->array));
8183
$this->assertFalse(ArrayHelper::dotKeyExists('contacts.friends.*.age.sub', $this->array));
8284
$this->assertFalse(ArrayHelper::dotKeyExists('contacts.friends.1.age.*.sub', $this->array));
85+
$this->assertFalse(ArrayHelper::dotKeyExists('*.name', [['name' => 'Fred'], 'not-an-array']));
8386
}
8487
}

0 commit comments

Comments
 (0)