Forward port of issue #25772 to 2.4.x

Comment From: philwebb

Closed via commit ca9fae6b476bac76c82e75da5b36a0a8c88fdcd1