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