Skip to content

Commit d250d4f

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

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
@@ -16,6 +16,7 @@ Release Date: Unreleased
1616

1717
## Bugs Fixed
1818

19+
- **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`.
1920
- **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.
2021
- **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.
2122
- **Worker Mode:** Fixed a bug where every request that ended with an uncaught exception, including a `404 Page Not Found` without a 404 override, called `exit()` in the exception handler. This ended the worker script, so FrankenPHP booted a new one, and the worker loop skipped its cleanup after the request. The exception handler now returns to the worker loop.

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