Forward port of issue #21264 to 2.3.0.