Merged solution for #11324 from 3.2.