Forward port of issue #46202 to 3.5.x.
Forward port of issue #46202 to 3.5.x.