Skip to content

Commit e61b831

Browse files
committed
test(Helpers): cover non-array wildcard items, zero keys, and add changelog
1 parent 50a887b commit e61b831

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
@@ -27,6 +27,7 @@ Release Date: Unreleased
2727
- **Database:** Fixed a bug where `SQLite3\Connection::_foreignKeyData()` did not escape table identifiers in `PRAGMA foreign_key_list`, causing syntax errors on table names containing hyphens or schemas.
2828
- **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.
2929
- **Helpers:** Fixed a bug where `excerpt()` threw a `TypeError` when `$phrase` was not found in `$text` or when `$phrase` was `null` and `$radius` was an odd integer. When `$phrase` is not found, `excerpt()` now falls back to extracting an excerpt from the beginning of `$text`.
30+
- **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`.
3031
- **HTTP:** Fixed a bug where query-string based routing truncated additional query parameters in `SiteURIFactory::parseRequestURI()` due to incorrect array index access.
3132
- **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.
3233
- **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.

‎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)