Allow cache and session to work with FETCH_ASSOC. Fixes #547