Fixed #22756, added tests.