Fixes #19467. (cherry picked from commit e8f99f4e) (cherry picked from commit b234ee78)
mentioned in commit 70ff9137