Skip to content

Commit 10ff373

Browse files
[5.x] Prevent zeros being filtered out in Array fieldtype (statamic#12039)
1 parent 16d22d7 commit 10ff373

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Fieldtypes/Arr.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ public function process($data)
108108

109109
if ($this->config('expand')) {
110110
return collect($data)
111-
->when($this->isKeyed(), fn ($items) => $items->filter())
111+
->when($this->isKeyed(), fn ($items) => $items->reject(fn ($value) => is_null($value)))
112112
->map(fn ($value, $key) => ['key' => $key, 'value' => $value])
113113
->values()
114114
->all();
115115
}
116116

117117
if ($this->isKeyed()) {
118-
return collect($data)->filter()->all();
118+
return collect($data)->reject(fn ($value) => is_null($value))->all();
119119
}
120120

121121
return $data;

0 commit comments

Comments
 (0)