Closes #22386: merged fix from 3.4.