See the attached testcase (originally made for 7955).
Created attachment 7273 [details] testcase
This is fixed.