Skip to content

Commit 861b768

Browse files
committed
[fix] toArray
1.修復 `toArray()` 時將 0/null/false/'' 等值誤判為不存在並捨棄狀況
1 parent 78ed36b commit 861b768

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## [v2.4.5] - 2025-09-12
4+
5+
### 🐞 修正
6+
7+
- 修復 `toArray()` 時將 0/null/false/'' 等值誤判為不存在並捨棄狀況。
8+
39
## [v2.4.4] - 2025-09-10
410

511
### 🐞 修正

src/ImmutableBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ final public function toArray(): array
215215
} else {
216216
if (is_object($value) && method_exists($value, 'toArray')) {
217217
$properties[$key] = $value->toArray();
218-
} elseif ($value) {
218+
} else {
219219
$properties[$key] = $value;
220220
}
221221
}

0 commit comments

Comments
 (0)