1c50dd8bb8
While this code is suspect, better to go back to the old state for now,
as there is no simple fix that doesn't introduce other issues.
Fix #115022
Fix #115414
This reverts commit 063a9e8964.