Closes #13859: Merged fix from 3.2 - thanks to Matt Joiner for spotting this and the patch.