Forward port of issue #19293 to 2.2.x.