Created by: cvrebert
Fixes #11003 (closed). /to @mdo for ASAP review. Would like to get this into v3.0.1.