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