wtf php, array_filter() will return an array with gaps in it...
This commit is contained in:
parent
ecb3c642a9
commit
6bde7457e7
2 changed files with 2 additions and 1 deletions
|
@ -146,7 +146,7 @@ class Search
|
|||
/**
|
||||
* Count the number of image results for a given search
|
||||
*
|
||||
* @param string[] $tags
|
||||
* @param list<string> $tags
|
||||
*/
|
||||
public static function count_images(array $tags = []): int
|
||||
{
|
||||
|
|
|
@ -197,6 +197,7 @@ class DanbooruApi extends Extension
|
|||
$tags = array_filter($tags, static function ($element) {
|
||||
return $element !== "*";
|
||||
});
|
||||
$tags = array_values($tags); // reindex array because count_images() expects a 0-based array
|
||||
$count = Search::count_images($tags);
|
||||
$results = Search::find_images(max($start, 0), min($limit, 100), $tags);
|
||||
}
|
||||
|
|
Reference in a new issue