Forward port of issue #21687 to 2.3.1.