Forward port of issue #18915 to 2.3.0.M2.