Wrong argument type might be passed to filterExists()
Background
filterStorage.addFiltersWithMetadata()
avoid filter issues by throwing an exception for the existing filters. Internally it uses storageFilter.filterExists()
to check for duplicates.
The issue
addFiltersWithMetadata()
accepts a filter object or an array of filter objects and convert it to an array if necessary.
Then it passes the original argument (instead of a new filter array to) filterExists()
. In some cases it can iterate over the filter object as ActiveFilter
is iterable, but othrwise it will throw a "wrong type" exception.