Committed on trunk and core-8-6-branch; thanks to Mojca Miklavec for the patch.