Forward port of issue #48448 to 4.0.x.
Forward port of issue #48448 to 4.0.x.