Skip to content

Commit b1a0b56

Browse files
committed
Fix indices in the array returned by Record::getSubjects
Unfortunately `array_filter()` preserves indices. Wrapping it in `array_values()` to prevent this.
1 parent 88cb636 commit b1a0b56

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Record.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@ public function getTitle()
189189
*/
190190
public function getSubjects($vocabulary = null, $tag = null)
191191
{
192-
return array_filter(Subject::get($this), function (Subject $field) use ($vocabulary, $tag) {
192+
return array_values(array_filter(Subject::get($this), function (Subject $field) use ($vocabulary, $tag) {
193193
$a = is_null($vocabulary) || $vocabulary == $field->vocabulary;
194194
$b = is_null($tag) || $tag == $field->type;
195195

196196
return $a && $b;
197-
});
197+
}));
198198
}
199199

200200
/*************************************************************************

0 commit comments

Comments
 (0)