Issue #1344036 by das-peter, Berdir: Fix cache clear fails when using wildcards - strange behavior with wildcard_valid().