Forward port of issue #19523 to 2.2.3.