Forward port of issue #19569 to 2.2.3.